diff --git a/code/modules/projectiles/ammunition/energy.dm b/code/modules/projectiles/ammunition/energy.dm index ae4f0f5c7b4..0a89745dfcf 100644 --- a/code/modules/projectiles/ammunition/energy.dm +++ b/code/modules/projectiles/ammunition/energy.dm @@ -5,7 +5,6 @@ projectile_type = /obj/item/projectile/energy var/e_cost = 100 //The amount of energy a cell needs to expend to create this shot. var/select_name = "energy" - var/mod_name = null fire_sound = 'sound/weapons/Laser.ogg' /obj/item/ammo_casing/energy/laser @@ -87,13 +86,11 @@ /obj/item/ammo_casing/energy/flora/yield projectile_type = /obj/item/projectile/energy/florayield - select_name = "increase yield" - mod_name = "yield" + select_name = "yield" /obj/item/ammo_casing/energy/flora/mut projectile_type = /obj/item/projectile/energy/floramut - select_name = "induce mutations" - mod_name = "mut" + select_name = "mutation" /obj/item/ammo_casing/energy/temp projectile_type = /obj/item/projectile/temp diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index e692bd7bb97..b7c64faa7a7 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -49,6 +49,11 @@ var/list/upgrades = list() + var/ammo_x_offset = 0 //used for positioning ammo count overlay on sprite + var/ammo_y_offset = 0 + var/flight_x_offset = 0 + var/flight_y_offset = 0 + /obj/item/weapon/gun/New() ..() if(pin) diff --git a/code/modules/projectiles/guns/energy.dm b/code/modules/projectiles/guns/energy.dm index 15115001e06..e1a143f2f5d 100644 --- a/code/modules/projectiles/guns/energy.dm +++ b/code/modules/projectiles/guns/energy.dm @@ -10,6 +10,7 @@ var/list/ammo_type = list(/obj/item/ammo_casing/energy) var/select = 1 //The state of the select fire switch. Determines from the ammo_type list what kind of shot is fired next. var/can_charge = 1 //Can it be charged in a recharger? + ammo_x_offset = 2 /obj/item/weapon/gun/energy/emp_act(severity) power_supply.use(round(power_supply.charge / severity)) @@ -72,25 +73,31 @@ return /obj/item/weapon/gun/energy/update_icon() - var/ratio = power_supply.charge / power_supply.maxcharge - ratio = min(Ceiling(ratio*4) * 25, 100) - var/obj/item/ammo_casing/energy/shot = ammo_type[select] - if(power_supply.charge < shot.e_cost) - ratio = 0 //so the icon changes to empty if the charge isn't zero but not enough for a shot. - switch(modifystate) - if (0) - icon_state = "[initial(icon_state)][ratio]" - if (1) - icon_state = "[initial(icon_state)][shot.mod_name][ratio]" - if (2) - icon_state = "[initial(icon_state)][shot.select_name][ratio]" overlays.Cut() + var/ratio = Ceiling((power_supply.charge / power_supply.maxcharge) * 4) + var/obj/item/ammo_casing/energy/shot = ammo_type[select] + var/iconState = "[icon_state]_charge" + var/itemState = null + if(!initial(item_state)) + itemState = icon_state + if (modifystate) + overlays += "[icon_state]_[shot.select_name]" + iconState += "_[shot.select_name]" + if(itemState) + itemState += "[shot.select_name]" + if(power_supply.charge < shot.e_cost) + overlays += "[icon_state]_empty" + ratio = 0 + for(var/i = ratio, i >= 1, i--) + overlays += image(icon = icon, icon_state = iconState, pixel_x = ammo_x_offset * (i -1)) if(F) + var/iconF = "flight" if(F.on) - overlays += "flight-[initial(icon_state)]-on" - else - overlays += "flight-[initial(icon_state)]" - return + iconF = "flight_on" + overlays += image(icon = icon, icon_state = iconF, pixel_x = flight_x_offset, pixel_y = flight_y_offset) + if(itemState) + itemState += "[ratio]" + item_state = itemState /obj/item/weapon/gun/energy/ui_action_click() toggle_gunlight() diff --git a/code/modules/projectiles/guns/energy/laser.dm b/code/modules/projectiles/guns/energy/laser.dm index b04057fb82b..a3312bbe75e 100644 --- a/code/modules/projectiles/guns/energy/laser.dm +++ b/code/modules/projectiles/guns/energy/laser.dm @@ -7,6 +7,7 @@ materials = list(MAT_METAL=2000) origin_tech = "combat=3;magnets=2" ammo_type = list(/obj/item/ammo_casing/energy/lasergun) + ammo_x_offset = 1 /obj/item/weapon/gun/energy/laser/practice @@ -20,6 +21,7 @@ name ="retro laser" icon_state = "retro" desc = "An older model of the basic lasergun, no longer used by Nanotrasen's private security or military forces. Nevertheless, it is still quite deadly and easy to maintain, making it a favorite amongst pirates and other outlaws." + ammo_x_offset = 3 /obj/item/weapon/gun/energy/laser/captain @@ -29,6 +31,7 @@ force = 10 origin_tech = null var/charge_tick = 0 + ammo_x_offset = 3 /obj/item/weapon/gun/energy/laser/captain/New() ..() @@ -87,6 +90,7 @@ origin_tech = "combat=4;materials=3;powerstorage=3" ammo_type = list(/obj/item/ammo_casing/energy/laser/heavy) pin = null + ammo_x_offset = 3 /obj/item/weapon/gun/energy/xray name = "xray laser gun" @@ -96,6 +100,7 @@ origin_tech = "combat=5;materials=3;magnets=2;syndicate=2" ammo_type = list(/obj/item/ammo_casing/energy/xray) pin = null + ammo_x_offset = 3 ////////Laser Tag//////////////////// @@ -109,6 +114,7 @@ needs_permit = 0 var/charge_tick = 0 pin = /obj/item/device/firing_pin/tag/blue + ammo_x_offset = 2 /obj/item/weapon/gun/energy/laser/bluetag/New() ..() @@ -140,6 +146,7 @@ needs_permit = 0 var/charge_tick = 0 pin = /obj/item/device/firing_pin/tag/red + ammo_x_offset = 2 /obj/item/weapon/gun/energy/laser/redtag/New() ..() diff --git a/code/modules/projectiles/guns/energy/nuclear.dm b/code/modules/projectiles/guns/energy/nuclear.dm index 90e201e2a61..e11357de9a7 100644 --- a/code/modules/projectiles/guns/energy/nuclear.dm +++ b/code/modules/projectiles/guns/energy/nuclear.dm @@ -7,6 +7,9 @@ origin_tech = "combat=3;magnets=2" modifystate = 2 can_flashlight = 1 + ammo_x_offset = 3 + flight_x_offset = 15 + flight_y_offset = 10 /obj/item/weapon/gun/energy/gun/attack_self(mob/living/user) select_fire(user) @@ -15,7 +18,6 @@ /obj/item/weapon/gun/energy/gun/hos desc = "This is a expensive, modern recreation of a antique laser gun. This gun has several unique firemodes, but lacks the ability to recharge over time." icon_state = "hoslaser" - item_state = null force = 10 ammo_type = list(/obj/item/ammo_casing/energy/electrode/hos, /obj/item/ammo_casing/energy/laser/hos, /obj/item/ammo_casing/energy/disabler) @@ -23,22 +25,36 @@ name = "DRAGnet" desc = "The \"Dynamic Rapid-Apprehension of the Guilty\" net is a revolution in law enforcement technology." icon_state = "dragnet" - item_state = null origin_tech = "combat=3;magnets=3;materials=4; bluespace=4" ammo_type = list(/obj/item/ammo_casing/energy/net, /obj/item/ammo_casing/energy/trap) can_flashlight = 0 + ammo_x_offset = 1 + +/obj/item/weapon/gun/energy/gun/turret + name = "hybrid turret gun" + desc = "A heavy hybrid energy cannon with two settings: Stun and kill." + icon_state = "turretlaser" + item_state = "turretlaser" + slot_flags = null + w_class = 5 + ammo_type = list(/obj/item/ammo_casing/energy/electrode, /obj/item/ammo_casing/energy/laser) + heavy_weapon = 1 + can_flashlight = 0 + trigger_guard = 0 + ammo_x_offset = 2 /obj/item/weapon/gun/energy/gun/nuclear name = "advanced energy gun" desc = "An energy gun with an experimental miniaturized nuclear reactor that automatically charges the internal power cell." icon_state = "nucgun" + item_state = "nucgun" origin_tech = "combat=3;materials=5;powerstorage=3" - var/lightfail = 0 + var/fail_state = 0 var/charge_tick = 0 - modifystate = 0 can_flashlight = 0 pin = null can_charge = 0 + ammo_x_offset = 1 /obj/item/weapon/gun/energy/gun/nuclear/New() ..() @@ -63,7 +79,7 @@ /obj/item/weapon/gun/energy/gun/nuclear/proc/failcheck() - lightfail = 0 + fail_state = 0 if (prob(src.reliability)) return 1 //No failure if (prob(src.reliability)) for (var/mob/living/M in range(0,src)) //Only a minor failure, enjoy your radiation if you're in the same tile or carrying it @@ -72,68 +88,22 @@ else M << "You feel a warm sensation." M.irradiate(rand(3,120)) - lightfail = 1 + fail_state = 1 else for (var/mob/living/M in range(rand(1,4),src)) //Big failure, TIME FOR RADIATION BITCHES if (src in M.contents) M << "Your gun's reactor overloads!" M << "You feel a wave of heat wash over you." M.irradiate(300) - crit_fail = 1 //break the gun so it stops recharging + fail_state = 2 //break the gun so it stops recharging SSobj.processing.Remove(src) update_icon() return 0 - -/obj/item/weapon/gun/energy/gun/nuclear/proc/update_charge() - if (crit_fail) - overlays += "nucgun-whee" - return - var/ratio = power_supply.charge / power_supply.maxcharge - ratio = Ceiling(ratio*4) * 25 - overlays += "nucgun-[ratio]" - - -/obj/item/weapon/gun/energy/gun/nuclear/proc/update_reactor() - if(crit_fail) - overlays += "nucgun-crit" - return - 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() - if (select == 1) - overlays += "nucgun-stun" - else if (select == 2) - overlays += "nucgun-kill" - - /obj/item/weapon/gun/energy/gun/nuclear/emp_act(severity) ..() reliability -= round(15/severity) - /obj/item/weapon/gun/energy/gun/nuclear/update_icon() - overlays.Cut() - update_charge() - update_reactor() - update_mode() - -/obj/item/weapon/gun/energy/gun/turret - name = "hybrid turret gun" - desc = "A heavy hybrid energy cannon with two settings: Stun and kill." - icon_state = "turretlaser" - slot_flags = null - w_class = 5 - ammo_type = list(/obj/item/ammo_casing/energy/electrode, /obj/item/ammo_casing/energy/laser) - heavy_weapon = 1 - can_flashlight = 0 - trigger_guard = 0 - -/obj/item/weapon/gun/energy/gun/turret/update_icon() - icon_state = initial(icon_state) \ No newline at end of file + ..() + overlays += "[icon_state]_fail_[fail_state]" diff --git a/code/modules/projectiles/guns/energy/pulse.dm b/code/modules/projectiles/guns/energy/pulse.dm index 734b408bfba..18706908c93 100644 --- a/code/modules/projectiles/guns/energy/pulse.dm +++ b/code/modules/projectiles/guns/energy/pulse.dm @@ -28,6 +28,8 @@ item_state = "pulse" cell_type = "/obj/item/weapon/stock_parts/cell/pulse/carbine" can_flashlight = 1 + flight_x_offset = 18 + flight_y_offset = 12 /obj/item/weapon/gun/energy/pulse/carbine/loyalpin pin = /obj/item/device/firing_pin/implant/loyalty diff --git a/code/modules/projectiles/guns/energy/special.dm b/code/modules/projectiles/guns/energy/special.dm index 78d77697bab..45e936f8867 100644 --- a/code/modules/projectiles/guns/energy/special.dm +++ b/code/modules/projectiles/guns/energy/special.dm @@ -9,7 +9,9 @@ flags = CONDUCT slot_flags = SLOT_BACK ammo_type = list(/obj/item/ammo_casing/energy/ion) - + ammo_x_offset = 3 + flight_x_offset = 17 + flight_y_offset = 9 /obj/item/weapon/gun/energy/ionrifle/emp_act(severity) return @@ -18,11 +20,13 @@ name = "ion carbine" desc = "The MK.II Prototype Ion Projector is a lightweight carbine version of the larger ion rifle, built to be ergonomic and efficient." icon_state = "ioncarbine" - item_state = "ioncarbine" origin_tech = "combat=4;magnets=4;materials=4" w_class = 3 slot_flags = SLOT_BELT pin = null + ammo_x_offset = 2 + flight_x_offset = 18 + flight_y_offset = 11 /obj/item/weapon/gun/energy/decloner name = "biological demolecularisor" @@ -31,6 +35,13 @@ origin_tech = "combat=5;materials=4;powerstorage=3" ammo_type = list(/obj/item/ammo_casing/energy/declone) pin = null + ammo_x_offset = 1 + +/obj/item/weapon/gun/energy/decloner/update_icon() + ..() + var/obj/item/ammo_casing/energy/shot = ammo_type[select] + if(power_supply.charge > shot.e_cost) + overlays += "decloner_spin" /obj/item/weapon/gun/energy/floragun name = "floral somatoray" @@ -41,7 +52,6 @@ origin_tech = "materials=2;biotech=3;powerstorage=3" modifystate = 1 var/charge_tick = 0 - var/mode = 0 //0 = mutate, 1 = yield boost /obj/item/weapon/gun/energy/floragun/New() ..() @@ -115,6 +125,7 @@ desc = "A prototype weapon recovered from the ruins of Research-Station Epsilon." icon_state = "xray" ammo_type = list(/obj/item/ammo_casing/energy/mindflayer) + ammo_x_offset = 2 /obj/item/weapon/gun/energy/kinetic_accelerator name = "proto-kinetic accelerator" @@ -151,6 +162,13 @@ update_icon() return +/obj/item/weapon/gun/energy/kinetic_accelerator/update_icon() + var/obj/item/ammo_casing/energy/shot = ammo_type[select] + if(power_supply.charge < shot.e_cost) + icon_state = "[initial(icon_state)]_empty" + else + icon_state = initial(icon_state) + /obj/item/weapon/gun/energy/kinetic_accelerator/crossbow name = "mini energy crossbow" desc = "A weapon favored by syndicate stealth specialists." @@ -205,51 +223,15 @@ else ..() +/obj/item/weapon/gun/energy/plasmacutter/update_icon() + return + /obj/item/weapon/gun/energy/plasmacutter/adv name = "advanced plasma cutter" icon_state = "adv_plasmacutter" origin_tech = "combat=3;materials=4;magnets=3;plasmatech=3;engineering=2" ammo_type = list(/obj/item/ammo_casing/energy/plasma/adv) -/obj/item/weapon/gun/energy/disabler - name = "disabler" - desc = "A self-defense weapon that exhausts organic targets, weakening them until they collapse." - icon_state = "disabler" - item_state = null - ammo_type = list(/obj/item/ammo_casing/energy/disabler) - -/obj/item/weapon/gun/energy/disabler/cyborg - name = "cyborg disabler" - desc = "An integrated disabler that draws from a cyborg's power cell. This weapon contains a limiter to prevent the cyborg's power cell from overheating." - var/charge_tick = 0 - var/recharge_time = 2.5 - can_charge = 0 - -/obj/item/weapon/gun/energy/disabler/cyborg/New() - ..() - SSobj.processing |= src - - -/obj/item/weapon/gun/energy/disabler/cyborg/Destroy() - SSobj.processing.Remove(src) - ..() - -/obj/item/weapon/gun/energy/disabler/cyborg/process() //Every [recharge_time] ticks, recharge a shot for the cyborg - charge_tick++ - if(charge_tick < recharge_time) return 0 - charge_tick = 0 - - if(!power_supply) return 0 //sanity - if(isrobot(src.loc)) - var/mob/living/silicon/robot/R = src.loc - if(R && R.cell) - var/obj/item/ammo_casing/energy/shot = ammo_type[select] //Necessary to find cost of shot - if(R.cell.use(shot.e_cost)) //Take power from the borg... - power_supply.give(shot.e_cost) //... to recharge the shot - - update_icon() - return 1 - /obj/item/weapon/gun/energy/wormhole_projector name = "bluespace wormhole projector" desc = "A projector that emits high density quantum-coupled bluespace beams." @@ -261,6 +243,7 @@ /obj/item/weapon/gun/energy/wormhole_projector/update_icon() icon_state = "[initial(icon_state)][select]" + item_state = icon_state return /obj/item/weapon/gun/energy/wormhole_projector/attack_self(mob/living/user) @@ -333,3 +316,17 @@ power_supply.give(shot.e_cost) //...to recharge the shot return 1 + +/obj/item/weapon/gun/energy/temperature + name = "temperature gun" + icon_state = "freezegun" + desc = "A gun that changes temperatures." + origin_tech = "combat=3;materials=4;powerstorage=3;magnets=2" + ammo_type = list(/obj/item/ammo_casing/energy/temp, /obj/item/ammo_casing/energy/temp/hot) + cell_type = "/obj/item/weapon/stock_parts/cell/high" + pin = null + +/obj/item/weapon/gun/energy/temperature/attack_self(mob/living/user) + select_fire(user) + update_icon() + return diff --git a/code/modules/projectiles/guns/energy/stun.dm b/code/modules/projectiles/guns/energy/stun.dm index 413dff9ad14..6659fe329cd 100644 --- a/code/modules/projectiles/guns/energy/stun.dm +++ b/code/modules/projectiles/guns/energy/stun.dm @@ -1,18 +1,20 @@ - /obj/item/weapon/gun/energy/taser name = "taser gun" desc = "A low-capacity, energy-based stun gun used by security teams to subdue targets at range." icon_state = "taser" item_state = null //so the human update icon uses the icon_state instead. ammo_type = list(/obj/item/ammo_casing/energy/electrode) + ammo_x_offset = 3 /obj/item/weapon/gun/energy/stunrevolver name = "stun revolver" desc = "A high-tech revolver that fires internal, reusable taser cartridges in a revolving cylinder. The cartridges can be recharged using conventional rechargers." icon_state = "stunrevolver" + item_state = "gun" ammo_type = list(/obj/item/ammo_casing/energy/electrode/gun) can_flashlight = 0 pin = null + ammo_x_offset = 1 /obj/item/weapon/gun/energy/gun/advtaser name = "hybrid taser" @@ -20,6 +22,7 @@ icon_state = "advtaser" ammo_type = list(/obj/item/ammo_casing/energy/electrode, /obj/item/ammo_casing/energy/disabler) origin_tech = null + ammo_x_offset = 2 /obj/item/weapon/gun/energy/gun/advtaser/cyborg name = "cyborg taser" @@ -52,3 +55,43 @@ update_icon() return 1 + +/obj/item/weapon/gun/energy/disabler + name = "disabler" + desc = "A self-defense weapon that exhausts organic targets, weakening them until they collapse." + icon_state = "disabler" + item_state = null + ammo_type = list(/obj/item/ammo_casing/energy/disabler) + ammo_x_offset = 3 + +/obj/item/weapon/gun/energy/disabler/cyborg + name = "cyborg disabler" + desc = "An integrated disabler that draws from a cyborg's power cell. This weapon contains a limiter to prevent the cyborg's power cell from overheating." + var/charge_tick = 0 + var/recharge_time = 2.5 + can_charge = 0 + +/obj/item/weapon/gun/energy/disabler/cyborg/New() + ..() + SSobj.processing |= src + + +/obj/item/weapon/gun/energy/disabler/cyborg/Destroy() + SSobj.processing.Remove(src) + ..() + +/obj/item/weapon/gun/energy/disabler/cyborg/process() //Every [recharge_time] ticks, recharge a shot for the cyborg + charge_tick++ + if(charge_tick < recharge_time) return 0 + charge_tick = 0 + + if(!power_supply) return 0 //sanity + if(isrobot(src.loc)) + var/mob/living/silicon/robot/R = src.loc + if(R && R.cell) + var/obj/item/ammo_casing/energy/shot = ammo_type[select] //Necessary to find cost of shot + if(R.cell.use(shot.e_cost)) //Take power from the borg... + power_supply.give(shot.e_cost) //... to recharge the shot + + update_icon() + return 1 \ No newline at end of file diff --git a/code/modules/projectiles/guns/energy/temperature.dm b/code/modules/projectiles/guns/energy/temperature.dm deleted file mode 100644 index cdf7625e393..00000000000 --- a/code/modules/projectiles/guns/energy/temperature.dm +++ /dev/null @@ -1,14 +0,0 @@ -/obj/item/weapon/gun/energy/temperature - name = "temperature gun" - icon_state = "freezegun" - desc = "A gun that changes temperatures." - origin_tech = "combat=3;materials=4;powerstorage=3;magnets=2" - ammo_type = list(/obj/item/ammo_casing/energy/temp, /obj/item/ammo_casing/energy/temp/hot) - cell_type = "/obj/item/weapon/stock_parts/cell/high" - pin = null - - -/obj/item/weapon/gun/energy/temperature/attack_self(mob/living/user) - select_fire(user) - update_icon() - return \ No newline at end of file diff --git a/icons/mob/inhands/guns_lefthand.dmi b/icons/mob/inhands/guns_lefthand.dmi index 062adfa003d..2bef3ec79b4 100644 Binary files a/icons/mob/inhands/guns_lefthand.dmi and b/icons/mob/inhands/guns_lefthand.dmi differ diff --git a/icons/mob/inhands/guns_righthand.dmi b/icons/mob/inhands/guns_righthand.dmi index 09a3bc50d40..9d72ffd4f4e 100644 Binary files a/icons/mob/inhands/guns_righthand.dmi and b/icons/mob/inhands/guns_righthand.dmi differ diff --git a/icons/obj/guns/energy.dmi b/icons/obj/guns/energy.dmi index 09fa557ac1a..f225be2dcf2 100644 Binary files a/icons/obj/guns/energy.dmi and b/icons/obj/guns/energy.dmi differ diff --git a/tgstation.dme b/tgstation.dme index 9ba46bdf084..12a7b87c0ee 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -1381,7 +1381,6 @@ #include "code\modules\projectiles\guns\energy\pulse.dm" #include "code\modules\projectiles\guns\energy\special.dm" #include "code\modules\projectiles\guns\energy\stun.dm" -#include "code\modules\projectiles\guns\energy\temperature.dm" #include "code\modules\projectiles\guns\magic\staff.dm" #include "code\modules\projectiles\guns\magic\wand.dm" #include "code\modules\projectiles\guns\projectile\automatic.dm"