Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

Commit ac064eb

Browse files
committed
Keeps chameleon copy to one proc
1 parent 7c2d2c7 commit ac064eb

File tree

2 files changed

+45
-31
lines changed

2 files changed

+45
-31
lines changed

code/modules/clothing/chameleon.dm

Lines changed: 34 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -99,39 +99,30 @@
9999
/datum/action/chameleon_outfit/Trigger()
100100
return select_outfit(owner)
101101

102-
/datum/action/chameleon_outfit/proc/select_outfit(mob/user, datum/outfit/outfit = null)
102+
/datum/action/chameleon_outfit/proc/select_outfit(mob/user)
103103
if(!user || !IsAvailable(feedback = FALSE))
104104
return FALSE
105105
var/datum/outfit/O
106-
if(isnull(outfit)) //If no outfit is passed, get the user to decide
107-
var/selected = tgui_input_list(user, "Select outfit to change into", "Chameleon Outfit", outfit_options)
108-
if(!IsAvailable(feedback = FALSE) || QDELETED(src) || QDELETED(user))
109-
return FALSE
110-
var/outfit_type = outfit_options[selected]
111-
if(!outfit_type)
112-
return FALSE
113-
O = new outfit_type()
114-
var/list/outfit_types = O.get_chameleon_disguise_info()
115-
for(var/V in user.chameleon_item_actions)
116-
var/datum/action/item_action/chameleon/change/A = V
117-
var/done = FALSE
118-
for(var/T in outfit_types)
119-
for(var/name in A.chameleon_list)
120-
if(A.chameleon_list[name] == T)
121-
A.update_look(user, T)
122-
outfit_types -= T
123-
done = TRUE
124-
break
125-
if(done)
126-
break
127-
else //If a specific outfit is passed through
128-
var/list/types = outfit.get_chameleon_disguise_info()
129-
for(var/T in types)
130-
for(var/V in user.chameleon_item_actions)
131-
var/datum/action/item_action/chameleon/change/A = V
132-
if(istype(T, A.chameleon_type))
106+
var/selected = tgui_input_list(user, "Select outfit to change into", "Chameleon Outfit", outfit_options)
107+
if(!IsAvailable(feedback = FALSE) || QDELETED(src) || QDELETED(user))
108+
return FALSE
109+
var/outfit_type = outfit_options[selected]
110+
if(!outfit_type)
111+
return FALSE
112+
O = new outfit_type()
113+
var/list/outfit_types = O.get_chameleon_disguise_info()
114+
for(var/V in user.chameleon_item_actions)
115+
var/datum/action/item_action/chameleon/change/A = V
116+
var/done = FALSE
117+
for(var/T in outfit_types)
118+
for(var/name in A.chameleon_list)
119+
if(A.chameleon_list[name] == T)
133120
A.update_look(user, T)
134-
return TRUE
121+
outfit_types -= T
122+
done = TRUE
123+
break
124+
if(done)
125+
break
135126
//hardsuit helmets/suit hoods
136127
if(O.toggle_helmet && (ispath(O.suit, /obj/item/clothing/suit/space/hardsuit) || ispath(O.suit, /obj/item/clothing/suit/hooded)) && ishuman(user))
137128
var/mob/living/carbon/human/H = user
@@ -218,8 +209,17 @@
218209
O.ears = T.ears
219210
O.glasses = T.glasses
220211
O.mask = T.wear_mask
221-
var/datum/action/chameleon_outfit/select = locate(/datum/action/chameleon_outfit) in owner.actions
222-
select.select_outfit(owner, O)
212+
O.back = T.back
213+
var/list/types = O.get_chameleon_disguise_info()
214+
for(var/Y in types)
215+
for(var/V in owner.chameleon_item_actions)
216+
var/datum/action/item_action/chameleon/change/A = V
217+
if(A.chameleon_blacklist[Y])
218+
continue
219+
if(istype(Y, A.chameleon_type)) //Need to make sure it's the right type, wouldn't want to wear an armour vest on your head.
220+
A.update_look(owner, Y)
221+
A.copying = TRUE
222+
A.copy_target = T
223223
to_chat(owner, span_notice("Successfully copied [T]!"))
224224
toggle_button()
225225

@@ -233,6 +233,8 @@
233233
var/emp_timer
234234
var/current_disguise = null
235235
var/syndicate = FALSE
236+
var/copying = FALSE
237+
var/mob/living/copy_target
236238

237239
/datum/action/item_action/chameleon/change/Grant(mob/M)
238240
if(M && (owner != M))
@@ -279,6 +281,7 @@
279281
if(!picked_item)
280282
return
281283
update_look(user, picked_item)
284+
copying = FALSE
282285

283286
/datum/action/item_action/chameleon/change/proc/random_look(mob/user)
284287
var/picked_name = pick(chameleon_list)

yogstation/code/modules/antagonists/infiltrator/objectives.dm

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,17 @@ GLOBAL_LIST_INIT(infiltrator_kidnap_areas, typecacheof(list(/area/shuttle/yogs/s
166166
if(!considered_escaped(M))
167167
continue
168168
var/mob/living/carbon/human/H = M.current
169+
var/clothing = H.chameleon_item_actions.len //8 possible clothes: Head, suit, ears, glasses, uniform, shoes, gloves, backpack
170+
var/copied = TRUE
171+
for(var/datum/action/item_action/chameleon/change/V in H.chameleon_item_actions)
172+
if(!V.copying)
173+
clothing -= 1
174+
if(V.copy_target != target)
175+
clothing -= 1
176+
if(clothing<3) //Some leniency if you don't have the required clothes or your target isn't wearing many, but not complete leniency
177+
copied = FALSE
178+
if(!copied)
179+
continue
169180
if(H.get_id_name() == target_real_name || target_missing_id)
170181
return TRUE
171182
return FALSE

0 commit comments

Comments
 (0)