Skip to content

Commit

Permalink
Keeps chameleon copy to one proc
Browse files Browse the repository at this point in the history
  • Loading branch information
Oblisk234 committed Nov 27, 2024
1 parent 7c2d2c7 commit ac064eb
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 31 deletions.
65 changes: 34 additions & 31 deletions code/modules/clothing/chameleon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -99,39 +99,30 @@
/datum/action/chameleon_outfit/Trigger()
return select_outfit(owner)

/datum/action/chameleon_outfit/proc/select_outfit(mob/user, datum/outfit/outfit = null)
/datum/action/chameleon_outfit/proc/select_outfit(mob/user)
if(!user || !IsAvailable(feedback = FALSE))
return FALSE
var/datum/outfit/O
if(isnull(outfit)) //If no outfit is passed, get the user to decide
var/selected = tgui_input_list(user, "Select outfit to change into", "Chameleon Outfit", outfit_options)
if(!IsAvailable(feedback = FALSE) || QDELETED(src) || QDELETED(user))
return FALSE
var/outfit_type = outfit_options[selected]
if(!outfit_type)
return FALSE
O = new outfit_type()
var/list/outfit_types = O.get_chameleon_disguise_info()
for(var/V in user.chameleon_item_actions)
var/datum/action/item_action/chameleon/change/A = V
var/done = FALSE
for(var/T in outfit_types)
for(var/name in A.chameleon_list)
if(A.chameleon_list[name] == T)
A.update_look(user, T)
outfit_types -= T
done = TRUE
break
if(done)
break
else //If a specific outfit is passed through
var/list/types = outfit.get_chameleon_disguise_info()
for(var/T in types)
for(var/V in user.chameleon_item_actions)
var/datum/action/item_action/chameleon/change/A = V
if(istype(T, A.chameleon_type))
var/selected = tgui_input_list(user, "Select outfit to change into", "Chameleon Outfit", outfit_options)
if(!IsAvailable(feedback = FALSE) || QDELETED(src) || QDELETED(user))
return FALSE
var/outfit_type = outfit_options[selected]
if(!outfit_type)
return FALSE
O = new outfit_type()
var/list/outfit_types = O.get_chameleon_disguise_info()
for(var/V in user.chameleon_item_actions)
var/datum/action/item_action/chameleon/change/A = V
var/done = FALSE
for(var/T in outfit_types)
for(var/name in A.chameleon_list)
if(A.chameleon_list[name] == T)
A.update_look(user, T)
return TRUE
outfit_types -= T
done = TRUE
break
if(done)
break
//hardsuit helmets/suit hoods
if(O.toggle_helmet && (ispath(O.suit, /obj/item/clothing/suit/space/hardsuit) || ispath(O.suit, /obj/item/clothing/suit/hooded)) && ishuman(user))
var/mob/living/carbon/human/H = user
Expand Down Expand Up @@ -218,8 +209,17 @@
O.ears = T.ears
O.glasses = T.glasses
O.mask = T.wear_mask
var/datum/action/chameleon_outfit/select = locate(/datum/action/chameleon_outfit) in owner.actions
select.select_outfit(owner, O)
O.back = T.back
var/list/types = O.get_chameleon_disguise_info()
for(var/Y in types)
for(var/V in owner.chameleon_item_actions)
var/datum/action/item_action/chameleon/change/A = V
if(A.chameleon_blacklist[Y])
continue
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.
A.update_look(owner, Y)
A.copying = TRUE
A.copy_target = T
to_chat(owner, span_notice("Successfully copied [T]!"))
toggle_button()

Expand All @@ -233,6 +233,8 @@
var/emp_timer
var/current_disguise = null
var/syndicate = FALSE
var/copying = FALSE
var/mob/living/copy_target

/datum/action/item_action/chameleon/change/Grant(mob/M)
if(M && (owner != M))
Expand Down Expand Up @@ -279,6 +281,7 @@
if(!picked_item)
return
update_look(user, picked_item)
copying = FALSE

/datum/action/item_action/chameleon/change/proc/random_look(mob/user)
var/picked_name = pick(chameleon_list)
Expand Down
11 changes: 11 additions & 0 deletions yogstation/code/modules/antagonists/infiltrator/objectives.dm
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,17 @@ GLOBAL_LIST_INIT(infiltrator_kidnap_areas, typecacheof(list(/area/shuttle/yogs/s
if(!considered_escaped(M))
continue
var/mob/living/carbon/human/H = M.current
var/clothing = H.chameleon_item_actions.len //8 possible clothes: Head, suit, ears, glasses, uniform, shoes, gloves, backpack
var/copied = TRUE
for(var/datum/action/item_action/chameleon/change/V in H.chameleon_item_actions)
if(!V.copying)
clothing -= 1
if(V.copy_target != target)
clothing -= 1
if(clothing<3) //Some leniency if you don't have the required clothes or your target isn't wearing many, but not complete leniency
copied = FALSE
if(!copied)
continue
if(H.get_id_name() == target_real_name || target_missing_id)
return TRUE
return FALSE

0 comments on commit ac064eb

Please sign in to comment.