Removing priority overlays, update_icon() splitup for guns.

This commit is contained in:
Ghommie
2020-08-20 18:33:23 +02:00
parent 20648fc1bb
commit fde859bca0
36 changed files with 295 additions and 303 deletions

View File

@@ -62,7 +62,8 @@
var/no_pin_required = FALSE //whether the gun can be fired without a pin
var/obj/item/flashlight/gun_light
var/can_flashlight = 0
var/can_flashlight = FALSE
var/gunlight_state = "flight"
var/obj/item/kitchen/knife/bayonet
var/mutable_appearance/knife_overlay
var/can_bayonet = FALSE
@@ -417,14 +418,7 @@
return
to_chat(user, "<span class='notice'>You attach \the [K] to the front of \the [src].</span>")
bayonet = K
var/state = "bayonet" //Generic state.
if(bayonet.icon_state in icon_states('icons/obj/guns/bayonets.dmi')) //Snowflake state?
state = bayonet.icon_state
var/icon/bayonet_icons = 'icons/obj/guns/bayonets.dmi'
knife_overlay = mutable_appearance(bayonet_icons, state)
knife_overlay.pixel_x = knife_x_offset
knife_overlay.pixel_y = knife_y_offset
add_overlay(knife_overlay, TRUE)
update_icon()
else if(istype(I, /obj/item/screwdriver))
if(gun_light)
var/obj/item/flashlight/seclite/S = gun_light
@@ -439,8 +433,7 @@
var/obj/item/kitchen/knife/K = bayonet
K.forceMove(get_turf(user))
bayonet = null
cut_overlay(knife_overlay, TRUE)
knife_overlay = null
update_icon()
else
return ..()
@@ -468,22 +461,35 @@
set_light(gun_light.brightness_on, gun_light.flashlight_power, gun_light.light_color)
else
set_light(0)
cut_overlays(flashlight_overlay, TRUE)
var/state = "flight[gun_light.on? "_on":""]" //Generic state.
else
set_light(0)
update_icon()
for(var/X in actions)
var/datum/action/A = X
A.UpdateButtonIcon()
/obj/item/gun/update_overlays()
. = ..()
if(gun_light)
var/mutable_appearance/flashlight_overlay
var/state = "[gunlight_state][gun_light.on? "_on":""]" //Generic state.
if(gun_light.icon_state in icon_states('icons/obj/guns/flashlights.dmi')) //Snowflake state?
state = gun_light.icon_state
flashlight_overlay = mutable_appearance('icons/obj/guns/flashlights.dmi', state)
flashlight_overlay.pixel_x = flight_x_offset
flashlight_overlay.pixel_y = flight_y_offset
add_overlay(flashlight_overlay, TRUE)
else
set_light(0)
cut_overlays(flashlight_overlay, TRUE)
flashlight_overlay = null
update_icon(TRUE)
for(var/X in actions)
var/datum/action/A = X
A.UpdateButtonIcon()
. += flashlight_overlay
if(bayonet)
var/mutable_appearance/knife_overlay
var/state = "bayonet" //Generic state.
if(bayonet.icon_state in icon_states('icons/obj/guns/bayonets.dmi')) //Snowflake state?
state = bayonet.icon_state
var/icon/bayonet_icons = 'icons/obj/guns/bayonets.dmi'
knife_overlay = mutable_appearance(bayonet_icons, state)
knife_overlay.pixel_x = knife_x_offset
knife_overlay.pixel_y = knife_y_offset
. += knife_overlay
/obj/item/gun/item_action_slot_check(slot, mob/user, datum/action/A)
if(istype(A, /datum/action/item_action/toggle_scope_zoom) && slot != SLOT_HANDS)

View File

