From c8a5661e8268551305af04e7c54e29f07dca8795 Mon Sep 17 00:00:00 2001 From: Remie Richards Date: Fri, 24 Jul 2015 16:26:59 +0100 Subject: [PATCH] Ninja invisibility now turns off at <= 0 charge, Ninja invisibility effects moved to animate() instead of ancient anim() --- .../ninja/suit/n_suit_verbs/ninja_stealth.dm | 47 ++++--------------- code/modules/ninja/suit/suit.dm | 1 - code/modules/ninja/suit/suit_process.dm | 24 +++++----- 3 files changed, 22 insertions(+), 50 deletions(-) diff --git a/code/modules/ninja/suit/n_suit_verbs/ninja_stealth.dm b/code/modules/ninja/suit/n_suit_verbs/ninja_stealth.dm index e87ac8e1ff8..107502ce151 100644 --- a/code/modules/ninja/suit/n_suit_verbs/ninja_stealth.dm +++ b/code/modules/ninja/suit/n_suit_verbs/ninja_stealth.dm @@ -3,20 +3,22 @@ Contents: - Stealth Verbs -- Stealth Icon Stuff */ /obj/item/clothing/suit/space/space_ninja/proc/toggle_stealth() var/mob/living/carbon/human/U = affecting + if(!U) + return if(s_active) cancel_stealth() else - spawn(0) - anim(U.loc,U,'icons/mob/mob.dmi',,"cloak",,U.dir) + if(cell.charge <= 0) + U << "You don't have enough power to enable Stealth!" + return s_active=!s_active - U.alpha = 0 + animate(U, U.alpha = 0,time = 15) U.visible_message("[U.name] vanishes into thin air!", \ "You are now invisible to normal detection.") return @@ -24,11 +26,11 @@ Contents: /obj/item/clothing/suit/space/space_ninja/proc/cancel_stealth() var/mob/living/carbon/human/U = affecting + if(!U) + return 0 if(s_active) - spawn(0) - anim(U.loc,U,'icons/mob/mob.dmi',,"uncloak",,U.dir) s_active=!s_active - U.alpha = 255 + animate(U, U.alpha = 255, time = 15) U.visible_message("[U.name] appears from thin air!", \ "You are now visible.") return 1 @@ -45,34 +47,3 @@ Contents: else affecting << "Stealth does not appear to work!" - -//Allows the mob to grab a stealth icon. -/mob/proc/NinjaStealthActive(atom/A)//A is the atom which we are using as the overlay. - invisibility = INVISIBILITY_LEVEL_TWO//Set ninja invis to 2. - var/icon/opacity_icon = new(A.icon, A.icon_state) - var/icon/alpha_mask = getIconMask(src) - var/icon/alpha_mask_2 = new('icons/effects/effects.dmi', "at_shield1") - alpha_mask.AddAlphaMask(alpha_mask_2) - opacity_icon.AddAlphaMask(alpha_mask) - for(var/i=0,i<5,i++)//And now we add it as overlays. It's faster than creating an icon and then merging it. - var/image/I = image("icon" = opacity_icon, "icon_state" = A.icon_state, "layer" = layer+0.8)//So it's above other stuff but below weapons and the like. - switch(i)//Now to determine offset so the result is somewhat blurred. - if(1) - I.pixel_x -= 1 - if(2) - I.pixel_x += 1 - if(3) - I.pixel_y -= 1 - if(4) - I.pixel_y += 1 - - overlays += I//And finally add the overlay. - overlays += image("icon"='icons/effects/effects.dmi',"icon_state" ="electricity","layer" = layer+0.9) - -//When ninja steal malfunctions. -/mob/proc/NinjaStealthMalf() - invisibility = 0//Set ninja invis to 0. - overlays += image("icon"='icons/effects/effects.dmi',"icon_state" ="electricity","layer" = layer+0.9) - playsound(loc, 'sound/effects/stealthoff.ogg', 75, 1) - - diff --git a/code/modules/ninja/suit/suit.dm b/code/modules/ninja/suit/suit.dm index 810e9058165..5fcca544ae9 100644 --- a/code/modules/ninja/suit/suit.dm +++ b/code/modules/ninja/suit/suit.dm @@ -83,7 +83,6 @@ Contents: cell.charge = 9000 - /obj/item/clothing/suit/space/space_ninja/Destroy() if(affecting) affecting << browse(null, "window=hack spideros") diff --git a/code/modules/ninja/suit/suit_process.dm b/code/modules/ninja/suit/suit_process.dm index 6440ffc71c9..73fcd2d788c 100644 --- a/code/modules/ninja/suit/suit_process.dm +++ b/code/modules/ninja/suit/suit_process.dm @@ -4,25 +4,27 @@ set background = BACKGROUND_ENABLED //Runs in the background while the suit is initialized. - spawn while(cell.charge) + //Requires charge or stealth to process. + spawn while(cell.charge || s_active) - //Let's check for some safeties. if(s_initialized && !affecting) terminate()//Kills the suit and attached objects. if(!s_initialized) - return//When turned off the proc stops. + return - //Now let's do the normal processing. - if(s_coold) - s_coold--//Checks for ability s_cooldown first. + if(cell.charge) + if(s_coold) + s_coold--//Checks for ability s_cooldown first. - var/A = s_cost//s_cost is the default energy cost each ntick, usually 5. - if(s_active)//If stealth is active. - A += s_acost - cell.charge-=A + var/A = s_cost//s_cost is the default energy cost each ntick, usually 5. + if(s_active)//If stealth is active. + A += s_acost + cell.charge-=A - if(!cell.charge) + if(cell.charge <= 0) cell.charge=0 cancel_stealth() sleep(10)//Checks every second. + +