Files
Polaris/code/modules/projectiles/guns/energy/nuclear.dm
2015-11-19 07:27:34 -05:00

95 lines
4.0 KiB
Plaintext

/obj/item/weapon/gun/energy/gun
name = "energy gun"
desc = "Another bestseller of Lawson Arms and the FTU, the LAEP90 Perun is a versatile energy based sidearm, capable of switching between low and high capacity projectile settings. In other words: Stun or Kill."
icon_state = "energystun100"
item_state = null //so the human update icon uses the icon_state instead.
fire_sound = 'sound/weapons/Taser.ogg'
max_shots = 10
projectile_type = /obj/item/projectile/beam/stun
origin_tech = list(TECH_COMBAT = 3, TECH_MAGNET = 2)
modifystate = "energystun"
firemodes = list(
list(mode_name="stun", projectile_type=/obj/item/projectile/beam/stun, modifystate="energystun", fire_sound='sound/weapons/Taser.ogg'),
list(mode_name="lethal", projectile_type=/obj/item/projectile/beam, modifystate="energykill", fire_sound='sound/weapons/Laser.ogg'),
)
/obj/item/weapon/gun/energy/gun/mounted
name = "mounted energy gun"
self_recharge = 1
use_external_power = 1
/obj/item/weapon/gun/energy/gun/burst
name = "fm-2t"
desc = "The FM-2t is a versatile energy based small arm, capable of switching between stun or kill with a three round burst option for both settings."
icon_state = "fm-2tstun100"
item_state = null //so the human update icon uses the icon_state instead.
fire_sound = 'sound/weapons/Taser.ogg'
max_shots = 12
projectile_type = /obj/item/projectile/beam/stun/weak
origin_tech = list(TECH_COMBAT = 4, TECH_MAGNET = 2, TECH_ILLEGAL = 3)
modifystate = "fm-2tstun"
firemodes = list(
list(mode_name="stun", projectile_type=/obj/item/projectile/beam/stun/weak, modifystate="fm-2tstun", fire_sound='sound/weapons/Taser.ogg'),
list(mode_name="stun 3-round bursts", burst=3, fire_delay=null, move_delay=4, burst_accuracy=list(0,-1,-1), dispersion=list(0.0, 0.6, 1.0), projectile_type=/obj/item/projectile/beam/stun, modifystate="fm-2tstun", fire_sound='sound/weapons/Taser.ogg'),
list(mode_name="lethal", projectile_type=/obj/item/projectile/beam/weaklaser, modifystate="fm-2tkill", fire_sound='sound/weapons/Laser.ogg'),
list(mode_name="lethal 3-round bursts", burst=3, fire_delay=null, move_delay=4, burst_accuracy=list(0,-1,-1), dispersion=list(0.0, 0.6, 1.0), projectile_type=/obj/item/projectile/beam, modifystate="fm-2tkill", fire_sound='sound/weapons/Laser.ogg'),
)
/obj/item/weapon/gun/energy/gun/nuclear
name = "advanced energy gun"
desc = "An energy gun with an experimental miniaturized reactor."
icon_state = "nucgun"
origin_tech = list(TECH_COMBAT = 3, TECH_MATERIAL = 5, TECH_POWER = 3)
slot_flags = SLOT_BELT
force = 8 //looks heavier than a pistol
self_recharge = 1
modifystate = null
firemodes = list(
list(mode_name="stun", projectile_type=/obj/item/projectile/beam/stun, fire_sound='sound/weapons/Taser.ogg'),
list(mode_name="lethal", projectile_type=/obj/item/projectile/beam, fire_sound='sound/weapons/Laser.ogg'),
)
var/lightfail = 0
//override for failcheck behaviour
/obj/item/weapon/gun/energy/gun/nuclear/process()
charge_tick++
if(charge_tick < 4) return 0
charge_tick = 0
if(!power_supply) return 0
if((power_supply.charge / power_supply.maxcharge) != 1)
power_supply.give(charge_cost)
update_icon()
return 1
/obj/item/weapon/gun/energy/gun/nuclear/proc/update_charge()
var/ratio = power_supply.charge / power_supply.maxcharge
ratio = round(ratio, 0.25) * 100
overlays += "nucgun-[ratio]"
/obj/item/weapon/gun/energy/gun/nuclear/proc/update_reactor()
if(lightfail)
overlays += "nucgun-medium"
else if ((power_supply.charge/power_supply.maxcharge) <= 0.5)
overlays += "nucgun-light"
else
overlays += "nucgun-clean"
/obj/item/weapon/gun/energy/gun/nuclear/proc/update_mode()
var/datum/firemode/current_mode = firemodes[sel_mode]
switch(current_mode.name)
if("stun") overlays += "nucgun-stun"
if("lethal") overlays += "nucgun-kill"
/obj/item/weapon/gun/energy/gun/nuclear/update_icon()
overlays.Cut()
update_charge()
update_reactor()
update_mode()