@@ -18,13 +18,15 @@
/obj/item/gun/ballistic/automatic/proto/unrestricted
pin = /obj/item/firing_pin
/obj/item/gun/ballistic/automatic/update_icon()
..()
/obj/item/gun/ballistic/automatic/update_overlays()
. = ..()
if(automatic_burst_overlay)
if(!select)
add_overlay("[initial(icon_state)]semi")
. += ("[initial(icon_state)]semi")
if(select == 1)
add_overlay("[initial(icon_state)]burst")
. += "[initial(icon_state)]burst"
/obj/item/gun/ballistic/automatic/update_icon_state()
icon_state = "[initial(icon_state)][magazine ? "-[magazine.max_ammo]" : ""][chambered ? "" : "-e"][suppressed ? "-suppressed" : ""]"
/obj/item/gun/ballistic/automatic/attackby(obj/item/A, mob/user, params)
@@ -115,8 +117,7 @@
. = ..()
empty_alarm()
/obj/item/gun/ballistic/automatic/c20r/update_icon()
..()
/obj/item/gun/ballistic/automatic/c20r/update_icon_state()
icon_state = "c20r[magazine ? "-[CEILING(get_ammo(0)/4, 1)*4]" : ""][chambered ? "" : "-e"][suppressed ? "-suppressed" : ""]"
/obj/item/gun/ballistic/automatic/wt550
@@ -141,9 +142,8 @@
. = ..()
spread = 0
/obj/item/gun/ballistic/automatic/wt550/update_icon()
..()
icon_state = "wt550[magazine ? "-[CEILING(( (get_ammo(FALSE) / magazine.max_ammo) * 20) /4, 1)*4]" : "-0"]" //Sprites only support up to 20.
/obj/item/gun/ballistic/automatic/wt550/update_icon_state()
icon_state = "wt550[magazine ? "-[CEILING(((get_ammo(FALSE) / magazine.max_ammo) * 20) /4, 1)*4]" : "-0"]" //Sprites only support up to 20.
/obj/item/gun/ballistic/automatic/mini_uzi
name = "\improper Type U3 Uzi"
@@ -160,6 +160,7 @@
mag_type = /obj/item/ammo_box/magazine/m556
fire_sound = 'sound/weapons/gunshot_smg.ogg'
can_suppress = FALSE
automatic_burst_overlay = FALSE
var/obj/item/gun/ballistic/revolver/grenadelauncher/underbarrel
burst_size = 3
burst_shot_delay = 2
@@ -191,18 +192,19 @@
underbarrel.attackby(A, user, params)
else
..()
/obj/item/gun/ballistic/automatic/m90/update_icon()
..()
cut_overlays()
/obj/item/gun/ballistic/automatic/m90/update_overlays()
. = ..()
switch(select)
if(0)
add_overlay("[initial(icon_state)]semi")
. += "[initial(icon_state)]semi"
if(1)
add_overlay("[initial(icon_state)]burst")
. += "[initial(icon_state)]burst"
if(2)
add_overlay("[initial(icon_state)]gren")
. += "[initial(icon_state)]gren"
/obj/item/gun/ballistic/automatic/m90/update_icon_state()
icon_state = "[initial(icon_state)][magazine ? "" : "-e"]"
return
/obj/item/gun/ballistic/automatic/m90/burst_select()
var/mob/living/carbon/human/user = usr
switch(select)
@@ -257,6 +259,7 @@
weapon_weight = WEAPON_MEDIUM
mag_type = /obj/item/ammo_box/magazine/m12g
fire_sound = 'sound/weapons/gunshot.ogg'
automatic_burst_overlay = FALSE
can_suppress = FALSE
burst_size = 1
pin = /obj/item/firing_pin/implant/pindicate
@@ -269,10 +272,13 @@
. = ..()
update_icon()
/obj/item/gun/ballistic/automatic/shotgun/bulldog/update_icon()
cut_overlays()
/obj/item/gun/ballistic/automatic/shotgun/bulldog/update_icon_state()
return
/obj/item/gun/ballistic/automatic/shotgun/bulldog/update_overlays()
. = ..()
if(magazine)
add_overlay("[magazine.icon_state]")
. += "[magazine.icon_state]"
icon_state = "bulldog[chambered ? "" : "-e"]"
/obj/item/gun/ballistic/automatic/shotgun/bulldog/afterattack()
@@ -298,6 +304,7 @@
burst_shot_delay = 1
spread = 7
pin = /obj/item/firing_pin/implant/pindicate
automatic_burst_overlay = FALSE
/obj/item/gun/ballistic/automatic/l6_saw/unrestricted
pin = /obj/item/firing_pin
@@ -316,7 +323,7 @@
playsound(user, 'sound/weapons/sawclose.ogg', 60, 1)
update_icon()
/obj/item/gun/ballistic/automatic/l6_saw/update_icon()
/obj/item/gun/ballistic/automatic/l6_saw/update_icon_state()
icon_state = "l6[cover_open ? "open" : "closed"][magazine ? CEILING(get_ammo(0)/12.5, 1)*25 : "-empty"][suppressed ? "-suppressed" : ""]"
item_state = "l6[cover_open ? "openmag" : "closedmag"]"
@@ -369,9 +376,10 @@
zoom_amt = 10 //Long range, enough to see in front of you, but no tiles behind you.
zoom_out_amt = 13
slot_flags = ITEM_SLOT_BACK
automatic_burst_overlay = FALSE
actions_types = list()
/obj/item/gun/ballistic/automatic/sniper_rifle/update_icon()
/obj/item/gun/ballistic/automatic/sniper_rifle/update_icon_state()
if(magazine)
icon_state = "sniper-mag"
else
@@ -397,9 +405,10 @@
can_suppress = TRUE
w_class = WEIGHT_CLASS_HUGE
slot_flags = ITEM_SLOT_BACK
automatic_burst_overlay = FALSE
actions_types = list()
/obj/item/gun/ballistic/automatic/surplus/update_icon()
/obj/item/gun/ballistic/automatic/surplus/update_icon_state()
if(magazine)
icon_state = "surplus"
else
@@ -413,6 +422,7 @@
icon_state = "oldrifle"
item_state = "arg"
mag_type = /obj/item/ammo_box/magazine/recharge
automatic_burst_overlay = FALSE
fire_delay = 2
can_suppress = FALSE
burst_size = 1
@@ -420,7 +430,5 @@
fire_sound = 'sound/weapons/laser.ogg'
casing_ejector = FALSE
/obj/item/gun/ballistic/automatic/laser/update_icon()
..()
/obj/item/gun/ballistic/automatic/laser/update_icon_state()
icon_state = "oldrifle[magazine ? "-[CEILING(get_ammo(0)/4, 1)*4]" : ""]"
return

