Energy Field Hitting (#10678)

This commit is contained in:
Geeves
2020-12-01 19:59:01 +02:00
committed by GitHub
parent a8ee8e6c16
commit c82bcbda40
2 changed files with 46 additions and 16 deletions
+39 -16
View File
@@ -3,26 +3,37 @@
/obj/effect/energy_field
name = "energy field"
desc = "Impenetrable field of energy, capable of blocking anything as long as it's active."
desc = "A strong field of energy, capable of blocking movement as long as it's active."
icon = 'icons/obj/machines/shielding.dmi'
icon_state = "shieldsparkles"
alpha = 0
mouse_opacity = 0
anchored = 1
layer = 4.1 //just above mobs
density = 0
invisibility = 101
var/strength = 0
var/ticks_recovering = 10
var/is_strong = FALSE // if strength goes is 1 or above, this is set to TRUE, this is to prevent flickering and animate being called constantly
atmos_canpass = CANPASS_ALWAYS
/obj/effect/energy_field/New()
..()
/obj/effect/energy_field/Initialize()
. = ..()
update_nearby_tiles()
/obj/effect/energy_field/Destroy()
update_nearby_tiles()
return ..()
/obj/effect/energy_field/attackby(obj/item/I, mob/user)
user.do_attack_animation(src, I)
if(I.force < 10)
user.visible_message(SPAN_WARNING("[user] harmlessly attacks \the [src] with \the [I]."), SPAN_WARNING("You attack \the [src] with \the [I], but it bounces off without doing any damage."))
else
user.visible_message(SPAN_WARNING("[user] attacks \the [src] with \the [I]."), SPAN_WARNING("You attack \the [src] with \the [I]."))
Stress(I.force / 10)
/obj/effect/energy_field/ex_act(var/severity)
Stress(0.5 + severity)
@@ -34,14 +45,20 @@
//if we take too much damage, drop out - the generator will bring us back up if we have enough power
ticks_recovering = min(ticks_recovering + 2, 10)
if(strength < 1)
invisibility = 101
density = 0
if(strength < 1 && is_strong)
alpha = 255
density = FALSE
mouse_opacity = 0
animate(src, 2 SECONDS, alpha = 0)
is_strong = FALSE
ticks_recovering = 10
strength = 0
else if(strength >= 1)
invisibility = 0
density = 1
else if(strength >= 1 && !is_strong)
alpha = 0
mouse_opacity = 1
density = TRUE
animate(src, 2 SECONDS, alpha = 255)
is_strong = TRUE
/obj/effect/energy_field/proc/Strengthen(var/severity)
strength += severity
@@ -50,12 +67,18 @@
//if we take too much damage, drop out - the generator will bring us back up if we have enough power
var/old_density = density
if(strength >= 1)
invisibility = 0
density = 1
else if(strength < 1)
invisibility = 101
density = 0
if(strength >= 1 && !is_strong)
alpha = 0
mouse_opacity = 1
density = TRUE
animate(src, 2 SECONDS, alpha = 255)
is_strong = TRUE
else if(strength < 1 && is_strong)
alpha = 255
density = FALSE
mouse_opacity = 0
animate(src, 2 SECONDS, alpha = 0)
is_strong = FALSE
if (density != old_density)
update_nearby_tiles()
+7
View File
@@ -0,0 +1,7 @@
author: Geeves
delete-after: True
changes:
- rscadd: "You can now destroy the energy fields that shield generators make by hitting it, as long as your weapon is strong enough."
- rscadd: "Energy shields now fade in and fade out, instead of just popping into existence."