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
+11 -12
View File
@@ -229,27 +229,26 @@
addtimer(CALLBACK(src, .proc/update), 5)
/obj/machinery/power/apc/examine(mob/user)
if(..(user, 1))
. = ..()
if(in_range(user, src))
if(stat & BROKEN)
to_chat(user, "Looks broken.")
return
if(opened)
. += "Looks broken."
else if(opened)
if(has_electronics && terminal)
to_chat(user, "The cover is [opened==2?"removed":"open"] and the power cell is [ cell ? "installed" : "missing"].")
. += "The cover is [opened==2?"removed":"open"] and the power cell is [ cell ? "installed" : "missing"]."
else if(!has_electronics && terminal)
to_chat(user, "There are some wires but no electronics.")
. += "There are some wires but no electronics."
else if(has_electronics && !terminal)
to_chat(user, "Electronics installed but not wired.")
. += "Electronics installed but not wired."
else /* if(!has_electronics && !terminal) */
to_chat(user, "There is no electronics nor connected wires.")
. += "There is no electronics nor connected wires."
else
if(stat & MAINT)
to_chat(user, "The cover is closed. Something wrong with it: it doesn't work.")
. += "The cover is closed. Something wrong with it: it doesn't work."
else if(malfhack)
to_chat(user, "The cover is broken. It may be hard to force it open.")
. += "The cover is broken. It may be hard to force it open."
else
to_chat(user, "The cover is closed.")
. += "The cover is closed."
// update the APC icon to show the three base states
// also add overlays for indicator lights
+8 -9
View File
@@ -595,15 +595,14 @@ GLOBAL_LIST_INIT(cable_coil_recipes, list (new/datum/stack_recipe("cable restrai
w_class = WEIGHT_CLASS_SMALL
/obj/item/stack/cable_coil/examine(mob/user)
if(!..(user, 1))
return
if(get_amount() == 1)
to_chat(user, "A short piece of power cable.")
else if(get_amount() == 2)
to_chat(user, "A piece of power cable.")
else
to_chat(user, "A coil of power cable. There are [get_amount()] lengths of cable in the coil.")
. = ..()
if(in_range(user, src))
if(get_amount() == 1)
. += "A short piece of power cable."
else if(get_amount() == 2)
. += "A piece of power cable."
else
. += "A coil of power cable. There are [get_amount()] lengths of cable in the coil."
// Items usable on a cable coil :
// - Wirecutters : cut them duh !
+3 -3
View File
@@ -85,11 +85,11 @@
return power_used
/obj/item/stock_parts/cell/examine(mob/user)
..()
. = ..()
if(rigged)
to_chat(user, "<span class='danger'>This power cell seems to be faulty!</span>")
. += "<span class='danger'>This power cell seems to be faulty!</span>"
else
to_chat(user, "The charge meter reads [round(percent() )]%.")
. += "The charge meter reads [round(percent() )]%."
/obj/item/stock_parts/cell/suicide_act(mob/user)
to_chat(viewers(user), "<span class='suicide'>[user] is licking the electrodes of the [src]! It looks like [user.p_theyre()] trying to commit suicide.</span>")
+12 -10
View File
@@ -28,14 +28,15 @@
icon_state = "bulb-construct-stage1"
/obj/machinery/light_construct/examine(mob/user)
if(..(user, 2))
switch(src.stage)
. = ..()
if(get_dist(user, src) <= 2)
switch(stage)
if(1)
to_chat(usr, "It's an empty frame.")
. += "It's an empty frame."
if(2)
to_chat(usr, "It's wired.")
. += "It's wired."
if(3)
to_chat(usr, "The casing is closed.")
. += "The casing is closed."
/obj/machinery/light_construct/attackby(obj/item/W as obj, mob/living/user as mob, params)
src.add_fingerprint(user)
@@ -284,16 +285,17 @@
// examine verb
/obj/machinery/light/examine(mob/user)
if(..(user, 1))
. = ..()
if(in_range(user, src))
switch(status)
if(LIGHT_OK)
to_chat(user, "[desc] It is turned [on? "on" : "off"].")
. += "[desc] It is turned [on? "on" : "off"]."
if(LIGHT_EMPTY)
to_chat(user, "[desc] The [fitting] has been removed.")
. += "[desc] The [fitting] has been removed."
if(LIGHT_BURNED)
to_chat(user, "[desc] The [fitting] is burnt out.")
. += "[desc] The [fitting] is burnt out."
if(LIGHT_BROKEN)
to_chat(user, "[desc] The [fitting] has been smashed.")
. += "[desc] The [fitting] has been smashed."
+11 -11
View File
@@ -52,12 +52,12 @@
return
/obj/machinery/power/port_gen/examine(mob/user)
if(!..(user,1 ))
return
if(active)
to_chat(usr, "<span class='notice'>The generator is on.</span>")
else
to_chat(usr, "<span class='notice'>The generator is off.</span>")
. = ..()
if(!in_range(user, src))
if(active)
. += "<span class='notice'>The generator is on.</span>"
else
. += "<span class='notice'>The generator is off.</span>"
/obj/machinery/power/port_gen/emp_act(severity)
var/duration = 6000 //ten minutes
@@ -154,13 +154,13 @@
power_gen = round(initial(power_gen) * (max(2, temp_rating) / 2))
/obj/machinery/power/port_gen/pacman/examine(mob/user)
..(user)
to_chat(user, "\The [src] appears to be producing [power_gen*power_output] W.")
to_chat(user, "There [sheets == 1 ? "is" : "are"] [sheets] sheet\s left in the hopper.")
. = ..()
. += "\The [src] appears to be producing [power_gen*power_output] W."
. += "There [sheets == 1 ? "is" : "are"] [sheets] sheet\s left in the hopper."
if(IsBroken())
to_chat(user, "<span class='warning'>\The [src] seems to have broken down.</span>")
. += "<span class='warning'>\The [src] seems to have broken down.</span>"
if(overheating)
to_chat(user, "<span class='danger'>\The [src] is overheating!</span>")
. += "<span class='danger'>\The [src] is overheating!</span>"
/obj/machinery/power/port_gen/pacman/HasFuel()
var/needed_sheets = power_output / time_per_sheet
@@ -133,7 +133,7 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
desc = text("The [name] is assembled")
if(powered)
desc = desc_holder
..(user)
. = ..()
/obj/structure/particle_accelerator/attackby(obj/item/W, mob/user, params)
if(istool(W))
+4 -3
View File
@@ -57,9 +57,10 @@
energy = 0 // ensure we dont have miniballs of miniballs
/obj/singularity/energy_ball/examine(mob/user)
..()
if(orbiting_balls.len)
to_chat(user, "The amount of orbiting mini-balls is [orbiting_balls.len].")
. = ..()
var/len = LAZYLEN(orbiting_balls)
if(len)
. += "The amount of orbiting mini-balls is [len]."
/obj/singularity/energy_ball/proc/move_the_basket_ball(var/move_amount)
+2 -2
View File
@@ -168,8 +168,8 @@
update_icon()
/obj/machinery/treadmill_monitor/examine(mob/user)
..()
to_chat(user, "The display reads:<div style='text-align: center'>[line1]<br>[line2]</div>")
. = ..()
. += "The display reads:<div style='text-align: center'>[line1]<br>[line2]</div>"
/obj/machinery/treadmill_monitor/update_icon()
overlays.Cut()