View File

@@ -42,8 +42,7 @@
actions_types = list()
casing_ejector = FALSE
/obj/item/gun/ballistic/automatic/gyropistol/update_icon()
..()
/obj/item/gun/ballistic/automatic/gyropistol/update_icon_state()
icon_state = "[initial(icon_state)][magazine ? "loaded" : ""]"
/obj/item/gun/ballistic/automatic/speargun
@@ -54,6 +53,7 @@
w_class = WEIGHT_CLASS_BULKY
force = 10
can_suppress = FALSE
automatic_burst_overlay = FALSE
mag_type = /obj/item/ammo_box/magazine/internal/speargun
fire_sound = 'sound/weapons/grenadelaunch.ogg'
burst_size = 1
@@ -62,8 +62,9 @@
actions_types = list()
casing_ejector = FALSE
/obj/item/gun/ballistic/automatic/speargun/update_icon()
return
/obj/item/gun/ballistic/automatic/speargun/ComponentInitialize()
. = ..()
AddElement(/datum/element/update_icon_blocker)
/obj/item/gun/ballistic/automatic/speargun/attack_self()
return
@@ -137,7 +138,7 @@
chamber_round()
update_icon()
/obj/item/gun/ballistic/rocketlauncher/update_icon()
/obj/item/gun/ballistic/rocketlauncher/update_icon_state()
icon_state = "[initial(icon_state)]-[chambered ? "1" : "0"]"
/obj/item/gun/ballistic/rocketlauncher/suicide_act(mob/living/user)

