Ion rifle stun mode update (#5657)

- Ion rifle has now two firing modes: lethal and stun
- Lethal firing mode cost is increased, resulting rifle full charge to last for 6 shots. Stun mode has the original cost, making it 10 shots.
- In Stun mode if the object that was hit is an IPC - it will stun IPC for 5(unstackable) seconds. But if the object is not IPC it will EMP only that object.
- I have reworked sprites to display both lethal and stun modes just like Carbine energy gun.
- Ion rifle is now a wielded weapon
- IPC/Borgs with EMP resistance module do not get affected by stun and consume half of charge
This commit is contained in:
Mykhailo Bykhovtsev
2018-12-03 10:32:52 +01:00
committed by Werner
parent 6fcac1bf0b
commit 0338a7988d
19 changed files with 132 additions and 35 deletions
@@ -216,7 +216,7 @@
interface_name = "mounted ion rifle"
interface_desc = "A shoulder-mounted cell-powered ion rifle."
gun_type = /obj/item/weapon/gun/energy/ionrifle/mounted
gun_type = /obj/item/weapon/gun/energy/rifle/ionrifle/mounted
/obj/item/rig_module/mounted/plasmacutter
name = "hardsuit plasma cutter"
+1 -1
View File
@@ -45,7 +45,7 @@ var/list/worths = list(
/obj/item/weapon/gun/energy/lasertag = 10,
/obj/item/weapon/gun/energy/pulse/pistol = 4500,
/obj/item/weapon/gun/energy/pulse = 5000,
/obj/item/weapon/gun/energy/ionrifle = 2000,
/obj/item/weapon/gun/energy/rifle/ionrifle = 2000,
/obj/item/weapon/gun/energy/decloner = 6500,
/obj/item/weapon/gun/energy/floragun = 1500,
/obj/item/weapon/gun/energy/mindflayer = 4500,
@@ -168,15 +168,26 @@ emp_act
if(isipc(src))
var/obj/item/organ/surge/s = src.internal_organs_by_name["surge"]
if(!isnull(s))
if(s.surge_left)
if(s.surge_left >= 1)
playsound(src.loc, 'sound/magic/LightningShock.ogg', 25, 1)
s.surge_left -= 1
if(s.surge_left)
to_chat(src, "<span class='warning'>Warning: EMP detected, integrated surge prevention module activated. There are [s.surge_left] preventions left.</span>")
visible_message("<span class='warning'>[src] was not affected by EMP pulse.</span>", "<span class='warning'>Warning: EMP detected, integrated surge prevention module activated. There are [s.surge_left] preventions left.</span>")
else
s.broken = 1
s.icon_state = "surge_ipc_broken"
to_chat(src, "<span class='warning'>Warning: EMP detected, integrated surge prevention module activated. The surge prevention module is fried, replacement recommended.</span>")
visible_message("<span class='warning'>[src] was not affected by EMP pulse.</span>", "<span class='warning'>Warning: EMP detected, integrated surge prevention module activated. The surge prevention module is fried, replacement recommended.</span>")
return 1
else if(s.surge_left == 0.5)
to_chat(src, "<span class='danger'>Warning: EMP detected, integrated surge prevention module is damaged and was unable to fully protect from EMP. Half of the damage taken. Replacement recommended.</span>")
for(var/obj/O in src)
if(!O) continue
O.emp_act(severity * 2) // EMP act takes reverse numbers
for(var/obj/item/organ/external/O in organs)
O.emp_act(severity)
for(var/obj/item/organ/I in O.internal_organs)
if(I.robotic == 0) continue
I.emp_act(severity * 2) // EMP act takes reverse numbers
return 1
else
to_chat(src, "<span class='danger'>Warning: EMP detected, integrated surge prevention module is fried and unable to protect from EMP. Replacement recommended.</span>")
@@ -157,7 +157,7 @@
/mob/living/silicon/robot/emp_act(severity)
var/datum/robot_component/surge/C = components["surge"]
if(C && C.installed)
if(C.surge_left)
if(C.surge_left >= 1)
playsound(src.loc, 'sound/magic/LightningShock.ogg', 25, 1)
C.surge_left -= 1
visible_message("<span class='warning'>[src] was not affected by EMP pulse.</span>", "<span class='warning'>Warning: Power surge detected, source - EMP. Surge prevention module re-routed surge to prevent damage to vital electronics.</span>")
@@ -167,6 +167,10 @@
C.destroy()
to_chat(src, "<span class='danger'>Module is entirely fried, replacement is recommended.</span>")
return
else if(C.surge_left == 0.5)
to_chat(src, "<span class='danger'>Warning: Power surge detected, source - EMP, integrated surge prevention module is damaged and was unable to fully protect from EMP. Half of the damage taken. Replacement recommended.</span>")
..(2) // borgs only take 1-2 EMP
return
else
to_chat(src, "<span class='notice'>Warning: Power surge detected, source - EMP. Surge prevention module is depleted and requires replacement</span>")
..()
@@ -2,7 +2,7 @@
name = "energy carbine"
desc = "An energy-based carbine with two settings: Stun and kill."
icon_state = "energystun100"
item_state = null //so the human update icon uses the icon_state instead.
item_state = null // so the human update icon uses the icon_state instead.
fire_sound = 'sound/weapons/Taser.ogg'
slot_flags = SLOT_BELT
accuracy = 1
+16 -14
View File
@@ -1,8 +1,10 @@
/obj/item/weapon/gun/energy/ionrifle
/obj/item/weapon/gun/energy/rifle/ionrifle
name = "ion rifle"
desc = "The NT Mk60 EW Halicon is a man portable anti-armor weapon designed to disable mechanical threats, produced by NT."
icon_state = "ionrifle"
item_state = "ionrifle"
desc = "The NT Mk70 EW Halicon is a man portable anti-armor weapon designed to disable mechanical threats, produced by NT. Has two settings: stun and kill"
icon_state = "ionriflestun100"
item_state = null // so the human update icon uses the icon_state instead.
modifystate = "ionriflestun"
projectile_type = /obj/item/projectile/ion/stun
fire_sound = 'sound/weapons/Laser.ogg'
origin_tech = list(TECH_COMBAT = 2, TECH_MAGNET = 4)
w_class = 4
@@ -12,21 +14,21 @@
slot_flags = SLOT_BACK
charge_cost = 300
max_shots = 10
projectile_type = /obj/item/projectile/ion
secondary_projectile_type = /obj/item/projectile/ion
secondary_fire_sound = 'sound/weapons/Laser.ogg'
can_turret = 1
can_switch_modes = 1
turret_sprite_set = "ion"
/obj/item/weapon/gun/energy/ionrifle/emp_act(severity)
firemodes = list(
list(mode_name="stun", projectile_type=/obj/item/projectile/ion/stun, modifystate="ionriflestun", fire_sound='sound/weapons/Laser.ogg', charge_cost = 300),
list(mode_name="lethal", projectile_type=/obj/item/projectile/ion, modifystate="ionriflekill", fire_sound='sound/weapons/Laser.ogg', charge_cost = 450)
)
/obj/item/weapon/gun/energy/rifle/ionrifle/emp_act(severity)
..(max(severity, 2)) //so it doesn't EMP itself, I guess
/obj/item/weapon/gun/energy/ionrifle/update_icon()
..()
if(power_supply.charge < charge_cost)
item_state = "ionrifle-empty"
else
item_state = initial(item_state)
/obj/item/weapon/gun/energy/ionrifle/mounted
/obj/item/weapon/gun/energy/rifle/ionrifle/mounted
name = "mounted ion rifle"
self_recharge = 1
use_external_power = 1
@@ -11,6 +11,48 @@
empulse(A, pulse_range, pulse_range)
return 1
/obj/item/projectile/ion/stun/on_impact(var/atom/A)
if(isipc(A))
var/mob/living/carbon/human/H = A
var/obj/item/organ/surge/s = H.internal_organs_by_name["surge"]
if(!isnull(s))
if(s.surge_left >= 0.5)
playsound(src.loc, 'sound/magic/LightningShock.ogg', 25, 1)
s.surge_left -= 0.5
if(s.surge_left)
H.visible_message("<span class='warning'>[H] was not affected by EMP pulse.</span>", "<span class='warning'>Warning: EMP detected, integrated surge prevention module activated. There are [s.surge_left] preventions left.</span>")
else
s.broken = 1
s.icon_state = "surge_ipc_broken"
to_chat(H, "<span class='warning'>Warning: EMP detected, integrated surge prevention module activated. The surge prevention module is fried, replacement recommended.</span>")
return 1
else
to_chat(src, "<span class='danger'>Warning: EMP detected, integrated surge prevention module is fried and unable to protect from EMP. Replacement recommended.</span>")
H.Weaken(5)
to_chat(H, "<span class='danger'>ERROR: detected low setting EMP, acutators experience temporary power loss. Attempting to restore power.</span>")
else if (isrobot(A))
var/mob/living/silicon/robot/R = A
var/datum/robot_component/surge/C = R.components["surge"]
if(C && C.installed)
if(C.surge_left >= 0.5)
playsound(src.loc, 'sound/magic/LightningShock.ogg', 25, 1)
C.surge_left -= 0.5
R.visible_message("<span class='warning'>[R] was not affected by EMP pulse.</span>", "<span class='warning'>Warning: Power surge detected, source - EMP. Surge prevention module re-routed surge to prevent damage to vital electronics.</span>")
if(C.surge_left)
to_chat(R, "<span class='notice'>Surge module has [C.surge_left] preventions left!</span>")
else
C.destroy()
to_chat(R, "<span class='danger'>Module is entirely fried, replacement is recommended.</span>")
return
else
to_chat(src, "<span class='notice'>Warning: Power surge detected, source - EMP. Surge prevention module is depleted and requires replacement</span>")
R.emp_act(2) // Borgs emp_act is 1-2
else
A.emp_act(3) // Deals less EMP damage then lethal setting, and not areal pulse
return 1
/obj/item/projectile/ion/small
name = "ion pulse"
pulse_range = 0
+1 -1
View File
@@ -34,7 +34,7 @@ var/global/list/datum/supply_drop_loot/supply_drop
/obj/item/weapon/gun/energy/laser,
/obj/item/weapon/gun/energy/laser,
/obj/item/weapon/gun/energy/sniperrifle,
/obj/item/weapon/gun/energy/ionrifle)
/obj/item/weapon/gun/energy/rifle/ionrifle)
/datum/supply_drop_loot/ballistics
name = "Ballistics"