|
143 | 143 | return TRUE |
144 | 144 |
|
145 | 145 |
|
| 146 | +/datum/action/cooldown/chameleon_copy |
| 147 | + name = "Copy person" |
| 148 | + button_icon = 'yogstation/icons/mob/actions.dmi' |
| 149 | + button_icon_state = "chameleon_copy" |
| 150 | + var/target_range = 3 |
| 151 | + var/syndicate = FALSE |
| 152 | + var/active = FALSE |
| 153 | + var/copying = FALSE |
| 154 | + var/in_use = FALSE |
| 155 | + |
| 156 | +/datum/action/cooldown/chameleon_copy/InterceptClickOn(mob/living/caller, params, atom/target) |
| 157 | + click_with_power(target) |
| 158 | + |
| 159 | +/datum/action/cooldown/chameleon_copy/Grant(mob/M) |
| 160 | + if(syndicate) |
| 161 | + owner_has_control = is_syndicate(M) |
| 162 | + . = ..() |
| 163 | + |
| 164 | +/datum/action/cooldown/chameleon_copy/proc/toggle_button() |
| 165 | + if(active) |
| 166 | + active = FALSE |
| 167 | + background_icon_state = "bg_default" |
| 168 | + build_all_button_icons() |
| 169 | + unset_click_ability(owner) |
| 170 | + return FALSE |
| 171 | + active = TRUE |
| 172 | + background_icon_state = "bg_default_on" |
| 173 | + build_all_button_icons() |
| 174 | + set_click_ability(owner) |
| 175 | + |
| 176 | +/datum/action/cooldown/chameleon_copy/Trigger(trigger_flags, atom/target) |
| 177 | + if(active) |
| 178 | + toggle_button() |
| 179 | + else |
| 180 | + to_chat(owner, span_announce("Whom shall your chameleon kit copy?")) //Bad wording, need to improve it |
| 181 | + toggle_button() |
| 182 | + |
| 183 | + |
| 184 | +/datum/action/cooldown/chameleon_copy/proc/CheckValidTarget(atom/target) |
| 185 | + if(target == owner) |
| 186 | + return FALSE |
| 187 | + if(!ishuman(target)) |
| 188 | + return FALSE |
| 189 | + return TRUE |
| 190 | + |
| 191 | +/datum/action/cooldown/chameleon_copy/proc/click_with_power(atom/target_atom) |
| 192 | + if(in_use || !CheckValidTarget(target_atom)) |
| 193 | + return FALSE |
| 194 | + in_use = TRUE |
| 195 | + FireTargetedPower(target_atom) |
| 196 | + in_use = FALSE |
| 197 | + return TRUE |
| 198 | + |
| 199 | +/datum/action/cooldown/chameleon_copy/proc/FireTargetedPower(atom/target_atom) |
| 200 | + var/mob/living/carbon/human/T = target_atom |
| 201 | + var/datum/outfit/O = new() |
| 202 | + to_chat(owner, span_notice("Attempting to copy [T]...")) |
| 203 | + if(!do_after(owner, 10 SECONDS, target_atom)) |
| 204 | + return |
| 205 | + O.uniform = T.w_uniform |
| 206 | + O.suit = T.wear_suit |
| 207 | + O.head = T.head |
| 208 | + O.shoes = T.shoes |
| 209 | + O.gloves = T.gloves |
| 210 | + O.ears = T.ears |
| 211 | + O.glasses = T.glasses |
| 212 | + O.mask = T.wear_mask |
| 213 | + O.back = T.back |
| 214 | + var/list/types = O.get_chameleon_disguise_info() |
| 215 | + for(var/Y in types) |
| 216 | + for(var/V in owner.chameleon_item_actions) |
| 217 | + var/datum/action/item_action/chameleon/change/A = V |
| 218 | + var/obj/item/I = Y |
| 219 | + if(A.chameleon_blacklist[Y] || (initial(I.item_flags) & ABSTRACT || !initial(I.icon_state))) |
| 220 | + continue |
| 221 | + 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. |
| 222 | + A.update_look(owner, Y) |
| 223 | + A.copying = TRUE |
| 224 | + A.copy_target = T |
| 225 | + to_chat(owner, span_notice("Successfully copied [T]!")) |
| 226 | + toggle_button() |
| 227 | + |
| 228 | + |
146 | 229 | /datum/action/item_action/chameleon/change |
147 | 230 | name = "Chameleon Change" |
148 | 231 | var/list/chameleon_blacklist = list() //This is a typecache |
|
152 | 235 | var/emp_timer |
153 | 236 | var/current_disguise = null |
154 | 237 | var/syndicate = FALSE |
| 238 | + var/copying = FALSE |
| 239 | + var/mob/living/copy_target |
155 | 240 |
|
156 | 241 | /datum/action/item_action/chameleon/change/Grant(mob/M) |
157 | 242 | if(M && (owner != M)) |
|
160 | 245 | var/datum/action/chameleon_outfit/O = new /datum/action/chameleon_outfit() |
161 | 246 | O.syndicate = syndicate |
162 | 247 | O.Grant(M) |
| 248 | + var/datum/action/cooldown/chameleon_copy/C = new /datum/action/cooldown/chameleon_copy() |
| 249 | + C.syndicate = syndicate |
| 250 | + C.Grant(M) |
163 | 251 | else |
164 | 252 | M.chameleon_item_actions |= src |
165 | 253 | if(syndicate) |
|
172 | 260 | if(!LAZYLEN(M.chameleon_item_actions)) |
173 | 261 | var/datum/action/chameleon_outfit/O = locate(/datum/action/chameleon_outfit) in M.actions |
174 | 262 | qdel(O) |
| 263 | + var/datum/action/cooldown/chameleon_copy/C = locate(/datum/action/cooldown/chameleon_copy) in M.actions |
| 264 | + qdel(C) |
175 | 265 | return ..() |
176 | 266 |
|
177 | 267 | /datum/action/item_action/chameleon/change/proc/initialize_disguises() |
|
195 | 285 | if(!picked_item) |
196 | 286 | return |
197 | 287 | update_look(user, picked_item) |
| 288 | + copying = FALSE |
198 | 289 |
|
199 | 290 | /datum/action/item_action/chameleon/change/proc/random_look(mob/user) |
200 | 291 | var/picked_name = pick(chameleon_list) |
|
275 | 366 | if(istype(atom_target, /obj/item/clothing/suit/space/hardsuit/infiltration)) //YOGS START |
276 | 367 | var/obj/item/clothing/suit/space/hardsuit/infiltration/I = target |
277 | 368 | var/obj/item/clothing/suit/space/hardsuit/HS = picked_item |
278 | | - var/obj/item/clothing/head/helmet/helmet = initial(HS.helmettype) |
| 369 | + var/obj/item/clothing/head/helmet/space/hardsuit/helmet = initial(HS.helmettype) |
279 | 370 | I.head_piece.initial_state = initial(helmet.icon_state) |
280 | | - update_item(helmet, I.head_piece) |
281 | 371 | I.head_piece.update_appearance(UPDATE_ICON) |
| 372 | + I.head_piece.current_disguise = picked_item |
| 373 | + I.head_piece.new_type = helmet.hardsuit_type |
| 374 | + var/datum/action/A |
| 375 | + for(var/X in I.actions) |
| 376 | + A = X |
| 377 | + A.build_all_button_icons() |
| 378 | + |
282 | 379 | qdel(helmet) |
283 | 380 | //YOGS END |
284 | 381 |
|
|
616 | 713 | chameleon_action.emp_randomise(INFINITY) |
617 | 714 |
|
618 | 715 | /obj/item/clothing/mask/chameleon/attack_self(mob/user) |
| 716 | + if(!is_syndicate(user)) //Wouldn't want someone to randomly find a switch on a mask, would we? |
| 717 | + return |
619 | 718 | vchange = !vchange |
620 | 719 | to_chat(user, span_notice("The voice changer is now [vchange ? "on" : "off"]!")) |
621 | 720 | if(vchange) |
|
0 commit comments