View File

@@ -75,8 +75,7 @@
recoil = 2
weapon_weight = WEAPON_HEAVY
/obj/item/gun/ballistic/automatic/magrifle/hyperburst/update_icon()
..()
/obj/item/gun/ballistic/automatic/magrifle/hyperburst/update_icon_state()
icon_state = "hyperburst[magazine ? "-[get_ammo()]" : ""][chambered ? "" : "-e"]"
///magpistol///
@@ -92,12 +91,14 @@
fire_delay = 2
inaccuracy_modifier = 0.25
cell_type = /obj/item/stock_parts/cell/magnetic/pistol
automatic_burst_overlay = FALSE
/obj/item/gun/ballistic/automatic/magrifle/pistol/update_icon()
..()
cut_overlays()
/obj/item/gun/ballistic/automatic/magrifle/pistol/update_overlays()
. = ..()
if(magazine)
add_overlay("magpistol-magazine")
. += "magpistol-magazine"
/obj/item/gun/ballistic/automatic/magrifle/pistol/update_icon_state()
icon_state = "[initial(icon_state)][chambered ? "" : "-e"]"
/obj/item/gun/ballistic/automatic/magrifle/pistol/nopin

View File

@@ -8,12 +8,12 @@
burst_size = 1
fire_delay = 0
actions_types = list()
automatic_burst_overlay = FALSE
/obj/item/gun/ballistic/automatic/pistol/no_mag
spawnwithmagazine = FALSE
/obj/item/gun/ballistic/automatic/pistol/update_icon()
..()
/obj/item/gun/ballistic/automatic/pistol/update_icon_state()
icon_state = "[initial(icon_state)][chambered ? "" : "-e"][suppressed ? "-suppressed" : ""]"
/obj/item/gun/ballistic/automatic/pistol/suppressed/Initialize(mapload)
@@ -28,6 +28,7 @@
icon = 'modular_citadel/icons/obj/guns/cit_guns.dmi'
icon_state = "cde"
can_unsuppress = TRUE
automatic_burst_overlay = FALSE
obj_flags = UNIQUE_RENAME
unique_reskin = list("Default" = "cde",
"N-99" = "n99",
@@ -38,20 +39,18 @@
"PX4 Storm" = "px4"
)
/obj/item/gun/ballistic/automatic/pistol/modular/update_icon()
..()
/obj/item/gun/ballistic/automatic/pistol/modular/update_icon_state()
if(current_skin)
icon_state = "[unique_reskin[current_skin]][chambered ? "" : "-e"][suppressed ? "-suppressed" : ""]"
else
icon_state = "[initial(icon_state)][chambered ? "" : "-e"][suppressed ? "-suppressed" : ""]"
/obj/item/gun/ballistic/automatic/pistol/modular/update_overlays()
. = ..()
if(magazine && suppressed)
cut_overlays()
add_overlay("[unique_reskin[current_skin]]-magazine-sup") //Yes, this means the default iconstate can't have a magazine overlay
. += "[unique_reskin[current_skin]]-magazine-sup" //Yes, this means the default iconstate can't have a magazine overlay
else if (magazine)
cut_overlays()
add_overlay("[unique_reskin[current_skin]]-magazine")
else
cut_overlays()
. += "[unique_reskin[current_skin]]-magazine"
/obj/item/gun/ballistic/automatic/pistol/m1911
name = "\improper M1911"
@@ -77,14 +76,14 @@
force = 14
mag_type = /obj/item/ammo_box/magazine/m50
can_suppress = FALSE
automatic_burst_overlay = FALSE
/obj/item/gun/ballistic/automatic/pistol/deagle/update_icon()
..()
/obj/item/gun/ballistic/automatic/pistol/deagle/update_overlays()
. = ..()
if(magazine)
cut_overlays()
add_overlay("deagle_magazine")
else
cut_overlays()
. += "deagle_magazine"
/obj/item/gun/ballistic/automatic/pistol/deagle/update_icon_state()
icon_state = "[initial(icon_state)][chambered ? "" : "-e"]"
/obj/item/gun/ballistic/automatic/pistol/deagle/gold
@@ -142,14 +141,14 @@
actions_types = list()
fire_sound = 'sound/weapons/blastcannon.ogg'
spread = 20 //damn thing has no rifling.
automatic_burst_overlay = FALSE
/obj/item/gun/ballistic/automatic/pistol/antitank/update_icon()
..()
/obj/item/gun/ballistic/automatic/pistol/antitank/update_overlays()
. = ..()
if(magazine)
cut_overlays()
add_overlay("atp-mag")
else
cut_overlays()
. += "atp-mag"
/obj/item/gun/ballistic/automatic/pistol/antitank/update_icon_state()
icon_state = "[initial(icon_state)][chambered ? "" : "-e"]"
/obj/item/gun/ballistic/automatic/pistol/antitank/syndicate

