Port TG updating appearances (#17943)

* Get pants that match or else you gonna look silly yo

* Posters

* Fix other hud elements

* Rereviewed

* Update shotglass.dm

* Fix for new merged PRs

* Typo

* Coming across other stuff

* Update theblob.dm

* No takebacksies

* smh i forget to leave a comment

* Updated for the detgun and cards

* Should have rerun langserver again

* No longer plastic, more in scope

* Damn you bluespace

* Reverting turret logic, out of scope at this point

* Tweak that part

* Went over energy guns again, and fixed UI White's sprite sheet

* Welding masks, glasses, and JUSTICE

* Update portable_atmospherics.dm

* Cleaning up, clearing things up

* Review and suggestions

* Update valve.dm

* More tweaks

* Missing character

* Not distinct lightmasks, so they can be overlays

* Update generator.dm

* Add parameter so holodeck doesn't try to make a perfect copy

* Update unsorted.dm

* Spiders

* Better fix for spiders, fix vamps too

* Ghosts

* Update telekinesis.dm

* Cleaning up old procs

* It's set up to not copy datums... Unless they're in a list

* Donuts, duct tape, and detgun. D3VR coming to Early Access

* Update procs that interact with doors so they call update_state instead

* Forgot one spot, and actually might as well just force lock

* Cleaning up other things... Sigh, and kitty ears

* oops

* Getting used to how it works

* blinds

* Going back to the suit obscuring thing, so it doesn't update all the time

* Missed that from merging master

* I made this PR and forgot about it

* Fix runtimes in cards

* Make things a bit more unified

* Update update_icons.dm

* yarn, really?

* Update library_equipment.dm

* Update shieldgen.dm

* Every time Charlie merges something, I go back and see if I can improve things further

* what's this? more?

* Update misc_special.dm

* wow, paper

* Review

* More reviews

* To be sure, seems like being broken messed something sometimes

* Brought airlocks closer to how TG works to iron out some stuff

* Pizza and morgue

* Doesn't seem to hurt, tried with holodeck

* Revert "Doesn't seem to hurt, tried with holodeck"

This reverts commit 158529302b.

* Icon conflict

* Fix organ damage

* Don't ask how. Why. It's like that on prod too.

* Cutting down on things and updating from TG.

* More flexible. Just in case the thing you stuck it on didn't destroy.

* Hydro was one the things I touched earlier on, better rework it

* Reviews

* Cleaning up further, also bri'ish

* Undo a change I did, and switch over to a more recent implementation

* Update biogenerator.dm

* Rolling back to old airlocks, but with new duct taped note

* Functionally the same. I'd just rather not have the smoothing happen there

* Went over APCs again

* Fix welding helmet names in species files

* Update airlock.dm

* Update persistent_overlay.dm

* Oh, topic
This commit is contained in:
Vi3trice
2022-07-21 08:11:59 +02:00
committed by GitHub
parent aa06a09f5f
commit f4b37b4177
429 changed files with 3487 additions and 3296 deletions
+17 -12
View File
@@ -35,13 +35,15 @@
pixel_x = rand(-10.0, 10)
pixel_y = rand(-10.0, 10)
dir = pick(GLOB.alldirs)
update_icon()
update_appearance(UPDATE_DESC|UPDATE_ICON_STATE)
/obj/item/ammo_casing/update_icon()
..()
icon_state = "[initial(icon_state)][BB ? "-live" : ""]"
/obj/item/ammo_casing/update_desc()
. = ..()
desc = "[initial(desc)][BB ? "" : " This one is spent."]"
/obj/item/ammo_casing/update_icon_state()
icon_state = "[initial(icon_state)][BB ? "-live" : ""]"
/obj/item/ammo_casing/proc/newshot(params) //For energy weapons, shotgun shells and wands (!).
if(!BB)
BB = new projectile_type(src, params)
@@ -61,7 +63,7 @@
else
continue
if(boolets > 0)
box.update_icon()
box.update_appearance(UPDATE_DESC|UPDATE_ICON_STATE)
to_chat(user, "<span class='notice'>You collect [boolets] shell\s. [box] now contains [length(box.stored_ammo)] shell\s.</span>")
playsound(src, 'sound/weapons/gun_interactions/bulletinsert.ogg', 50, 1)
else
@@ -115,7 +117,7 @@
var/list/stored_ammo = list()
var/ammo_type = /obj/item/ammo_casing
var/max_ammo = 7
var/multi_sprite_step = AMMO_MULTI_SPRITE_STEP_NONE // see update_icon() for details
var/multi_sprite_step = AMMO_MULTI_SPRITE_STEP_NONE // see update_icon_state() for details
var/caliber
var/multiload = 1
var/list/initial_mats //For calculating refund values.
@@ -124,7 +126,7 @@
..()
for(var/i in 1 to max_ammo)
stored_ammo += new ammo_type(src)
update_icon()
update_appearance(UPDATE_DESC|UPDATE_ICON)
/obj/item/ammo_box/Destroy()
QDEL_LIST(stored_ammo)
@@ -142,7 +144,7 @@
if(!initial_mats)
initial_mats = materials.Copy()
update_mat_value()
update_icon()
update_appearance(UPDATE_DESC|UPDATE_ICON_STATE)
return b
/obj/item/ammo_box/proc/give_round(obj/item/ammo_casing/R, replace_spent = 0)
@@ -197,8 +199,8 @@
if(!silent)
to_chat(user, "<span class='notice'>You load [num_loaded] shell\s into \the [src]!</span>")
playsound(src, 'sound/weapons/gun_interactions/shotguninsert.ogg', 50, 1)
A.update_icon()
update_icon()
A.update_appearance(UPDATE_DESC|UPDATE_ICON_STATE)
update_appearance(UPDATE_DESC|UPDATE_ICON_STATE)
return num_loaded
@@ -208,7 +210,7 @@
user.put_in_hands(A)
playsound(src, 'sound/weapons/gun_interactions/remove_bullet.ogg', 50, 1)
to_chat(user, "<span class='notice'>You remove a round from \the [src]!</span>")
update_icon()
update_appearance(UPDATE_DESC|UPDATE_ICON_STATE)
// `multi_sprite_step` governs whether there are different sprites for different degrees of being loaded.
// AMMO_MULTI_SPRITE_STEP_NONE - just a single `icon_state`, no shenanigans
@@ -216,7 +218,7 @@
// (positive integer) - sprites for intermediate degrees of being loaded are present in the .dmi
// and are named `[icon_state]-[ammo_count]`, with `ammo_count` being incremented in steps of `multi_sprite_step`
// ... except the very final full mag sprite with is just `[icon_state]`
/obj/item/ammo_box/update_icon()
/obj/item/ammo_box/update_icon_state()
var/icon_base = initial(icon_state)
switch(multi_sprite_step)
if(AMMO_MULTI_SPRITE_STEP_NONE)
@@ -229,6 +231,9 @@
icon_state = icon_base
else
icon_state = "[icon_base]-[shown_ammo]"
/obj/item/ammo_box/update_desc()
. = ..()
desc = "[initial(desc)] There are [length(stored_ammo)] shell\s left!"
/obj/item/ammo_box/proc/update_mat_value()
@@ -359,11 +359,14 @@
var/modified = 0
harmful = FALSE
/obj/item/ammo_casing/caseless/foam_dart/update_icon()
..()
/obj/item/ammo_casing/caseless/foam_dart/update_desc()
. = ..()
if(modified)
desc = "Its nerf or nothing! ... Although, this one doesn't look too safe."
/obj/item/ammo_casing/caseless/foam_dart/update_icon_state()
if(modified)
icon_state = "foamdart_empty"
desc = "Its nerf or nothing! ... Although, this one doesn't look too safe."
if(BB)
BB.icon_state = "foamdart_empty"
else
@@ -416,11 +419,15 @@
projectile_type = /obj/item/projectile/bullet/reusable/foam_dart/sniper
icon_state = "foamdartsniper"
/obj/item/ammo_casing/caseless/foam_dart/sniper/update_icon()
..()
/obj/item/ammo_casing/caseless/foam_dart/sniper/update_desc()
. = ..()
if(modified)
desc = "Its nerf or nothing! ... Although, this one doesn't look too safe."
/obj/item/ammo_casing/caseless/foam_dart/sniper/update_icon_state()
if(modified)
icon_state = "foamdartsniper_empty"
desc = "Its nerf or nothing! ... Although, this one doesn't look too safe."
if(BB)
BB.icon_state = "foamdartsniper_empty"
else
@@ -228,13 +228,11 @@
multi_sprite_step = 1
caliber = "9mm"
/obj/item/ammo_box/magazine/enforcer/update_icon()
..()
overlays.Cut()
/obj/item/ammo_box/magazine/enforcer/update_overlays()
. = ..()
var/ammo = ammo_count()
if(ammo && is_rubber())
overlays += image('icons/obj/ammo.dmi', icon_state = "enforcer-r")
. += image('icons/obj/ammo.dmi', icon_state = "enforcer-r")
/obj/item/ammo_box/magazine/enforcer/examine(mob/user)
. = ..()
@@ -446,15 +444,13 @@
multi_sprite_step = 1
ammo_type = /obj/item/ammo_casing/caseless/foam_dart/riot
/obj/item/ammo_box/magazine/toy/enforcer/update_icon()
..()
overlays.Cut()
/obj/item/ammo_box/magazine/toy/enforcer/update_overlays()
. = ..()
var/ammo = ammo_count()
if(ammo && is_riot())
overlays += image('icons/obj/ammo.dmi', icon_state = "enforcer-rd")
. += image('icons/obj/ammo.dmi', icon_state = "enforcer-rd")
else if(ammo)
overlays += image('icons/obj/ammo.dmi', icon_state = "enforcer-bd")
. += image('icons/obj/ammo.dmi', icon_state = "enforcer-bd")
/obj/item/ammo_box/magazine/toy/enforcer/proc/is_riot()//if the topmost bullet is a riot dart
var/ammo = ammo_count()
@@ -500,11 +496,14 @@
icon_state = "handgun_ammo_battery"
var/charge = 1000
/obj/item/ammo_box/magazine/detective/speedcharger/update_icon()
/obj/item/ammo_box/magazine/detective/speedcharger/update_icon_state()
return
/obj/item/ammo_box/magazine/detective/speedcharger/update_overlays()
. = ..()
var/charge_percent_rounded = round(charge_percent(), 20) // to the nearest 20%
cut_overlays()
if(charge_percent_rounded)
add_overlay("hab_charge_[charge_percent_rounded]")
. += "hab_charge_[charge_percent_rounded]"
/obj/item/ammo_box/magazine/detective/speedcharger/proc/charge_percent()
return (charge / initial(charge) * 100)
+4 -1
View File
@@ -11,9 +11,12 @@
restricted_species = list(/datum/species/vox/armalis)
sprite_sheets_inhand = list("Vox Armalis" = 'icons/mob/clothing/species/armalis/held.dmi') //Big guns big birds.
/obj/item/gun/energy/noisecannon/update_icon()
/obj/item/gun/energy/noisecannon/update_icon_state()
return
/obj/item/gun/energy/noisecannon/update_overlays()
return list()
//Casing
/obj/item/ammo_casing/energy/sonic
projectile_type = /obj/item/projectile/energy/sonic
+45 -35
View File
@@ -20,6 +20,9 @@
var/charge_delay = 4
/// Do you want the gun to fit into a turret, defaults to true, used for if a energy gun is too strong to be in a turret, or does not make sense to be in one.
var/can_fit_in_turrets = TRUE
var/new_icon_state
/// Used when updating icon and overlays to determine the energy pips
var/ratio
/obj/item/gun/energy/examine(mob/user)
. = ..()
@@ -141,41 +144,8 @@
update_icon()
return
/obj/item/gun/energy/update_icon()
cut_overlays()
icon_state = initial(icon_state)
var/ratio = CEILING((cell.charge / cell.maxcharge) * charge_sections, 1)
var/inhand_ratio = CEILING((cell.charge / cell.maxcharge) * inhand_charge_sections, 1)
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)
add_overlay("[icon_state]_[shot.select_name]")
iconState += "_[shot.select_name]"
if(itemState)
itemState += "[shot.select_name]"
if(cell.charge < shot.e_cost)
overlays += "[icon_state]_empty"
else
if(!shaded_charge)
for(var/i = ratio, i >= 1, i--)
add_overlay(image(icon = icon, icon_state = iconState, pixel_x = ammo_x_offset * (i -1)))
else
add_overlay(image(icon = icon, icon_state = "[icon_state]_[modifystate ? "[shot.select_name]_" : ""]charge[ratio]"))
if(gun_light && can_flashlight)
var/iconF = "flight"
if(gun_light.on)
iconF = "flight_on"
add_overlay(image(icon = icon, icon_state = iconF, pixel_x = flight_x_offset, pixel_y = flight_y_offset))
if(bayonet && can_bayonet)
add_overlay(knife_overlay)
if(itemState)
itemState += "[inhand_ratio]"
item_state = itemState
if(current_skin)
icon_state = current_skin
/obj/item/gun/energy/update_icon(updates=ALL)
..()
var/mob/living/carbon/human/user = loc
if(istype(user))
if(user.hand) //this is kinda ew but whatever
@@ -183,6 +153,46 @@
else
user.update_inv_l_hand()
/obj/item/gun/energy/update_icon_state()
icon_state = initial(icon_state)
ratio = CEILING((cell.charge / cell.maxcharge) * charge_sections, 1)
var/inhand_ratio = CEILING((cell.charge / cell.maxcharge) * inhand_charge_sections, 1)
var/obj/item/ammo_casing/energy/shot = ammo_type[select]
new_icon_state = "[icon_state]_charge"
var/new_item_state = null
if(!initial(item_state))
new_item_state = icon_state
if(modifystate)
new_icon_state += "_[shot.select_name]"
if(new_item_state)
new_item_state += "[shot.select_name]"
if(new_item_state)
new_item_state += "[inhand_ratio]"
item_state = new_item_state
if(current_skin)
icon_state = current_skin
/obj/item/gun/energy/update_overlays()
. = ..()
var/obj/item/ammo_casing/energy/shot = ammo_type[select]
if(modifystate)
. += "[icon_state]_[shot.select_name]"
if(cell.charge < shot.e_cost)
. += "[icon_state]_empty"
else
if(!shaded_charge)
for(var/i = ratio, i >= 1, i--)
. += image(icon = icon, icon_state = new_icon_state, pixel_x = ammo_x_offset * (i -1))
else
. += image(icon = icon, icon_state = "[icon_state]_[modifystate ? "[shot.select_name]_" : ""]charge[ratio]")
if(gun_light && can_flashlight)
var/iconF = "flight"
if(gun_light.on)
iconF = "flight_on"
. += image(icon = icon, icon_state = iconF, pixel_x = flight_x_offset, pixel_y = flight_y_offset)
if(bayonet && can_bayonet)
. += knife_overlay
/obj/item/gun/energy/ui_action_click()
toggle_gunlight()
@@ -149,19 +149,18 @@
update_icon()
overheat = FALSE
/obj/item/gun/energy/kinetic_accelerator/update_icon()
cut_overlays()
/obj/item/gun/energy/kinetic_accelerator/update_overlays()
. = ..()
if(empty_state && !can_shoot())
add_overlay(empty_state)
. += empty_state
if(gun_light && can_flashlight)
var/iconF = "flight"
if(gun_light.on)
iconF = "flight_on"
add_overlay(image(icon = icon, icon_state = iconF, pixel_x = flight_x_offset, pixel_y = flight_y_offset))
. += image(icon = icon, icon_state = iconF, pixel_x = flight_x_offset, pixel_y = flight_y_offset)
if(bayonet && can_bayonet)
add_overlay(knife_overlay)
. += knife_overlay
/obj/item/gun/energy/kinetic_accelerator/experimental
name = "experimental kinetic accelerator"
@@ -130,12 +130,11 @@
ammo_type = list(/obj/item/ammo_casing/energy/immolator/strong, /obj/item/ammo_casing/energy/immolator/scatter)
origin_tech = "combat=5;magnets=5;powerstorage=4"
/obj/item/gun/energy/immolator/multi/update_icon()
..()
/obj/item/gun/energy/immolator/multi/update_overlays()
. = ..()
var/obj/item/ammo_casing/energy/shot = ammo_type[select]
var/append = shot.select_name
overlays += image(icon = icon, icon_state = "multilensimmolator-[append]")
. += image(icon = icon, icon_state = "multilensimmolator-[append]")
/obj/item/gun/energy/immolator/multi/cyborg
name = "cyborg immolator cannon"
@@ -44,10 +44,10 @@
cell.maxcharge = 600
cell.charge = 600
/obj/item/gun/energy/gun/mini/update_icon()
..()
/obj/item/gun/energy/gun/mini/update_overlays()
. = ..()
if(gun_light && gun_light.on)
overlays += "mini-light"
. += "mini-light"
/obj/item/gun/energy/gun/hos
name = "\improper X-01 MultiPhase Energy Gun"
+26 -31
View File
@@ -43,11 +43,14 @@
ammo_x_offset = 1
can_holster = TRUE
/obj/item/gun/energy/decloner/update_icon()
..()
/obj/item/gun/energy/decloner/update_icon_state()
return
/obj/item/gun/energy/decloner/update_overlays()
. = list()
var/obj/item/ammo_casing/energy/shot = ammo_type[select]
if(cell.charge > shot.e_cost)
add_overlay("decloner_spin")
. += "decloner_spin"
// Flora Gun //
/obj/item/gun/energy/floragun
@@ -191,8 +194,8 @@
else
return ..()
/obj/item/gun/energy/plasmacutter/update_icon()
return
/obj/item/gun/energy/plasmacutter/update_overlays()
return list()
/obj/item/gun/energy/plasmacutter/adv
name = "advanced plasma cutter"
@@ -217,10 +220,9 @@
var/obj/effect/portal/orange
/obj/item/gun/energy/wormhole_projector/update_icon()
/obj/item/gun/energy/wormhole_projector/update_icon_state()
icon_state = "wormhole_projector[select]"
item_state = icon_state
return
/obj/item/gun/energy/wormhole_projector/process_chamber()
..()
@@ -262,8 +264,8 @@
ammo_type = list(/obj/item/ammo_casing/energy/c3dbullet)
can_charge = FALSE
/obj/item/gun/energy/printer/update_icon()
return
/obj/item/gun/energy/printer/update_overlays()
return list()
/obj/item/gun/energy/printer/emp_act()
return
@@ -519,8 +521,7 @@
..()
update_icon()
/obj/item/gun/energy/bsg/update_icon()
. = ..()
/obj/item/gun/energy/bsg/update_icon_state()
if(core)
if(has_bluespace_crystal)
icon_state = "bsg_finished"
@@ -691,7 +692,7 @@
dat += "Power cost: "
dat += "<FONT color=[powercostcolor]><B>[powercost]</B></FONT>"
/obj/item/gun/energy/temperature/proc/update_temperature()
/obj/item/gun/energy/temperature/update_icon_state()
switch(temperature)
if(501 to INFINITY)
item_state = "tempgun_8"
@@ -713,32 +714,26 @@
item_state = "tempgun_0"
icon_state = item_state
/obj/item/gun/energy/temperature/update_icon()
overlays = 0
update_temperature()
update_user()
update_charge()
/obj/item/gun/energy/temperature/proc/update_user()
if(istype(loc,/mob/living/carbon))
var/mob/living/carbon/M = loc
M.update_inv_back()
M.update_inv_l_hand()
M.update_inv_r_hand()
/obj/item/gun/energy/temperature/proc/update_charge()
/obj/item/gun/energy/temperature/update_overlays()
. = ..()
var/charge = cell.charge
switch(charge)
if(900 to INFINITY) overlays += "900"
if(800 to 900) overlays += "800"
if(700 to 800) overlays += "700"
if(600 to 700) overlays += "600"
if(500 to 600) overlays += "500"
if(400 to 500) overlays += "400"
if(300 to 400) overlays += "300"
if(200 to 300) overlays += "200"
if(100 to 202) overlays += "100"
if(-INFINITY to 100) overlays += "0"
if(900 to INFINITY) . += "900"
if(800 to 900) . += "800"
if(700 to 800) . += "700"
if(600 to 700) . += "600"
if(500 to 600) . += "500"
if(400 to 500) . += "400"
if(300 to 400) . += "300"
if(200 to 300) . += "200"
if(100 to 200) . += "100"
if(-INFINITY to 100) . += "0"
// Mimic Gun //
/obj/item/gun/energy/mimicgun
@@ -850,7 +845,7 @@
return
var/new_speedcharger_charge = cell.give(S.charge)
S.charge -= new_speedcharger_charge
S.update_icon()
S.update_icon(UPDATE_OVERLAYS)
update_icon()
/obj/item/gun/energy/detective/process_fire(atom/target, mob/living/user, message, params, zone_override, bonus_spread)
+1 -1
View File
@@ -72,7 +72,7 @@
charges++
return 1
/obj/item/gun/magic/update_icon()
/obj/item/gun/magic/update_icon_state()
return
/obj/item/gun/magic/shoot_with_empty_chamber(mob/living/user as mob|obj)
+1 -1
View File
@@ -22,7 +22,7 @@
. = ..()
. += "Has [charges] charge\s remaining."
/obj/item/gun/magic/wand/update_icon()
/obj/item/gun/magic/wand/update_icon_state()
icon_state = "[initial(icon_state)][charges ? "" : "-drained"]"
@@ -22,19 +22,29 @@
user.put_in_hands(bomb)
user.visible_message("<span class='warning'>[user] detaches [bomb] from [src].</span>")
bomb = null
update_icon()
update_appearance(UPDATE_NAME|UPDATE_DESC|UPDATE_ICON_STATE)
return ..()
/obj/item/gun/blastcannon/update_icon()
/obj/item/gun/blastcannon/update_name()
. = ..()
if(bomb)
icon_state = icon_state_loaded
name = "blast cannon"
else
name = initial(name)
/obj/item/gun/blastcannon/update_desc()
. = ..()
if(bomb)
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/update_icon_state()
if(bomb)
icon_state = icon_state_loaded
else
icon_state = initial(icon_state)
/obj/item/gun/blastcannon/attackby(obj/O, mob/user)
if(istype(O, /obj/item/transfer_valve))
var/obj/item/transfer_valve/T = O
@@ -47,7 +57,7 @@
user.visible_message("<span class='warning'>[user] attaches [T] to [src]!</span>")
T.forceMove(src)
bomb = T
update_icon()
update_appearance(UPDATE_NAME|UPDATE_DESC|UPDATE_ICON_STATE)
return TRUE
return ..()
@@ -71,7 +81,7 @@
return ..()
var/power = calculate_bomb()
QDEL_NULL(bomb)
update_icon()
update_appearance(UPDATE_NAME|UPDATE_DESC|UPDATE_ICON_STATE)
var/heavy = power * 0.2
var/medium = power * 0.5
var/light = power
+20 -6
View File
@@ -22,14 +22,30 @@
return "This is a ballistic weapon. To reload, click the weapon in your hand to unload (if needed), then add the appropriate ammo. The description \
will tell you what caliber you need."
/obj/item/gun/projectile/update_icon()
..()
/obj/item/gun/projectile/update_name()
. = ..()
if(sawn_state)
name = "sawn-off [name]"
else
name = initial(name)
/obj/item/gun/projectile/update_desc()
. = ..()
if(sawn_state)
desc = sawn_desc
else
desc = initial(desc)
/obj/item/gun/projectile/update_icon_state()
if(current_skin)
icon_state = "[current_skin][suppressed ? "-suppressed" : ""][sawn_state ? "_sawn" : ""]"
else
icon_state = "[initial(icon_state)][suppressed ? "-suppressed" : ""][sawn_state ? "_sawn" : ""]"
/obj/item/gun/projectile/update_overlays()
. = ..()
if(bayonet && can_bayonet)
overlays += knife_overlay
. += knife_overlay
/obj/item/gun/projectile/process_chamber(eject_casing = 1, empty_chamber = 1)
var/obj/item/ammo_casing/AC = chambered //Find chambered round
@@ -201,14 +217,12 @@
if(sawn_state == SAWN_OFF)
return
user.visible_message("[user] shortens \the [src]!", "<span class='notice'>You shorten \the [src].</span>")
name = "sawn-off [name]"
desc = sawn_desc
w_class = WEIGHT_CLASS_NORMAL
item_state = "gun"//phil235 is it different with different skin?
slot_flags &= ~SLOT_BACK //you can't sling it on your back
slot_flags |= SLOT_BELT //but you can wear it on your belt (poorly concealed under a trenchcoat, ideally)
sawn_state = SAWN_OFF
update_icon()
update_appearance()
return 1
// Sawing guns related proc
@@ -8,16 +8,15 @@
fire_delay = 2
actions_types = list(/datum/action/item_action/toggle_firemode)
/obj/item/gun/projectile/automatic/update_icon()
..()
overlays.Cut()
if(!select)
overlays += "[initial(icon_state)]semi"
if(select == 1)
overlays += "[initial(icon_state)]burst"
/obj/item/gun/projectile/automatic/update_icon_state()
icon_state = "[initial(icon_state)][magazine ? "-[magazine.max_ammo]" : ""][chambered ? "" : "-e"][suppressed ? "-suppressed" : ""]"
if(bayonet && can_bayonet)
overlays += knife_overlay
/obj/item/gun/projectile/automatic/update_overlays()
. = ..()
if(!select)
. += "[initial(icon_state)]semi"
if(select == 1)
. += "[initial(icon_state)]burst"
/obj/item/gun/projectile/automatic/attackby(obj/item/A as obj, mob/user as mob, params)
. = ..()
@@ -108,8 +107,7 @@
..()
empty_alarm()
/obj/item/gun/projectile/automatic/c20r/update_icon()
..()
/obj/item/gun/projectile/automatic/c20r/update_icon_state()
icon_state = "c20r[magazine ? "-[CEILING(get_ammo(0)/4, 1)*4]" : ""][chambered ? "" : "-e"][suppressed ? "-suppressed" : ""]"
//WT550//
@@ -130,8 +128,7 @@
knife_x_offset = 25
knife_y_offset = 12
/obj/item/gun/projectile/automatic/wt550/update_icon()
..()
/obj/item/gun/projectile/automatic/wt550/update_icon_state()
icon_state = "wt550[magazine ? "-[CEILING(get_ammo(0)/4, 1)*4]" : ""]"
//Type-U3 Uzi//
@@ -181,23 +178,24 @@
else
return ..()
/obj/item/gun/projectile/automatic/m90/update_icon()
..()
overlays.Cut()
switch(select)
if(0)
overlays += "[initial(icon_state)]semi"
if(1)
overlays += "[initial(icon_state)]burst"
if(2)
overlays += "[initial(icon_state)]gren"
/obj/item/gun/projectile/automatic/m90/update_icon_state()
icon_state = "[initial(icon_state)][magazine ? "" : "-e"]"
if(magazine)
overlays += image(icon = icon, icon_state = "m90-[CEILING(get_ammo(0)/6, 1)*6]")
item_state = "m90-[CEILING(get_ammo(0)/7.5, 1)]"
else
item_state = "m90-0"
return
/obj/item/gun/projectile/automatic/m90/update_overlays()
. = ..()
switch(select)
if(0)
. += "[initial(icon_state)]semi"
if(1)
. += "[initial(icon_state)]burst"
if(2)
. += "[initial(icon_state)]gren"
if(magazine)
. += image(icon = icon, icon_state = "m90-[CEILING(get_ammo(0)/6, 1)*6]")
/obj/item/gun/projectile/automatic/m90/burst_select()
var/mob/living/carbon/human/user = usr
@@ -270,10 +268,10 @@
..()
update_icon()
/obj/item/gun/projectile/automatic/shotgun/bulldog/proc/update_magazine()
/obj/item/gun/projectile/automatic/shotgun/bulldog/update_overlays()
. = ..()
if(magazine)
overlays.Cut()
overlays += "[magazine.icon_state]"
. += "[magazine.icon_state]"
if(istype(magazine, /obj/item/ammo_box/magazine/m12g/XtrLrg))
w_class = WEIGHT_CLASS_BULKY
else
@@ -281,9 +279,7 @@
else
w_class = WEIGHT_CLASS_NORMAL
/obj/item/gun/projectile/automatic/shotgun/bulldog/update_icon()
overlays.Cut()
update_magazine()
/obj/item/gun/projectile/automatic/shotgun/bulldog/update_icon_state()
icon_state = "bulldog[chambered ? "" : "-e"]"
/obj/item/gun/projectile/automatic/shotgun/bulldog/attackby(obj/item/A as obj, mob/user as mob, params)
@@ -314,6 +310,5 @@
can_suppress = FALSE
burst_size = 2
/obj/item/gun/projectile/automatic/lasercarbine/update_icon()
..()
/obj/item/gun/projectile/automatic/lasercarbine/update_icon_state()
icon_state = "lasercarbine[magazine ? "-[CEILING(get_ammo(0)/5, 1)*5]" : ""]"
@@ -11,7 +11,7 @@
var/ready_to_fire = 0
var/slowdown_when_ready = 2
/obj/item/gun/projectile/bow/update_icon()
/obj/item/gun/projectile/bow/update_icon_state()
if(magazine.ammo_count() && !ready_to_fire)
icon_state = "bow_loaded"
else if(ready_to_fire)
@@ -47,10 +47,8 @@
/obj/item/gun/projectile/automatic/gyropistol/process_chamber(eject_casing = 0, empty_chamber = 1)
..()
/obj/item/gun/projectile/automatic/gyropistol/update_icon()
..()
/obj/item/gun/projectile/automatic/gyropistol/update_icon_state()
icon_state = "[initial(icon_state)][magazine ? "loaded" : ""]"
return
/obj/item/gun/projectile/automatic/speargun
name = "kinetic speargun"
@@ -69,7 +67,7 @@
select = 0
actions_types = list()
/obj/item/gun/projectile/automatic/speargun/update_icon()
/obj/item/gun/projectile/automatic/speargun/update_icon_state()
return
/obj/item/gun/projectile/automatic/speargun/attack_self()
@@ -15,10 +15,8 @@
fire_delay = 0
actions_types = list()
/obj/item/gun/projectile/automatic/pistol/update_icon()
..()
/obj/item/gun/projectile/automatic/pistol/update_icon_state()
icon_state = "[initial(icon_state)][magazine ? "-[magazine.max_ammo]" : ""][chambered ? "" : "-e"][suppressed ? "-suppressed" : ""]"
return
//M1911//
/obj/item/gun/projectile/automatic/pistol/m1911
@@ -52,20 +50,21 @@
options["Red Handle"] = "enforcer_redgrip"
options["Cancel"] = null
/obj/item/gun/projectile/automatic/pistol/enforcer/update_icon()
..()
/obj/item/gun/projectile/automatic/pistol/enforcer/update_icon_state()
if(current_skin)
icon_state = "[current_skin][chambered ? "" : "-e"]"
else
icon_state = "[initial(icon_state)][chambered ? "" : "-e"]"
overlays.Cut()
/obj/item/gun/projectile/automatic/pistol/enforcer/update_overlays()
. = list()
if(suppressed)
overlays += image(icon = icon, icon_state = "enforcer_supp", pixel_x = 4)
. += image(icon = icon, icon_state = "enforcer_supp", pixel_x = 4)
if(gun_light)
var/iconF = "Enforcer_light"
var/flashlight = "Enforcer_light"
if(gun_light.on)
iconF = "Enforcer_light-on"
overlays += image(icon = icon, icon_state = iconF, pixel_x = 0)
flashlight = "Enforcer_light-on"
. += image(icon = icon, icon_state = flashlight, pixel_x = 0)
/obj/item/gun/projectile/automatic/pistol/enforcer/ui_action_click()
toggle_gunlight()
@@ -367,18 +367,16 @@
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/projectile/revolver/doublebarrel/improvised/update_icon()
..()
if(sling)
icon_state = "ishotgun_sling"
item_state = "ishotgun_sling"
/obj/item/gun/projectile/revolver/doublebarrel/improvised/update_icon_state()
icon_state = "ishotgun[sling ? "_sling" : ""]"
item_state = "ishotgun[sling ? "_sling" : ""]"
/obj/item/gun/projectile/revolver/doublebarrel/improvised/sawoff(mob/user)
. = ..()
if(. && sling) //sawing off the gun removes the sling
new /obj/item/stack/cable_coil(get_turf(src), 10)
sling = FALSE
update_icon()
update_icon(UPDATE_ICON_STATE)
//caneshotgun
@@ -408,9 +406,12 @@
/obj/item/gun/projectile/revolver/doublebarrel/improvised/cane/is_crutch()
return 1
/obj/item/gun/projectile/revolver/doublebarrel/improvised/cane/update_icon()
/obj/item/gun/projectile/revolver/doublebarrel/improvised/cane/update_icon_state()
return
/obj/item/gun/projectile/revolver/doublebarrel/improvised/cane/update_overlays()
return list()
/obj/item/gun/projectile/revolver/doublebarrel/improvised/cane/attackby(obj/item/A, mob/user, params)
if(istype(A, /obj/item/stack/cable_coil))
return
@@ -22,7 +22,7 @@
playsound(src, cover_open ? 'sound/weapons/gun_interactions/sawopen.ogg' : 'sound/weapons/gun_interactions/sawclose.ogg', 50, 1)
update_icon()
/obj/item/gun/projectile/automatic/l6_saw/update_icon()
/obj/item/gun/projectile/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"]"
@@ -58,7 +58,6 @@
playsound(M, 'sound/weapons/gun_interactions/shotgunpump.ogg', 60, 1)
pump_unload(M)
pump_reload(M)
update_icon() //I.E. fix the desc
return 1
/obj/item/gun/projectile/shotgun/proc/pump_unload(mob/M)
@@ -136,8 +135,6 @@
/obj/item/gun/projectile/shotgun/riot/proc/post_sawoff()
name = "sawn-off riot shotgun"
desc = sawn_desc
w_class = WEIGHT_CLASS_NORMAL
current_skin = "riotshotgun_sawn"
item_state = "riotshotgun_sawn" //phil235 is it different with different skin?
@@ -145,7 +142,7 @@
slot_flags |= SLOT_BELT //but you can wear it on your belt (poorly concealed under a trenchcoat, ideally)
sawn_state = SAWN_OFF
magazine.max_ammo = 3
update_icon()
update_appearance()
/obj/item/gun/projectile/shotgun/riot/proc/unsaw(obj/item/A, mob/user)
@@ -179,8 +176,6 @@
return 1
/obj/item/gun/projectile/shotgun/riot/proc/post_unsaw()
name = initial(name)
desc = initial(desc)
w_class = initial(w_class)
current_skin = "riotshotgun"
item_state = initial(item_state)
@@ -188,10 +183,9 @@
slot_flags |= SLOT_BACK
sawn_state = SAWN_INTACT
magazine.max_ammo = 6
update_icon()
update_appearance()
/obj/item/gun/projectile/shotgun/riot/update_icon() //Can't use the old proc as it makes it go to riotshotgun-short_sawn
..()
/obj/item/gun/projectile/shotgun/riot/update_icon_state() //Can't use the old proc as it makes it go to riotshotgun-short_sawn
if(current_skin)
icon_state = "[current_skin]"
else
@@ -231,7 +225,6 @@
else
pump_unload(M)
bolt_open = !bolt_open
update_icon() //I.E. fix the desc
return 1
/obj/item/gun/projectile/shotgun/blow_up(mob/user)
@@ -35,7 +35,7 @@
QDEL_NULL(magazine)
magazine = new /obj/item/ammo_box/magazine/sniper_rounds/penetrator(src)
/obj/item/gun/projectile/automatic/sniper_rifle/update_icon()
/obj/item/gun/projectile/automatic/sniper_rifle/update_icon_state()
if(magazine)
icon_state = "sniper-mag"
else
@@ -50,7 +50,7 @@
max_ammo = 6
caliber = ".50"
/obj/item/ammo_box/magazine/sniper_rounds/update_icon()
/obj/item/ammo_box/magazine/sniper_rounds/update_icon_state()
if(ammo_count())
icon_state = "[initial(icon_state)]-ammo"
else
@@ -178,13 +178,13 @@
max_ammo = 6
caliber = "foam_force_sniper"
/obj/item/ammo_box/magazine/toy/sniper_rounds/update_icon()
overlays.Cut()
/obj/item/ammo_box/magazine/toy/sniper_rounds/update_icon_state()
return
/obj/item/ammo_box/magazine/toy/sniper_rounds/update_overlays()
. = ..()
var/ammo = ammo_count()
if(ammo && istype(contents[contents.len], /obj/item/ammo_casing/caseless/foam_dart/sniper/riot))
overlays += image('icons/obj/ammo.dmi', icon_state = ".50mag-r")
. += ".50mag-r"
else if(ammo)
overlays += image('icons/obj/ammo.dmi', icon_state = ".50mag-f")
else
icon_state = "[initial(icon_state)]"
. += ".50mag-f"
@@ -30,8 +30,7 @@
can_holster = TRUE
actions_types = list()
/obj/item/gun/projectile/automatic/toy/pistol/update_icon()
..()
/obj/item/gun/projectile/automatic/toy/pistol/update_icon_state()
icon_state = "[initial(icon_state)][magazine ? "-[magazine.max_ammo]" : ""][chambered ? "" : "-e"]"
/obj/item/gun/projectile/automatic/toy/pistol/riot
@@ -50,18 +49,16 @@
mag_type = /obj/item/ammo_box/magazine/toy/enforcer
can_flashlight = TRUE
/obj/item/gun/projectile/automatic/toy/pistol/enforcer/update_icon()
..()
/obj/item/gun/projectile/automatic/toy/pistol/enforcer/update_icon_state()
icon_state = "[initial(icon_state)][chambered ? "" : "-e"]"
/obj/item/gun/projectile/automatic/toy/pistol/enforcer/update_icon()
..()
overlays.Cut()
/obj/item/gun/projectile/automatic/toy/pistol/enforcer/update_overlays()
. = ..()
if(gun_light)
var/iconF = "Enforcer_light"
var/flashlight = "Enforcer_light"
if(gun_light.on)
iconF = "Enforcer_light-on"
overlays += image(icon = 'icons/obj/guns/projectile.dmi', icon_state = iconF, pixel_x = 0)
flashlight = "Enforcer_light-on"
. += image(icon = 'icons/obj/guns/projectile.dmi', icon_state = flashlight, pixel_x = 0)
/obj/item/gun/projectile/automatic/toy/pistol/enforcer/ui_action_click()
toggle_gunlight()
-3
View File
@@ -24,9 +24,6 @@
rockets = null
return ..()
/obj/item/gun/rocketlauncher/update_icon()
return
/obj/item/gun/rocketlauncher/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/ammo_casing/rocket))
if(rockets.len < max_rockets)
+4 -1
View File
@@ -41,9 +41,12 @@
loaded_projectiles = null
return ..()
/obj/item/gun/throw/update_icon()
/obj/item/gun/throw/update_icon_state()
return
/obj/item/gun/throw/update_overlays()
return list()
/obj/item/gun/throw/attackby(obj/item/I, mob/user, params)
if(istype(I, valid_projectile_type) && !(I.flags & NODROP))
if(get_ammocount() < max_capacity)
@@ -29,7 +29,7 @@
if(cell && severity)
emp_act(severity)
/obj/item/gun/throw/crossbow/update_icon()
/obj/item/gun/throw/crossbow/update_icon_state()
if(!tension)
if(!to_launch)
icon_state = "[initial(icon_state)]"
@@ -63,7 +63,7 @@
..()
if(to_launch)
modify_projectile(to_launch, 1)
update_icon()
update_icon(UPDATE_ICON_STATE)
/obj/item/gun/throw/crossbow/attack_self(mob/living/user)
if(tension)
@@ -77,7 +77,7 @@
else
user.visible_message("<span class='notice'>[user] relaxes the tension on [src]'s string.</span>","<span class='notice'>You relax the tension on [src]'s string.</span>")
tension = 0
update_icon()
update_icon(UPDATE_ICON_STATE)
else
draw(user)
@@ -92,7 +92,7 @@
if(do_after(user, 25 * drawtension, target = user))
tension = drawtension
user.visible_message("[usr] draws back the string of [src]!","[src] clunks as you draw the string to its maximum tension!!")
update_icon()
update_icon(UPDATE_ICON_STATE)
/obj/item/gun/throw/crossbow/attackby(obj/item/I, mob/user, params)
if(!istype(I, /obj/item/stock_parts/cell))
@@ -145,7 +145,8 @@
/obj/item/gun/throw/crossbow/process_fire(atom/target as mob|obj|turf, mob/living/user as mob|obj, message = 1, params, zone_override)
..()
tension = 0
update_icon()
update_icon(UPDATE_ICON_STATE)
/obj/item/gun/throw/crossbow/french
name = "french powered crossbow"
icon_state = "fcrossbow"
@@ -24,7 +24,7 @@
/obj/item/gun/throw/piecannon/notify_ammo_count()
return "<span class='notice'>[src] has [get_ammocount()] of [max_capacity] pies left.</span>"
/obj/item/gun/throw/piecannon/update_icon()
/obj/item/gun/throw/piecannon/update_icon_state()
if(to_launch)
icon_state = "piecannon1"
else
@@ -33,4 +33,4 @@
/obj/item/gun/throw/piecannon/process_chamber()
..()
update_icon()
update_icon(UPDATE_ICON_STATE)
+1 -1
View File
@@ -144,7 +144,7 @@
var/door_type = pick(door_types)
var/obj/structure/mineral_door/D = new door_type(T)
T.ChangeTurf(/turf/simulated/floor/plasteel)
D.Open()
D.operate()
/obj/item/projectile/magic/door/proc/OpenDoor(obj/machinery/door/D)
if(istype(D,/obj/machinery/door/airlock))
@@ -49,7 +49,7 @@
if(pen)
newdart.add_pen(pen)
pen = null
newdart.update_icon()
newdart.update_appearance(UPDATE_DESC|UPDATE_ICON_STATE)
/obj/item/projectile/bullet/reusable/foam_dart/Destroy()
QDEL_NULL(pen)