From 1fac967212d42eec9aa518904fd0ff8920ec6ca7 Mon Sep 17 00:00:00 2001 From: Albert Iordache Date: Mon, 26 Dec 2011 20:30:45 +0200 Subject: [PATCH] TG update: Added the (almost finished) displacer. One minor bug with it to work out, does not actually spawn anywhere though so it shouldn't effect anything. Will try to finish it later tonight. --- code/game/objects/devices/shields.dm | 31 +++++++++++++++++++ code/game/objects/items/item.dm | 2 -- code/modules/mob/living/carbon/human/human.dm | 6 ++++ .../mob/living/carbon/human/human_defense.dm | 17 +++++++++- 4 files changed, 53 insertions(+), 3 deletions(-) diff --git a/code/game/objects/devices/shields.dm b/code/game/objects/devices/shields.dm index c48afdf548..2d86830285 100644 --- a/code/game/objects/devices/shields.dm +++ b/code/game/objects/devices/shields.dm @@ -51,6 +51,37 @@ return /obj/item/weapon/cloaking_device/emp_act(severity) + active = 0 + icon_state = "shield0" + ..() + +/obj/item/weapon/displacer + name = "displacer field" + desc = "Projects a specialized energy field designed to teleport the user out of harms way." + icon = 'device.dmi' + icon_state = "shield0" + var/active = 0.0 + flags = FPRINT | TABLEPASS| CONDUCT| ONBELT + item_state = "electronic" + throwforce = 10.0 + throw_speed = 2 + throw_range = 10 + w_class = 4.0 + origin_tech = "magnets=3;bluespace=4" + + +/obj/item/weapon/displacer/attack_self(mob/user as mob) + src.active = !( src.active ) + if (src.active) + user << "\blue The displacer field is now active." + src.icon_state = "shield1" + else + user << "\blue The displacer field is now inactive." + src.icon_state = "shield0" + src.add_fingerprint(user) + return + +/obj/item/weapon/displacer/emp_act(severity) active = 0 icon_state = "shield0" ..() \ No newline at end of file diff --git a/code/game/objects/items/item.dm b/code/game/objects/items/item.dm index 7612273758..518bc4cea2 100644 --- a/code/game/objects/items/item.dm +++ b/code/game/objects/items/item.dm @@ -340,8 +340,6 @@ mob/proc/flash_weak_pain() /obj/item/proc/IsShield() return 0 - - /obj/item/proc/eyestab(mob/living/carbon/M as mob, mob/living/carbon/user as mob) var/mob/living/carbon/human/H = M diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 1f065ea48f..d575ac1182 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -1094,6 +1094,10 @@ if (S.active) shielded = 2 break + for (var/obj/item/weapon/displacer/D in src) + if (D.active) + shielded = 4 + break if(istype(wear_suit, /obj/item/clothing/suit/space/space_ninja)&&wear_suit:s_active) shielded = 3 @@ -1113,6 +1117,8 @@ NinjaStealthActive(loc) else NinjaStealthMalf() + if(4) + overlays += image("icon" = 'effects.dmi', "icon_state" = "shield-old", "layer" = MOB_LAYER+1) else invisibility = 0 diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm index 82204a2736..b4eed09ca9 100644 --- a/code/modules/mob/living/carbon/human/human_defense.dm +++ b/code/modules/mob/living/carbon/human/human_defense.dm @@ -57,9 +57,24 @@ emp_act if(I.IsShield() && (prob(50 - round(damage / 3)))) visible_message("\red [src] blocks [attack_text] with the [r_hand.name]!") return 1 + if(slot_belt && istype(slot_belt, /obj/item/weapon/displacer)) + var/obj/item/weapon/displacer/D = slot_belt + if(D.active && (prob(50))) + visible_message("\red The displacer field flings [src] out of the way of [attack_text]!") + var/list/turfs = new/list() + for(var/turf/T in orange(6)) + if(istype(T,/turf/space)) continue + if(T.density) continue + if(T.x>world.maxx-8 || T.x<8) continue + if(T.y>world.maxy-8 || T.y<8) continue + turfs += T + if(!turfs.len) turfs += pick(/turf in orange(6)) + var/turf/picked = pick(turfs) + if(!isturf(picked)) return + src.loc = picked + return 1 return 0 - /mob/living/carbon/human/emp_act(severity) for(var/obj/O in src) if(!O) continue