View File

@@ -348,10 +348,10 @@
else
to_chat(user, "<span class='warning'>You need at least ten lengths of cable if you want to make a sling!</span>")
/obj/item/gun/ballistic/revolver/doublebarrel/improvised/update_icon()
..()
/obj/item/gun/ballistic/revolver/doublebarrel/improvised/update_overlays()
. = ..()
if(slung)
icon_state += "sling"
. += "[icon_state]sling"
/obj/item/gun/ballistic/revolver/doublebarrel/improvised/sawoff(mob/user)
. = ..()

View File

@@ -164,10 +164,10 @@
else
to_chat(user, "<span class='warning'>You need at least ten lengths of cable if you want to make a sling!</span>")
/obj/item/gun/ballistic/shotgun/boltaction/improvised/update_icon()
..()
/obj/item/gun/ballistic/shotgun/boltaction/improvised/update_overlays()
. = ..()
if(slung)
icon_state += "sling"
. += "[icon_state]sling"
/obj/item/gun/ballistic/shotgun/boltaction/enchanted
name = "enchanted bolt action rifle"
@@ -272,7 +272,7 @@
spread = 2
update_icon()
/obj/item/gun/ballistic/shotgun/automatic/combat/compact/update_icon()
/obj/item/gun/ballistic/shotgun/automatic/combat/compact/update_icon_state()
icon_state = "[current_skin ? unique_reskin[current_skin] : "cshotgun"][stock ? "" : "c"]"
//Dual Feed Shotgun

View File

@@ -27,9 +27,9 @@
burst_size = 1
fire_delay = 0
actions_types = list()
automatic_burst_overlay = FALSE
/obj/item/gun/ballistic/automatic/toy/pistol/update_icon()
..()
/obj/item/gun/ballistic/automatic/toy/pistol/update_icon_state()
icon_state = "[initial(icon_state)][chambered ? "" : "-e"][suppressed ? "-suppressed" : ""]"
/obj/item/gun/ballistic/automatic/toy/pistol/riot

View File

