Refactors the examine proc to return a list of strings (#12280)

This commit is contained in:
farie82
2019-09-25 22:05:01 -07:00
committed by variableundefined
parent 40a4cd1b75
commit 0e8ddb2afe
210 changed files with 808 additions and 830 deletions
@@ -236,10 +236,10 @@
if(ammo && is_rubber())
overlays += image('icons/obj/ammo.dmi', icon_state = "enforcer-r")
/obj/item/ammo_box/magazine/enforcer/examine(mob/user, var/distance)
..()
if(distance <= 2)
to_chat(user, "It seems to be loaded with [is_rubber() ? "rubber" : "lethal"] bullets.")//only can see the topmost one.
/obj/item/ammo_box/magazine/enforcer/examine(mob/user)
. = ..()
if(get_dist(user, src) <= 2)
. += "It seems to be loaded with [is_rubber() ? "rubber" : "lethal"] bullets."//only can see the topmost one.
/obj/item/ammo_box/magazine/enforcer/proc/is_rubber()//if the topmost bullet is a rubber one
var/ammo = ammo_count()
+6 -6
View File
@@ -85,17 +85,17 @@
return ..()
/obj/item/gun/examine(mob/user)
..()
. = ..()
if(unique_reskin && !current_skin)
to_chat(user, "<span class='notice'>Alt-click it to reskin it.</span>")
. += "<span class='notice'>Alt-click it to reskin it.</span>"
if(unique_rename)
to_chat(user, "<span class='notice'>Use a pen on it to rename it.</span>")
. += "<span class='notice'>Use a pen on it to rename it.</span>"
if(bayonet)
to_chat(user, "It has \a [bayonet] [can_bayonet ? "" : "permanently "]affixed to it.")
. += "It has \a [bayonet] [can_bayonet ? "" : "permanently "]affixed to it."
if(can_bayonet) //if it has a bayonet and this is false, the bayonet is permanent.
to_chat(user, "<span class='info'>[bayonet] looks like it can be <b>unscrewed</b> from [src].</span>")
. += "<span class='info'>[bayonet] looks like it can be <b>unscrewed</b> from [src].</span>"
else if(can_bayonet)
to_chat(user, "It has a <b>bayonet</b> lug on it.")
. += "It has a <b>bayonet</b> lug on it."
/obj/item/gun/proc/process_chamber()
return 0
+4 -3
View File
@@ -56,13 +56,14 @@
update_icon()
/obj/item/gun/dartgun/examine(mob/user)
if(..(user, 2))
. = ..()
if(get_dist(user, src) <= 2)
if(beakers.len)
to_chat(user, "<span class='notice'>[src] contains:</span>")
. += "<span class='notice'>[src] contains:</span>"
for(var/obj/item/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, "<span class='notice'>[R.volume] units of [R.name]</span>")
. += "<span class='notice'>[R.volume] units of [R.name]</span>"
/obj/item/gun/dartgun/attackby(obj/item/I as obj, mob/user as mob, params)
if(istype(I, /obj/item/dart_cartridge))
@@ -28,12 +28,13 @@
var/empty_state = "kineticgun_empty"
/obj/item/gun/energy/kinetic_accelerator/examine(mob/user)
if(..(user, 1))
. = ..()
if(in_range(user, src))
if(max_mod_capacity)
to_chat(user, "<b>[get_remaining_mod_capacity()]%</b> mod capacity remaining.")
. += "<b>[get_remaining_mod_capacity()]%</b> mod capacity remaining."
for(var/A in get_modkits())
var/obj/item/borg/upgrade/modkit/M = A
to_chat(user, "<span class='notice'>There is a [M.name] mod installed, using <b>[M.cost]%</b> capacity.</span>")
. += "<span class='notice'>There is a [M.name] mod installed, using <b>[M.cost]%</b> capacity.</span>"
/obj/item/gun/energy/kinetic_accelerator/attackby(obj/item/I, mob/user)
if(iscrowbar(I))
@@ -257,8 +258,9 @@
var/minebot_exclusive = FALSE
/obj/item/borg/upgrade/modkit/examine(mob/user)
if(..(user, 1))
to_chat(user, "<span class='notice'>Occupies <b>[cost]%</b> of mod capacity.</span>")
. = ..()
if(in_range(user, src))
. += "<span class='notice'>Occupies <b>[cost]%</b> of mod capacity.</span>"
/obj/item/borg/upgrade/modkit/attackby(obj/item/A, mob/user)
if(istype(A, /obj/item/gun/energy/kinetic_accelerator) && !issilicon(user))
@@ -159,9 +159,9 @@
can_charge = 0
/obj/item/gun/energy/plasmacutter/examine(mob/user)
..()
. = ..()
if(power_supply)
to_chat(user, "<span class='notice'>[src] is [round(power_supply.percent())]% charged.</span>")
. += "<span class='notice'>[src] is [round(power_supply.percent())]% charged.</span>"
/obj/item/gun/energy/plasmacutter/attackby(obj/item/A, mob/user)
if(istype(A, /obj/item/stack/sheet/mineral/plasma))
@@ -14,8 +14,9 @@
materials = list(MAT_METAL=2000)
/obj/item/gun/grenadelauncher/examine(mob/user)
if(..(user, 2))
to_chat(user, "<span class='notice'>[grenades.len] / [max_grenades] grenades.</span>")
. = ..()
if(get_dist(user, src) <= 2)
. += "<span class='notice'>[grenades.len] / [max_grenades] grenades.</span>"
/obj/item/gun/grenadelauncher/attackby(obj/item/I as obj, mob/user as mob, params)
if((istype(I, /obj/item/grenade)))
+2 -2
View File
@@ -18,8 +18,8 @@
..()
/obj/item/gun/magic/wand/examine(mob/user)
..()
to_chat(user, "Has [charges] charge\s remaining.")
. = ..()
. += "Has [charges] charge\s remaining."
/obj/item/gun/magic/wand/update_icon()
icon_state = "[initial(icon_state)][charges ? "" : "-drained"]"
+2 -2
View File
@@ -149,8 +149,8 @@
return
/obj/item/gun/projectile/examine(mob/user)
..()
to_chat(user, "Has [get_ammo()] round\s remaining.")
. = ..()
. += "Has [get_ammo()] round\s remaining."
/obj/item/gun/projectile/proc/get_ammo(countchambered = 1)
var/boolets = 0 //mature var names for mature people
@@ -84,8 +84,8 @@
return boolets
/obj/item/gun/projectile/revolver/examine(mob/user)
..()
to_chat(user, "[get_ammo(0,0)] of those are live rounds.")
. = ..()
. += "[get_ammo(0,0)] of those are live rounds."
/obj/item/gun/projectile/revolver/detective
desc = "A cheap Martian knock-off of a classic law enforcement firearm. Uses .38-special rounds."
@@ -467,7 +467,7 @@
f_name = "a "
f_name += "<span class='danger'>blood-stained</span> [name]!"
to_chat(user, "[bicon(src)] That's [f_name]")
. = list("[bicon(src)] That's [f_name]")
if(desc)
to_chat(user, desc)
. += desc
@@ -66,9 +66,9 @@
chambered = AC
/obj/item/gun/projectile/shotgun/examine(mob/user)
..()
. = ..()
if(chambered)
to_chat(user, "A [chambered.BB ? "live" : "spent"] one is in the chamber.")
. += "A [chambered.BB ? "live" : "spent"] one is in the chamber."
/obj/item/gun/projectile/shotgun/isHandgun() //You cannot, in fact, holster a shotgun.
return 0
@@ -239,8 +239,8 @@
. = ..()
/obj/item/gun/projectile/shotgun/boltaction/examine(mob/user)
..()
to_chat(user, "The bolt is [bolt_open ? "open" : "closed"].")
. = ..()
. += "The bolt is [bolt_open ? "open" : "closed"]."
/obj/item/gun/projectile/shotgun/boltaction/enchanted
name = "enchanted bolt action rifle"
+2 -2
View File
@@ -16,8 +16,8 @@
var/list/rockets = new/list()
/obj/item/gun/rocketlauncher/examine(mob/user)
..()
to_chat(user, "<span class='notice'>[rockets.len] / [max_rockets] rockets.</span>")
. = ..()
. += "<span class='notice'>[rockets.len] / [max_rockets] rockets.</span>"
/obj/item/gun/rocketlauncher/Destroy()
QDEL_LIST(rockets)
+2 -2
View File
@@ -46,8 +46,8 @@
..()
/obj/item/gun/syringe/examine(mob/user)
..()
to_chat(user, "Can hold [max_syringes] syringe\s. Has [syringes.len] syringe\s remaining.")
. = ..()
. += "Can hold [max_syringes] syringe\s. Has [syringes.len] syringe\s remaining."
/obj/item/gun/syringe/attack_self(mob/living/user as mob)
if(!syringes.len)
+5 -5
View File
@@ -12,7 +12,7 @@
var/projectile_speed = 1
var/projectile_range = 1
/obj/item/gun/throw/proc/notify_ammo_count(mob/user)
/obj/item/gun/throw/proc/notify_ammo_count()
return
/obj/item/gun/throw/proc/get_throwrange()
@@ -31,9 +31,9 @@
return count
/obj/item/gun/throw/examine(mob/user)
..()
to_chat(user, "<span class='notice'>It is [to_launch ? "loaded with \a [to_launch]" : "not loaded"].</span>")
notify_ammo_count(user)
. = ..()
. += "<span class='notice'>It is [to_launch ? "loaded with \a [to_launch]" : "not loaded"].</span>"
. += notify_ammo_count()
/obj/item/gun/throw/Destroy()
QDEL_NULL(to_launch)
@@ -53,7 +53,7 @@
to_chat(user, "<span class='notice'>You load [I] into [src].</span>")
if(!to_launch)
process_chamber()
notify_ammo_count(user)
to_chat(user, notify_ammo_count())
else
to_chat(user, "<span class='warning'>[src] cannot hold any more projectiles.</span>")
else
@@ -39,11 +39,11 @@
icon_state = "[initial(icon_state)]-drawn"
/obj/item/gun/throw/crossbow/examine(mob/user)
..()
. = ..()
if(cell)
to_chat(user, "<span class='notice'>\A [cell] is mounted onto [src]. Battery cell charge: [cell.charge]/[cell.maxcharge]")
. += "<span class='notice'>\A [cell] is mounted onto [src]. Battery cell charge: [cell.charge]/[cell.maxcharge]"
else
to_chat(user, "<span class='notice'>It has an empty mount for a battery cell.</span>")
. += "<span class='notice'>It has an empty mount for a battery cell.</span>"
/obj/item/gun/throw/crossbow/modify_projectile(obj/item/I, on_chamber = 0)
if(cell && on_chamber && istype(I, /obj/item/arrow/rod))
@@ -21,8 +21,8 @@
loaded_projectiles += P
process_chamber()
/obj/item/gun/throw/piecannon/notify_ammo_count(mob/user)
to_chat(user, "<span class='notice'>[src] has [get_ammocount()] of [max_capacity] pies left.")
/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()
if(to_launch)