Merge pull request #3940 from Anewbe/technomancer_armor

Improves the tesla and shield generator armors
This commit is contained in:
Neerti
2017-09-28 16:22:18 -04:00
committed by GitHub
4 changed files with 53 additions and 35 deletions

View File

@@ -14,11 +14,11 @@
desc = "This armor has no inherent ability to absorb shock, as normal armor usually does. Instead, this emits a strong field \
around the wearer, designed to protect from most forms of harm, from lasers to bullets to close quarters combat. It appears to \
require a very potent supply of an energy of some kind in order to function."
icon_state = "reactiveoff" //wip
item_state = "reactiveoff"
icon_state = "shield_armor_0"
blood_overlay_type = "armor"
slowdown = 0
armor = list(melee = 0, bullet = 0, laser = 0, energy = 0, bomb = 0, bio = 0, rad = 0)
action_button_name = "Toggle Shield Projector"
var/active = 0
var/damage_to_energy_multiplier = 50.0 //Determines how much energy to charge for blocking, e.g. 20 damage attack = 750 energy cost
var/datum/effect/effect/system/spark_spread/spark_system = null
@@ -49,7 +49,7 @@
var/damage_to_energy_cost = (damage_to_energy_multiplier * damage_blocked)
if(!user.technomancer_pay_energy(damage_to_energy_cost))
user << "<span class='danger'>Your shield fades due to lack of energy!</span>"
to_chat(user, "<span class='danger'>Your shield fades due to lack of energy!</span>")
active = 0
update_icon()
return 0
@@ -67,7 +67,7 @@
P.damage = P.damage - damage_blocked
user.visible_message("<span class='danger'>\The [user]'s [src] absorbs [attack_text]!</span>")
user << "<span class='warning'>Your shield has absorbed most of \the [damage_source].</span>"
to_chat(user, "<span class='warning'>Your shield has absorbed most of \the [damage_source].</span>")
spark_system.start()
playsound(user.loc, 'sound/weapons/blade1.ogg', 50, 1)
@@ -75,14 +75,17 @@
/obj/item/clothing/suit/armor/shield/attack_self(mob/user)
active = !active
user << "<span class='notice'>You [active ? "" : "de"]active \the [src].</span>"
to_chat(user, "<span class='notice'>You [active ? "" : "de"]activate \the [src].</span>")
update_icon()
user.update_inv_wear_suit()
user.update_action_buttons()
/obj/item/clothing/suit/armor/shield/update_icon()
icon_state = "shield_armor_[active]"
item_state = "shield_armor_[active]"
if(active)
icon_state = "shield_armor"
set_light(2, 1, l_color = "#006AFF")
else
icon_state = "shield_armor_off"
set_light(0, 0, l_color = "#000000")
..()
return

View File

@@ -10,55 +10,70 @@
/obj/item/clothing/suit/armor/tesla
name = "tesla armor"
desc = "This rather dangerous looking armor will hopefully shock your enemies, and not you in the process."
icon_state = "reactive" //wip
item_state = "reactive"
icon_state = "tesla_armor_1" //wip
blood_overlay_type = "armor"
slowdown = 1
armor = list(melee = 0, bullet = 0, laser = 0, energy = 0, bomb = 0, bio = 0, rad = 0)
action_button_name = "Toggle Tesla Armor"
var/active = 1 //Determines if the armor will zap or block
var/ready = 1 //Determines if the next attack will be blocked, as well if a strong lightning bolt is sent out at the attacker.
var/ready_icon_state = "reactive" //also wip
var/normal_icon_state = "reactiveoff"
var/ready_icon_state = "tesla_armor_1" //also wip
var/normal_icon_state = "tesla_armor_0"
var/cooldown_to_charge = 15 SECONDS
/obj/item/clothing/suit/armor/tesla/handle_shield(mob/user, var/damage, atom/damage_source = null, mob/attacker = null, var/def_zone = null, var/attack_text = "the attack")
//First, some retaliation.
if(istype(damage_source, /obj/item/projectile))
var/obj/item/projectile/P = damage_source
if(P.firer && get_dist(user, P.firer) <= 3)
if(ready)
shoot_lightning(P.firer, 40)
else
shoot_lightning(P.firer, 15)
else
if(attacker && attacker != user)
if(get_dist(user, attacker) <= 3) //Anyone farther away than three tiles is too far to shoot lightning at.
if(active)
if(istype(damage_source, /obj/item/projectile))
var/obj/item/projectile/P = damage_source
if(P.firer && get_dist(user, P.firer) <= 3)
if(ready)
shoot_lightning(attacker, 40)
shoot_lightning(P.firer, 40)
else
shoot_lightning(attacker, 15)
shoot_lightning(P.firer, 15)
//Deal with protecting our wearer now.
if(ready)
ready = 0
spawn(cooldown_to_charge)
ready = 1
else
if(attacker && attacker != user)
if(get_dist(user, attacker) <= 3) //Anyone farther away than three tiles is too far to shoot lightning at.
if(ready)
shoot_lightning(attacker, 40)
else
shoot_lightning(attacker, 15)
//Deal with protecting our wearer now.
if(ready)
ready = 0
spawn(cooldown_to_charge)
ready = 1
update_icon()
to_chat(user, "<span class='notice'>\The [src] is ready to protect you once more.</span>")
visible_message("<span class='danger'>\The [user]'s [src.name] blocks [attack_text]!</span>")
update_icon()
user << "<span class='notice'>\The [src] is ready to protect you once more.</span>"
visible_message("<span class='danger'>\The [user]'s [src.name] blocks [attack_text]!</span>")
update_icon()
return 1
return 1
return 0
/obj/item/clothing/suit/armor/tesla/attack_self(mob/user)
active = !active
to_chat(user, "<span class='notice'>You [active ? "" : "de"]activate \the [src].</span>")
update_icon()
user.update_inv_wear_suit()
user.update_action_buttons()
/obj/item/clothing/suit/armor/tesla/update_icon()
..()
if(ready)
if(active && ready)
icon_state = ready_icon_state
item_state = ready_icon_state
set_light(2, 1, l_color = "#006AFF")
else
icon_state = normal_icon_state
item_state = normal_icon_state
set_light(0, 0, l_color = "#000000")
if(ishuman(loc))
var/mob/living/carbon/human/H = loc
H.update_inv_wear_suit(0)
H.update_action_buttons()
..()
/obj/item/clothing/suit/armor/tesla/proc/shoot_lightning(var/mob/target, var/power)
var/obj/item/projectile/beam/lightning/lightning = new(src)