@@ -29,7 +29,6 @@
var/charge_sections = 4
ammo_x_offset = 2
var/shaded_charge = FALSE //if this gun uses a stateful charge bar for more detail
var/old_ratio = 0 // stores the gun's previous ammo "ratio" to see if it needs an updated icon
var/selfcharge = EGUN_NO_SELFCHARGE // EGUN_SELFCHARGE if true, EGUN_SELFCHARGE_BORG drains the cyborg's cell to recharge its own
var/charge_tick = 0
var/charge_delay = 4
@@ -64,10 +63,20 @@
START_PROCESSING(SSobj, src)
update_icon()
/obj/item/gun/energy/ComponentInitialize()
. = ..()
AddElement(/datum/element/update_icon_updates_onmob)
/obj/item/gun/energy/Destroy()
STOP_PROCESSING(SSobj, src)
return ..()
/obj/item/gun/energy/handle_atom_del(atom/A)
if(A == cell)
cell = null
update_icon()
return ..()
/obj/item/gun/energy/examine(mob/user)
. = ..()
if(!right_click_overridden)
@@ -226,46 +235,47 @@
#undef DECREMENT_OR_WRAP
#undef IS_VALID_INDEX
/obj/item/gun/energy/update_icon(force_update)
/obj/item/gun/energy/update_icon_state()
if(initial(item_state))
return
..()
var/ratio = get_charge_ratio()
var/new_item_state = ""
new_item_state = initial(icon_state)
if(modifystate)
var/obj/item/ammo_casing/energy/shot = ammo_type[current_firemode_index]
new_item_state += "[shot.select_name]"
new_item_state += "[ratio]"
item_state = new_item_state
/obj/item/gun/energy/update_overlays()
if(QDELETED(src))
return
..()
if(!automatic_charge_overlays)
return
var/ratio = can_shoot() ? CEILING(clamp(cell.charge / cell.maxcharge, 0, 1) * charge_sections, 1) : 0
// Sets the ratio to 0 if the gun doesn't have enough charge to fire, or if it's power cell is removed.
// TG issues #5361 & #47908
if(ratio == old_ratio && !force_update)
return
old_ratio = ratio
cut_overlays()
var/iconState = "[icon_state]_charge"
var/itemState = null
if(!initial(item_state))
itemState = icon_state
var/overlay_icon_state = "[icon_state]_charge"
var/ratio = get_charge_ratio()
if (modifystate)
var/obj/item/ammo_casing/energy/shot = ammo_type[current_firemode_index]
add_overlay("[icon_state]_[shot.select_name]")
iconState += "_[shot.select_name]"
if(itemState)
itemState += "[shot.select_name]"
. += "[icon_state]_[shot.select_name]"
overlay_icon_state += "_[shot.select_name]"
if(ratio == 0)
add_overlay("[icon_state]_empty")
. += "[icon_state]_empty"
else
if(!shaded_charge)
var/mutable_appearance/charge_overlay = mutable_appearance(icon, iconState)
var/mutable_appearance/charge_overlay = mutable_appearance(icon, overlay_icon_state)
for(var/i = ratio, i >= 1, i--)
charge_overlay.pixel_x = ammo_x_offset * (i - 1)
charge_overlay.pixel_y = ammo_y_offset * (i - 1)
add_overlay(charge_overlay)
. += charge_overlay
else
add_overlay("[icon_state]_charge[ratio]")
if(itemState)
itemState += "[ratio]"
item_state = itemState
if(ismob(loc)) //forces inhands to update
var/mob/M = loc
M.update_inv_hands()
. += "[icon_state]_charge[ratio]"
///Used by update_icon_state() and update_overlays()
/obj/item/gun/energy/proc/get_charge_ratio()
return can_shoot() ? CEILING(clamp(cell.charge / cell.maxcharge, 0, 1) * charge_sections, 1) : 0
// Sets the ratio to 0 if the gun doesn't have enough charge to fire, or if its power cell is removed.
/obj/item/gun/energy/suicide_act(mob/living/user)
if (istype(user) && can_shoot() && can_trigger_gun(user) && user.get_bodypart(BODY_ZONE_HEAD))

View File

@@ -207,12 +207,11 @@
to_chat(user,"<span class='notice'>You switch [src] setting to [setting] mode.</span>")
update_icon()
/obj/item/gun/energy/dueling/update_icon(force_update)
/obj/item/gun/energy/dueling/update_overlays(force_update)
. = ..()
if(setting_overlay)
cut_overlay(setting_overlay)
setting_overlay.icon_state = setting_iconstate()
add_overlay(setting_overlay)
. += setting_overlay
/obj/item/gun/energy/dueling/Destroy()
if(duel)
@@ -363,8 +362,7 @@
STR.max_items = 2
STR.can_hold = typecacheof(/obj/item/gun/energy/dueling)
/obj/item/storage/lockbox/dueling/update_icon()
cut_overlays()
/obj/item/storage/lockbox/dueling/update_icon_state()
var/locked = SEND_SIGNAL(src, COMSIG_IS_STORAGE_LOCKED)
if(locked)
icon_state = "medalbox+l"

