mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
Rewrite examine() to pass a list around
This commit is contained in:
@@ -51,9 +51,9 @@
|
||||
icon_state = "[initial(icon_state)]-spent"
|
||||
|
||||
/obj/item/ammo_casing/examine(mob/user)
|
||||
..()
|
||||
. = ..()
|
||||
if (!BB)
|
||||
to_chat(user, "This one is spent.")
|
||||
. += "This one is spent."
|
||||
|
||||
//Gun loading types
|
||||
#define SINGLE_CASING 1 //The gun only accepts ammo_casings. ammo_magazines should never have this as their mag_type.
|
||||
@@ -183,8 +183,8 @@
|
||||
icon_state = (new_state)? new_state : initial(icon_state)
|
||||
|
||||
/obj/item/ammo_magazine/examine(mob/user)
|
||||
..()
|
||||
to_chat(user, "There [(stored_ammo.len == 1)? "is" : "are"] [stored_ammo.len] round\s left!")
|
||||
. = ..()
|
||||
. += "There [(stored_ammo.len == 1)? "is" : "are"] [stored_ammo.len] round\s left!"
|
||||
|
||||
//magazine icon state caching
|
||||
/var/global/list/magazine_icondata_keys = list()
|
||||
|
||||
@@ -11,4 +11,4 @@
|
||||
|
||||
/obj/item/weapon/magnetic_ammo/examine(mob/user)
|
||||
. = ..()
|
||||
to_chat(user, "There [(remaining == 1)? "is" : "are"] [remaining] flechette\s left!")
|
||||
. += "There [(remaining == 1)? "is" : "are"] [remaining] flechette\s left!"
|
||||
@@ -50,12 +50,12 @@
|
||||
produce()
|
||||
|
||||
/obj/item/ammo_magazine/smart/examine(mob/user)
|
||||
..()
|
||||
. = ..()
|
||||
|
||||
if(attached_cell)
|
||||
to_chat(user, "<span class='notice'>\The [src] is loaded with a [attached_cell.name]. It is [round(attached_cell.percent())]% charged.</span>")
|
||||
. += "<span class='notice'>\The [src] is loaded with a [attached_cell.name]. It is [round(attached_cell.percent())]% charged.</span>"
|
||||
else
|
||||
to_chat(user, "<span class='warning'>\The [src] does not appear to have a power source installed.</span>")
|
||||
. += "<span class='warning'>\The [src] does not appear to have a power source installed.</span>"
|
||||
|
||||
/obj/item/ammo_magazine/smart/update_icon()
|
||||
if(attached_cell)
|
||||
|
||||
@@ -745,7 +745,7 @@
|
||||
. = ..()
|
||||
if(firemodes.len > 1)
|
||||
var/datum/firemode/current_mode = firemodes[sel_mode]
|
||||
to_chat(user, "The fire selector is set to [current_mode.name].")
|
||||
. += "The fire selector is set to [current_mode.name]."
|
||||
|
||||
/obj/item/weapon/gun/proc/switch_firemodes(mob/user)
|
||||
if(firemodes.len <= 1)
|
||||
|
||||
@@ -178,12 +178,11 @@
|
||||
if(power_supply)
|
||||
if(charge_cost)
|
||||
var/shots_remaining = round(power_supply.charge / max(1, charge_cost)) // Paranoia
|
||||
to_chat(user, "Has [shots_remaining] shot\s remaining.")
|
||||
. += "Has [shots_remaining] shot\s remaining."
|
||||
else
|
||||
to_chat(user, "Has infinite shots remaining.")
|
||||
. += "Has infinite shots remaining."
|
||||
else
|
||||
to_chat(user, "Does not have a power cell.")
|
||||
return
|
||||
. += "Does not have a power cell."
|
||||
|
||||
/obj/item/weapon/gun/energy/update_icon(var/ignore_inhands)
|
||||
if(power_supply == null)
|
||||
|
||||
@@ -208,18 +208,18 @@
|
||||
icon_state = "crossbowframe[buildstate]"
|
||||
|
||||
/obj/item/weapon/crossbowframe/examine(mob/user)
|
||||
..(user)
|
||||
. = ..()
|
||||
switch(buildstate)
|
||||
if(1)
|
||||
to_chat(user, "It has a loose rod frame in place.")
|
||||
. += "It has a loose rod frame in place."
|
||||
if(2)
|
||||
to_chat(user, "It has a steel backbone welded in place.")
|
||||
. += "It has a steel backbone welded in place."
|
||||
if(3)
|
||||
to_chat(user, "It has a steel backbone and a cell mount installed.")
|
||||
. += "It has a steel backbone and a cell mount installed."
|
||||
if(4)
|
||||
to_chat(user, "It has a steel backbone, plastic lath and a cell mount installed.")
|
||||
. += "It has a steel backbone, plastic lath and a cell mount installed."
|
||||
if(5)
|
||||
to_chat(user, "It has a steel cable loosely strung across the lath.")
|
||||
. += "It has a steel cable loosely strung across the lath."
|
||||
|
||||
/obj/item/weapon/crossbowframe/attackby(obj/item/W as obj, mob/user as mob)
|
||||
if(istype(W,/obj/item/stack/rods))
|
||||
|
||||
@@ -36,11 +36,12 @@
|
||||
update_icon()
|
||||
|
||||
/obj/item/weapon/gun/launcher/grenade/examine(mob/user)
|
||||
if(..(user, 2))
|
||||
. = ..()
|
||||
if(get_dist(user, src) <= 2)
|
||||
var/grenade_count = grenades.len + (chambered? 1 : 0)
|
||||
to_chat(user, "Has [grenade_count] grenade\s remaining.")
|
||||
. += "Has [grenade_count] grenade\s remaining."
|
||||
if(chambered)
|
||||
to_chat(user, "\A [chambered] is chambered.")
|
||||
. += "\A [chambered] is chambered."
|
||||
|
||||
/obj/item/weapon/gun/launcher/grenade/proc/load(obj/item/weapon/grenade/G, mob/user)
|
||||
if(G.loadable)
|
||||
|
||||
@@ -99,13 +99,13 @@
|
||||
return launched
|
||||
|
||||
/obj/item/weapon/gun/launcher/pneumatic/examine(mob/user)
|
||||
if(!..(user, 2))
|
||||
return
|
||||
to_chat(user, "The valve is dialed to [pressure_setting]%.")
|
||||
if(tank)
|
||||
to_chat(user, "The tank dial reads [tank.air_contents.return_pressure()] kPa.")
|
||||
else
|
||||
to_chat(user, "Nothing is attached to the tank valve!")
|
||||
. = ..()
|
||||
if(get_dist(user, src) <= 2)
|
||||
. += "The valve is dialed to [pressure_setting]%."
|
||||
if(tank)
|
||||
. += "The tank dial reads [tank.air_contents.return_pressure()] kPa."
|
||||
else
|
||||
. += "Nothing is attached to the tank valve!"
|
||||
|
||||
/obj/item/weapon/gun/launcher/pneumatic/update_release_force(obj/item/projectile)
|
||||
if(tank)
|
||||
@@ -150,18 +150,18 @@
|
||||
icon_state = "pneumatic[buildstate]"
|
||||
|
||||
/obj/item/weapon/cannonframe/examine(mob/user)
|
||||
..(user)
|
||||
. = ..()
|
||||
switch(buildstate)
|
||||
if(1)
|
||||
to_chat(user, "It has a pipe segment installed.")
|
||||
. += "It has a pipe segment installed."
|
||||
if(2)
|
||||
to_chat(user, "It has a pipe segment welded in place.")
|
||||
. += "It has a pipe segment welded in place."
|
||||
if(3)
|
||||
to_chat(user, "It has an outer chassis installed.")
|
||||
. += "It has an outer chassis installed."
|
||||
if(4)
|
||||
to_chat(user, "It has an outer chassis welded in place.")
|
||||
. += "It has an outer chassis welded in place."
|
||||
if(5)
|
||||
to_chat(user, "It has a transfer valve installed.")
|
||||
. += "It has a transfer valve installed."
|
||||
|
||||
/obj/item/weapon/cannonframe/attackby(obj/item/W as obj, mob/user as mob)
|
||||
if(istype(W,/obj/item/pipe))
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
var/list/rockets = new/list()
|
||||
|
||||
/obj/item/weapon/gun/launcher/rocket/examine(mob/user)
|
||||
if(!..(user, 2))
|
||||
return
|
||||
to_chat(user, "<font color='blue'>[rockets.len] / [max_rockets] rockets.</font>")
|
||||
. = ..()
|
||||
if(get_dist(user, src) <= 2)
|
||||
. += "<font color='blue'>[rockets.len] / [max_rockets] rockets.</font>"
|
||||
|
||||
/obj/item/weapon/gun/launcher/rocket/attackby(obj/item/I as obj, mob/user as mob)
|
||||
if(istype(I, /obj/item/ammo_casing/rocket))
|
||||
|
||||
@@ -24,7 +24,9 @@
|
||||
|
||||
/obj/item/weapon/gun/magnetic/matfed/examine(mob/user)
|
||||
. = ..()
|
||||
show_ammo(user)
|
||||
var/ammotext = show_ammo()
|
||||
if(ammotext)
|
||||
. += ammotext
|
||||
|
||||
/obj/item/weapon/gun/magnetic/matfed/update_icon()
|
||||
var/list/overlays_to_add = list()
|
||||
@@ -69,9 +71,9 @@
|
||||
/obj/item/weapon/gun/magnetic/matfed/use_ammo()
|
||||
mat_storage -= mat_cost
|
||||
|
||||
/obj/item/weapon/gun/magnetic/matfed/show_ammo(var/mob/user)
|
||||
/obj/item/weapon/gun/magnetic/matfed/show_ammo()
|
||||
if(mat_storage)
|
||||
to_chat(user, "<span class='notice'>It has [mat_storage] out of [max_mat_storage] units of [ammo_material] loaded.</span>")
|
||||
return list("<span class='notice'>It has [mat_storage] out of [max_mat_storage] units of [ammo_material] loaded.</span>")
|
||||
|
||||
/obj/item/weapon/gun/magnetic/matfed/attackby(var/obj/item/thing, var/mob/user)
|
||||
if(removable_components)
|
||||
|
||||
@@ -65,14 +65,14 @@
|
||||
Tank.air_contents.remove(moles_to_pull)
|
||||
|
||||
/obj/item/weapon/gun/magnetic/gasthrower/show_ammo(var/mob/user)
|
||||
..()
|
||||
. = ..()
|
||||
|
||||
if(loaded)
|
||||
var/obj/item/weapon/tank/T = loaded
|
||||
to_chat(user, "<span class='notice'>\The [T]'s pressure meter shows: [T.air_contents.return_pressure()] kpa.</span>")
|
||||
. += "<span class='notice'>\The [T]'s pressure meter shows: [T.air_contents.return_pressure()] kpa.</span>"
|
||||
|
||||
switch(check_ammo())
|
||||
if(TRUE)
|
||||
to_chat(user, "<span class='notice'>\The [src]'s display registers a proper fuel mixture.</span>")
|
||||
. += "<span class='notice'>\The [src]'s display registers a proper fuel mixture.</span>"
|
||||
if(FALSE)
|
||||
to_chat(user, "<span class='warning'>\The [src]'s display registers an improper fuel mixture.</span>")
|
||||
. += "<span class='warning'>\The [src]'s display registers an improper fuel mixture.</span>"
|
||||
|
||||
@@ -66,28 +66,30 @@
|
||||
overlays = overlays_to_add
|
||||
..()
|
||||
|
||||
/obj/item/weapon/gun/magnetic/proc/show_ammo(var/mob/user)
|
||||
/obj/item/weapon/gun/magnetic/proc/show_ammo()
|
||||
var/list/ammotext = list()
|
||||
if(loaded)
|
||||
to_chat(user, "<span class='notice'>It has \a [loaded] loaded.</span>")
|
||||
ammotext += "<span class='notice'>It has \a [loaded] loaded.</span>"
|
||||
|
||||
return ammotext
|
||||
|
||||
/obj/item/weapon/gun/magnetic/examine(var/mob/user)
|
||||
. = ..(user, 2)
|
||||
if(.)
|
||||
show_ammo(user)
|
||||
. = ..()
|
||||
if(get_dist(user, src) <= 2)
|
||||
. += show_ammo()
|
||||
|
||||
if(cell)
|
||||
to_chat(user, "<span class='notice'>The installed [cell.name] has a charge level of [round((cell.charge/cell.maxcharge)*100)]%.</span>")
|
||||
. += "<span class='notice'>The installed [cell.name] has a charge level of [round((cell.charge/cell.maxcharge)*100)]%.</span>"
|
||||
if(capacitor)
|
||||
to_chat(user, "<span class='notice'>The installed [capacitor.name] has a charge level of [round((capacitor.charge/capacitor.max_charge)*100)]%.</span>")
|
||||
. += "<span class='notice'>The installed [capacitor.name] has a charge level of [round((capacitor.charge/capacitor.max_charge)*100)]%.</span>"
|
||||
|
||||
if(!cell || !capacitor)
|
||||
to_chat(user, "<span class='notice'>The capacitor charge indicator is blinking <font color ='[COLOR_RED]'>red</font>. Maybe you should check the cell or capacitor.</span>")
|
||||
. += "<span class='notice'>The capacitor charge indicator is blinking <font color ='[COLOR_RED]'>red</font>. Maybe you should check the cell or capacitor.</span>"
|
||||
else
|
||||
if(capacitor.charge < power_cost)
|
||||
to_chat(user, "<span class='notice'>The capacitor charge indicator is <font color ='[COLOR_ORANGE]'>amber</font>.</span>")
|
||||
. += "<span class='notice'>The capacitor charge indicator is <font color ='[COLOR_ORANGE]'>amber</font>.</span>"
|
||||
else
|
||||
to_chat(user, "<span class='notice'>The capacitor charge indicator is <font color ='[COLOR_GREEN]'>green</font>.</span>")
|
||||
return TRUE
|
||||
. += "<span class='notice'>The capacitor charge indicator is <font color ='[COLOR_GREEN]'>green</font>.</span>"
|
||||
|
||||
/obj/item/weapon/gun/magnetic/attackby(var/obj/item/thing, var/mob/user)
|
||||
|
||||
|
||||
@@ -88,22 +88,22 @@
|
||||
icon_state = "coilgun_construction_[construction_stage]"
|
||||
|
||||
/obj/item/weapon/coilgun_assembly/examine(var/mob/user)
|
||||
. = ..(user,2)
|
||||
if(.)
|
||||
. = ..()
|
||||
if(get_dist(user, src) <= 2)
|
||||
switch(construction_stage)
|
||||
if(2)
|
||||
to_chat(user, "<span class='notice'>It has a metal frame loosely shaped around the stock.</span>")
|
||||
. += "<span class='notice'>It has a metal frame loosely shaped around the stock.</span>"
|
||||
if(3)
|
||||
to_chat(user, "<span class='notice'>It has a metal frame duct-taped to the stock.</span>")
|
||||
. += "<span class='notice'>It has a metal frame duct-taped to the stock.</span>"
|
||||
if(4)
|
||||
to_chat(user, "<span class='notice'>It has a length of pipe attached to the body.</span>")
|
||||
. += "<span class='notice'>It has a length of pipe attached to the body.</span>"
|
||||
if(4)
|
||||
to_chat(user, "<span class='notice'>It has a length of pipe welded to the body.</span>")
|
||||
. += "<span class='notice'>It has a length of pipe welded to the body.</span>"
|
||||
if(6)
|
||||
to_chat(user, "<span class='notice'>It has a cable mount and capacitor jack wired to the frame.</span>")
|
||||
. += "<span class='notice'>It has a cable mount and capacitor jack wired to the frame.</span>"
|
||||
if(7)
|
||||
to_chat(user, "<span class='notice'>It has a single superconducting coil threaded onto the barrel.</span>")
|
||||
. += "<span class='notice'>It has a single superconducting coil threaded onto the barrel.</span>"
|
||||
if(8)
|
||||
to_chat(user, "<span class='notice'>It has a pair of superconducting coils threaded onto the barrel.</span>")
|
||||
. += "<span class='notice'>It has a pair of superconducting coils threaded onto the barrel.</span>"
|
||||
if(9)
|
||||
to_chat(user, "<span class='notice'>It has three superconducting coils attached to the body, waiting to be secured.</span>")
|
||||
. += "<span class='notice'>It has three superconducting coils attached to the body, waiting to be secured.</span>"
|
||||
|
||||
@@ -31,12 +31,12 @@
|
||||
|
||||
// Not going to check type repeatedly, if you code or varedit
|
||||
// load_type and get runtime errors, don't come crying to me.
|
||||
/obj/item/weapon/gun/magnetic/railgun/show_ammo(var/mob/user)
|
||||
/obj/item/weapon/gun/magnetic/railgun/show_ammo()
|
||||
var/obj/item/weapon/rcd_ammo/ammo = loaded
|
||||
if (ammo)
|
||||
to_chat(user, "<span class='notice'>There are [ammo.remaining] shot\s remaining in \the [loaded].</span>")
|
||||
return list("<span class='notice'>There are [ammo.remaining] shot\s remaining in \the [loaded].</span>")
|
||||
else
|
||||
to_chat(user, "<span class='notice'>There is nothing loaded.</span>")
|
||||
return list("<span class='notice'>There is nothing loaded.</span>")
|
||||
|
||||
/obj/item/weapon/gun/magnetic/railgun/check_ammo()
|
||||
var/obj/item/weapon/rcd_ammo/ammo = loaded
|
||||
@@ -77,9 +77,9 @@
|
||||
)
|
||||
|
||||
/obj/item/weapon/gun/magnetic/railgun/automatic/examine(var/mob/user)
|
||||
. = ..(user,1)
|
||||
if(.)
|
||||
to_chat(user, "<span class='notice'>Someone has scratched <i>Ultima Ratio Regum</i> onto the side of the barrel.</span>")
|
||||
. = ..()
|
||||
if(Adjacent(user))
|
||||
. += "<span class='notice'>Someone has scratched <i>Ultima Ratio Regum</i> onto the side of the barrel.</span>"
|
||||
|
||||
/obj/item/weapon/gun/magnetic/railgun/flechette
|
||||
name = "flechette gun"
|
||||
|
||||
@@ -230,11 +230,10 @@
|
||||
update_icon() //make sure to do this after unsetting ammo_magazine
|
||||
|
||||
/obj/item/weapon/gun/projectile/examine(mob/user)
|
||||
..(user)
|
||||
. = ..()
|
||||
if(ammo_magazine)
|
||||
to_chat(user, "It has \a [ammo_magazine] loaded.")
|
||||
to_chat(user, "Has [getAmmo()] round\s remaining.")
|
||||
return
|
||||
. += "It has \a [ammo_magazine] loaded."
|
||||
. += "It has [getAmmo()] round\s remaining."
|
||||
|
||||
/obj/item/weapon/gun/projectile/proc/getAmmo()
|
||||
var/bullets = 0
|
||||
|
||||
@@ -186,11 +186,11 @@
|
||||
return
|
||||
|
||||
/obj/item/weapon/gun/projectile/automatic/z8/examine(mob/user)
|
||||
..()
|
||||
. = ..()
|
||||
if(launcher.chambered)
|
||||
to_chat(user, "\The [launcher] has \a [launcher.chambered] loaded.")
|
||||
. += "\The [launcher] has \a [launcher.chambered] loaded."
|
||||
else
|
||||
to_chat(user, "\The [launcher] is empty.")
|
||||
. += "\The [launcher] is empty."
|
||||
|
||||
/obj/item/weapon/gun/projectile/automatic/l6_saw
|
||||
name = "light machine gun"
|
||||
|
||||
@@ -100,16 +100,13 @@
|
||||
fill_dart(dart)
|
||||
|
||||
/obj/item/weapon/gun/projectile/dartgun/examine(mob/user)
|
||||
//update_icon()
|
||||
//if (!..(user, 2))
|
||||
// return
|
||||
..()
|
||||
if (beakers.len)
|
||||
to_chat(user, "<font color='blue'>[src] contains:</font>")
|
||||
. = ..()
|
||||
if(beakers.len)
|
||||
. += "<span class='notice'>[src] contains:</span>"
|
||||
for(var/obj/item/weapon/reagent_containers/glass/beaker/B in beakers)
|
||||
if(B.reagents && B.reagents.reagent_list.len)
|
||||
for(var/datum/reagent/R in B.reagents.reagent_list)
|
||||
to_chat(user, "<font color='blue'>[R.volume] units of [R.name]</font>")
|
||||
. += "<span class='notice'>[R.volume] units of [R.name]</span>"
|
||||
|
||||
/obj/item/weapon/gun/projectile/dartgun/attackby(obj/item/I as obj, mob/user as mob)
|
||||
if(istype(I, /obj/item/weapon/reagent_containers/glass))
|
||||
|
||||
@@ -249,14 +249,14 @@ obj/item/weapon/gun/projectile/revolver/detective45/verb/rename_gun()
|
||||
chamber_offset = rand(0,max_shells - loaded.len)
|
||||
|
||||
/obj/item/weapon/gun/projectile/revolver/lemat/examine(mob/user)
|
||||
..()
|
||||
. = ..()
|
||||
if(secondary_loaded)
|
||||
var/to_print
|
||||
for(var/round in secondary_loaded)
|
||||
to_print += round
|
||||
to_chat(user, "\The [src] has a secondary barrel loaded with \a [to_print]")
|
||||
. += "It has a secondary barrel loaded with \a [to_print]"
|
||||
else
|
||||
to_chat(user, "\The [src] has a secondary barrel that is empty.")
|
||||
. += "It has a secondary barrel that is empty."
|
||||
|
||||
|
||||
//Ported from Bay
|
||||
|
||||
@@ -34,8 +34,8 @@
|
||||
update_icon()
|
||||
|
||||
/obj/item/weapon/gun/launcher/spikethrower/examine(mob/user)
|
||||
..(user)
|
||||
to_chat(user, "It has [spikes] spike\s remaining.")
|
||||
. = ..()
|
||||
. += "It has [spikes] spike\s remaining."
|
||||
|
||||
/obj/item/weapon/gun/launcher/spikethrower/update_icon()
|
||||
icon_state = "spikethrower[spikes]"
|
||||
|
||||
Reference in New Issue
Block a user