From 35f13a850f0a17d9a319c972bc87ab2d9e4bc087 Mon Sep 17 00:00:00 2001 From: datlo Date: Tue, 8 Jan 2019 09:34:41 +0000 Subject: [PATCH] somebody toucha mah spaghet --- .../objects/items/devices/chameleonproj.dm | 54 ++++++++++--------- 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/code/game/objects/items/devices/chameleonproj.dm b/code/game/objects/items/devices/chameleonproj.dm index aedbcccd5f9..0b3ea4076a8 100644 --- a/code/game/objects/items/devices/chameleonproj.dm +++ b/code/game/objects/items/devices/chameleonproj.dm @@ -45,7 +45,7 @@ eject_all() playsound(get_turf(src), 'sound/effects/pop.ogg', 100, 1, -6) QDEL_NULL(active_dummy) - to_chat(usr, "You deactivate \the [src].") + to_chat(usr, "You deactivate [src].") var/obj/effect/overlay/T = new/obj/effect/overlay(get_turf(src)) T.icon = 'icons/effects/effects.dmi' flick("emppulse",T) @@ -58,7 +58,7 @@ var/obj/effect/dummy/chameleon/C = new/obj/effect/dummy/chameleon(usr.loc) C.activate(O, usr, saved_icon, saved_icon_state, saved_overlays, saved_underlays, src) qdel(O) - to_chat(usr, "You activate \the [src].") + to_chat(usr, "You activate [src].") var/obj/effect/overlay/T = new/obj/effect/overlay(get_turf(src)) T.icon = 'icons/effects/effects.dmi' flick("emppulse",T) @@ -159,11 +159,11 @@ var/activationCost = 300 var/activationUpkeep = 50 var/disguise = "landmate" - var/mob/living/silicon/robot/syndicate/saboteur/user + var/mob/living/silicon/robot/syndicate/saboteur/S /obj/item/borg_chameleon/Destroy() - if(user) - user.cham_proj = null + if(S) + S.cham_proj = null return ..() /obj/item/borg_chameleon/dropped(mob/user) @@ -186,45 +186,49 @@ /obj/item/borg_chameleon/proc/toggle(mob/living/silicon/robot/syndicate/saboteur/user) if(active) playsound(src, 'sound/effects/pop.ogg', 100, 1, -6) - to_chat(user, "You deactivate \the [src].") + to_chat(user, "You deactivate [src].") deactivate(user) else - to_chat(user, "You activate \the [src].") + to_chat(user, "You activate [src].") var/start = user.filters.len - var/X,Y,rsq,i,f - for(i=1, i<=7, ++i) + var/X + var/Y + var/rsq + var/i + var/f + for(i in 1 to 7) do - X = 60*rand() - 30 - Y = 60*rand() - 30 - rsq = X*X + Y*Y - while(rsq<100 || rsq>900) - user.filters += filter(type="wave", x=X, y=Y, size=rand()*2.5+0.5, offset=rand()) - for(i=1, i<=7, ++i) + X = 60 * rand() - 30 + Y = 60 * rand() - 30 + rsq = X * X + Y * Y + while(rsq < 100 || rsq > 900) + user.filters += filter(type = "wave", x = X, y = Y, size = rand() * 2.5 + 0.5, offset = rand()) + for(i in 1 to 7) f = user.filters[start+i] - animate(f, offset=f:offset, time=0, loop=3, flags=ANIMATION_PARALLEL) - animate(offset=f:offset-1, time=rand()*20+10) - if (do_after(user, 50, target=user) && user.cell.use(activationCost)) + animate(f, offset = f:offset, time = 0, loop = 3, flags = ANIMATION_PARALLEL) + animate(offset = f:offset - 1, time = rand() * 20 + 10) + if (do_after(user, 50, target = user) && user.cell.use(activationCost)) playsound(src, 'sound/effects/bamf.ogg', 100, 1, -6) to_chat(user, "You are now disguised as a Nanotrasen engineering cyborg.") activate(user) else to_chat(user, "The chameleon field fizzles.") do_sparks(3, FALSE, user) - for(i=1, i<=min(7, user.filters.len), ++i) // removing filters that are animating does nothing, we gotta stop the animations first - f = user.filters[start+i] + for(i in 1 to min(7, user.filters.len)) // removing filters that are animating does nothing, we gotta stop the animations first + f = user.filters[start + i] animate(f) user.filters = null /obj/item/borg_chameleon/process() - if(user) - if(!user.cell || !user.cell.use(activationUpkeep)) - disrupt(user) + if(S) + if(!S.cell || !S.cell.use(activationUpkeep)) + disrupt(S) else return PROCESS_KILL /obj/item/borg_chameleon/proc/activate(mob/living/silicon/robot/syndicate/saboteur/user) processing_objects.Add(src) - src.user = user + S = user user.base_icon = disguise user.icon_state = disguise user.cham_proj = src @@ -233,11 +237,11 @@ /obj/item/borg_chameleon/proc/deactivate(mob/living/silicon/robot/syndicate/saboteur/user) processing_objects.Remove(src) + S = user user.base_icon = initial(user.base_icon) user.icon_state = initial(user.icon_state) active = FALSE user.update_icons() - src.user = user /obj/item/borg_chameleon/proc/disrupt(mob/living/silicon/robot/syndicate/saboteur/user) if(active)