View File

@@ -19,17 +19,13 @@
cell_type = /obj/item/stock_parts/cell{charge = 600; maxcharge = 600}
ammo_x_offset = 2
charge_sections = 3
gunlight_state = "mini-light"
can_flashlight = 0 // Can't attach or detach the flashlight, and override it's icon update
/obj/item/gun/energy/e_gun/mini/Initialize()
gun_light = new /obj/item/flashlight/seclite(src)
return ..()
/obj/item/gun/energy/e_gun/mini/update_icon()
..()
if(gun_light && gun_light.on)
add_overlay("mini-light")
/obj/item/gun/energy/e_gun/stun
name = "tactical energy gun"
desc = "Military issue energy gun, is able to fire stun rounds."
@@ -138,15 +134,15 @@
return
fail_chance = min(fail_chance + round(15/severity), 100)
/obj/item/gun/energy/e_gun/nuclear/update_icon()
..()
/obj/item/gun/energy/e_gun/nuclear/update_overlays()
. = ..()
if(crit_fail)
add_overlay("[icon_state]_fail_3")
. += "[icon_state]_fail_3"
else
switch(fail_tick)
if(0)
add_overlay("[icon_state]_fail_0")
. += "[icon_state]_fail_0"
if(1 to 150)
add_overlay("[icon_state]_fail_1")
. += "[icon_state]_fail_1"
if(151 to INFINITY)
add_overlay("[icon_state]_fail_2")
. += "[icon_state]_fail_2"

View File

@@ -46,13 +46,6 @@
range = 4
log_override = TRUE
/obj/item/gun/energy/kinetic_accelerator/premiumka/update_icon()
..()
if(!can_shoot())
add_overlay("[icon_state]_empty")
else
cut_overlays()
/obj/item/gun/energy/kinetic_accelerator/getinaccuracy(mob/living/user, bonus_spread, stamloss)
var/old_fire_delay = fire_delay //It's pretty irrelevant tbh but whatever.
fire_delay = overheat_time
@@ -187,11 +180,9 @@
overheat = FALSE
/obj/item/gun/energy/kinetic_accelerator/update_icon()
..()
. += ..()
if(!can_shoot())
add_overlay("[icon_state]_empty")
else
cut_overlays()
. += "[icon_state]_empty"
//Casing
/obj/item/ammo_casing/energy/kinetic

View File

@@ -34,11 +34,11 @@
pin = null
ammo_x_offset = 1
/obj/item/gun/energy/decloner/update_icon()
/obj/item/gun/energy/decloner/update_overlays()
..()
var/obj/item/ammo_casing/energy/shot = ammo_type[current_firemode_index]
if(!QDELETED(cell) && (cell.charge > shot.e_cost))
add_overlay("decloner_spin")
. += "decloner_spin"
/obj/item/gun/energy/floragun
name = "floral somatoray"
@@ -134,9 +134,10 @@
tool_behaviour = TOOL_WELDER
toolspeed = 0.7 //plasmacutters can be used as welders, and are faster than standard welders
/obj/item/gun/energy/plasmacutter/Initialize()
/obj/item/gun/energy/plasmacutter/ComponentInitialize()
. = ..()
AddComponent(/datum/component/butchering, 25, 105, 0, 'sound/weapons/plasma_cutter.ogg')
AddElement(/datum/element/update_icon_blocker)
/obj/item/gun/energy/plasmacutter/examine(mob/user)
. = ..()
@@ -166,9 +167,6 @@
/obj/item/gun/energy/plasmacutter/use(amount)
return cell.use(amount * 100)
/obj/item/gun/energy/plasmacutter/update_icon()
return
/obj/item/gun/energy/plasmacutter/adv
name = "advanced plasma cutter"
icon_state = "adv_plasmacutter"
@@ -183,11 +181,12 @@
icon_state = "wormhole_projector"
pin = null
inaccuracy_modifier = 0.25
automatic_charge_overlays = FALSE
var/obj/effect/portal/p_blue
var/obj/effect/portal/p_orange
var/atmos_link = FALSE
/obj/item/gun/energy/wormhole_projector/update_icon()
/obj/item/gun/energy/wormhole_projector/update_icon_state()
icon_state = "[initial(icon_state)][current_firemode_index]"
item_state = icon_state
@@ -256,8 +255,9 @@
can_charge = 0
use_cyborg_cell = 1
/obj/item/gun/energy/printer/update_icon()
return
/obj/item/gun/energy/printer/ComponentInitialize()
. = ..()
AddElement(/datum/element/update_icon_blocker)
/obj/item/gun/energy/printer/emp_act()
return
@@ -321,14 +321,14 @@
inaccuracy_modifier = 0.25
cell_type = /obj/item/stock_parts/cell/super
ammo_type = list(/obj/item/ammo_casing/energy/emitter)
automatic_charge_overlays = FALSE
/obj/item/gun/energy/emitter/update_icon()
..()
/obj/item/gun/energy/emitter/update_icon_state()
var/obj/item/ammo_casing/energy/shot = ammo_type[current_firemode_index]
if(!QDELETED(cell) && (cell.charge > shot.e_cost))
add_overlay("emitter_carbine_empty")
icon_state = "emitter_carbine_empty"
else
add_overlay("emitter_carbine")
icon_state = "emitter_carbine"
//the pickle ray
/obj/item/gun/energy/pickle_gun

View File

@@ -35,6 +35,7 @@
slowdown = 1
item_flags = NO_MAT_REDEMPTION | SLOWS_WHILE_IN_HAND | NEEDS_PERMIT
pin = null
automatic_charge_overlays = FALSE
var/aiming = FALSE
var/aiming_time = 14
var/aiming_time_fire_threshold = 5
@@ -152,13 +153,13 @@
current_zoom_x = 0
current_zoom_y = 0
/obj/item/gun/energy/beam_rifle/update_icon()
cut_overlays()
/obj/item/gun/energy/beam_rifle/update_overlays()
. = ..()
var/obj/item/ammo_casing/energy/primary_ammo = ammo_type[1]
if(!QDELETED(cell) && (cell.charge > primary_ammo.e_cost))
add_overlay(charged_overlay)
. += charged_overlay
else
add_overlay(drained_overlay)
. += drained_overlay
/obj/item/gun/energy/beam_rifle/attack_self(mob/user)
if(!structure_piercing)

View File

@@ -41,18 +41,16 @@
user.put_in_hands(bomb)
user.visible_message("<span class='warning'>[user] detaches [bomb] from [src].</span>")
bomb = null
name = initial(name)
desc = initial(desc)
update_icon()
return ..()
/obj/item/gun/blastcannon/update_icon()
/obj/item/gun/blastcannon/update_icon_state()
if(bomb)
icon_state = icon_state_loaded
name = "blast cannon"
desc = "A makeshift device used to concentrate a bomb's blast energy to a narrow wave."
else
icon_state = initial(icon_state)
name = initial(name)
desc = initial(desc)
/obj/item/gun/blastcannon/attackby(obj/O, mob/user)
if(istype(O, /obj/item/transfer_valve))
@@ -65,6 +63,8 @@
return FALSE
user.visible_message("<span class='warning'>[user] attaches [T] to [src]!</span>")
bomb = T
name = "blast cannon"
desc = "A makeshift device used to concentrate a bomb's blast energy to a narrow wave."
update_icon()
return TRUE
return ..()