Rewrite examine() to pass a list around

This commit is contained in:
Aronai Sieyes
2020-04-29 16:42:50 -04:00
committed by VirgoBot
parent 8c5c0a7cfb
commit 6ebd249748
214 changed files with 2021 additions and 1120 deletions
+3 -2
View File
@@ -68,8 +68,9 @@
/obj/item/weapon/fuel/examine(mob/user)
if(get_dist(src, user) <= 1)
to_chat(user, "A magnetic storage ring, it contains [fuel]kg of [content ? content : "nothing"].")
. = ..()
if(Adjacent(user))
. += "It contains [fuel]kg of [content ? content : "nothing"]."
/obj/item/weapon/fuel/proc/injest(mob/M as mob)
switch(content)
+13 -12
View File
@@ -251,29 +251,30 @@
src.update()
/obj/machinery/power/apc/examine(mob/user)
if(..(user, 1))
. = ..()
if(Adjacent(user))
if(stat & BROKEN)
to_chat(user, "This APC is broken.")
return
if(opened)
. += "This APC is broken."
else if(opened)
if(has_electronics && terminal)
to_chat(user, "The cover is [opened==2?"removed":"open"] and [ cell ? "a power cell is installed" : "the power cell is missing"].")
. += "The cover is [opened == 2 ? "removed" : "open"] and [ cell ? "a power cell is installed" : "the power cell is missing"]."
else if (!has_electronics && terminal)
to_chat(user, "The frame is wired, but the electronics are missing.")
. += "The frame is wired, but the electronics are missing."
else if (has_electronics && !terminal)
to_chat(user, "The electronics are installed, but not wired.")
. += "The electronics are installed, but not wired."
else /* if (!has_electronics && !terminal) */
to_chat(user, "It's just an empty metal frame.")
. += "It's just an empty metal frame."
else
if (wiresexposed)
to_chat(user, "The cover is closed and the wires are exposed.")
. += "The cover is closed and the wires are exposed."
else if ((locked && emagged) || hacker) //Some things can cause locked && emagged. Malf AI causes hacker.
to_chat(user, "The cover is closed, but the panel is unresponsive.")
. += "The cover is closed, but the panel is unresponsive."
else if(!locked && emagged) //Normal emag does this.
to_chat(user, "The cover is closed, but the panel is flashing an error.")
. += "The cover is closed, but the panel is flashing an error."
else
to_chat(user, "The cover is closed.")
. += "The cover is closed."
// update the APC icon to show the three base states
+4 -3
View File
@@ -6,6 +6,7 @@
/obj/machinery/power/breakerbox
name = "Breaker Box"
desc = "Large machine with heavy duty switching circuits used for advanced grid control."
icon = 'icons/obj/power.dmi'
icon_state = "bbox_off"
//directwired = 0
@@ -40,11 +41,11 @@
set_state(1)
/obj/machinery/power/breakerbox/examine(mob/user)
to_chat(user, "Large machine with heavy duty switching circuits used for advanced grid control")
. = ..()
if(on)
to_chat(user, "<font color='green'>It seems to be online.</font>")
. += "<span class='notice'>It seems to be online.</span>"
else
to_chat(user, "<font color='red'>It seems to be offline.</font>")
. += "<span class='warning'>It seems to be offline.</span>"
/obj/machinery/power/breakerbox/attack_ai(mob/user)
if(update_locked)
+8 -17
View File
@@ -609,20 +609,13 @@ obj/structure/cable/proc/cableColor(var/colorC)
w_class = ITEMSIZE_SMALL
/obj/item/stack/cable_coil/examine(mob/user)
var/msg = ""
. = ..()
if(get_amount() == 1)
msg += "A short piece of power cable."
. += "Just a short piece remains."
else if(get_amount() == 2)
msg += "A piece of power cable."
else
msg += "A coil of power cable."
if(get_dist(src, user) <= 1)
msg += " There are [get_amount()] lengths of cable in the coil."
to_chat(user, msg)
. += "Just a couple of short pieces remain."
else if(Adjacent(user))
. += "There are [get_amount()] lengths of cable in the coil."
/obj/item/stack/cable_coil/verb/make_restraint()
set name = "Make Cable Restraints"
@@ -992,12 +985,10 @@ obj/structure/cable/proc/cableColor(var/colorC)
return 0
/obj/item/stack/cable_coil/alien/examine(mob/user)
var/msg = "A spool of cable."
. = ..()
if(get_dist(src, user) <= 1)
msg += " It doesn't seem to have a beginning, or an end."
to_chat(user, msg)
if(Adjacent(user))
. += "It doesn't seem to have a beginning, or an end."
/obj/item/stack/cable_coil/alien/attack_hand(mob/user as mob)
if (user.get_inactive_hand() == src)
+4 -4
View File
@@ -145,10 +145,10 @@
/obj/item/weapon/cell/examine(mob/user)
..()
if(get_dist(src, user) <= 1)
to_chat(user, " It has a power rating of [maxcharge].\nThe charge meter reads [round(src.percent() )]%.")
return
. = ..()
if(Adjacent(user))
. += "It has a power rating of [maxcharge]."
. += "The charge meter reads [round(src.percent() )]%."
/obj/item/weapon/cell/attackby(obj/item/W, mob/user)
..()
+21 -21
View File
@@ -56,23 +56,22 @@ var/global/list/light_type_cache = list()
icon_state = "tube-empty"
/obj/machinery/light_construct/examine(mob/user)
if(!..(user, 2))
return
switch(src.stage)
if(1)
to_chat(user, "It's an empty frame.")
if(2)
to_chat(user, "It's wired.")
if(3)
to_chat(user, "The casing is closed.")
if(cell_connectors)
if(cell)
to_chat(user, "You see [cell] inside the casing.")
. = ..()
if(get_dist(user, src) <= 2)
switch(stage)
if(1)
. += "It's an empty frame."
if(2)
. += "It's wired."
if(3)
. += "The casing is closed."
if(cell_connectors)
if(cell)
. += "You see [cell] inside the casing."
else
. += "The casing has no power cell for backup power."
else
to_chat(user, "The casing has no power cell for backup power.")
else
to_chat(user, "<span class='danger'>This casing doesn't support power cells for backup power.</span>")
. += "<span class='danger'>This casing doesn't support power cells for backup power.</span>"
/obj/machinery/light_construct/attack_hand(mob/user)
. = ..()
@@ -485,18 +484,19 @@ var/global/list/light_type_cache = list()
// examine verb
/obj/machinery/light/examine(mob/user)
. = ..()
var/fitting = get_fitting_name()
switch(status)
if(LIGHT_OK)
to_chat(user, "[desc] It is turned [on? "on" : "off"].")
. += "It is turned [on? "on" : "off"]."
if(LIGHT_EMPTY)
to_chat(user, "[desc] The [fitting] has been removed.")
. += "The [fitting] has been removed."
if(LIGHT_BURNED)
to_chat(user, "[desc] The [fitting] is burnt out.")
. += "The [fitting] is burnt out."
if(LIGHT_BROKEN)
to_chat(user, "[desc] The [fitting] has been smashed.")
. += "The [fitting] has been smashed."
if(cell)
to_chat(user, "Its backup power charge meter reads [round((cell.charge / cell.maxcharge) * 100, 0.1)]%.")
. += "Its backup power charge meter reads [round((cell.charge / cell.maxcharge) * 100, 0.1)]%."
/obj/machinery/light/proc/get_fitting_name()
var/obj/item/weapon/light/L = light_type
+2 -2
View File
@@ -51,8 +51,8 @@
power_gen = round(initial(power_gen) * (max(2, temp_rating) / 2))
examine(mob/user)
..(user)
to_chat(user, "<font color='blue'>The generator has [P.air_contents.phoron] units of fuel left, producing [power_gen] per cycle.</font>")
. = ..()
. += "<span class='notice'>The generator has [P.air_contents.phoron] units of fuel left, producing [power_gen] per cycle.</span>"
handleInactive()
heat -= 2
+11 -11
View File
@@ -48,12 +48,12 @@
return
/obj/machinery/power/port_gen/examine(mob/user)
if(!..(user,1 ))
return
if(active)
to_chat(user, "<span class='notice'>The generator is on.</span>")
else
to_chat(user, "<span class='notice'>The generator is off.</span>")
. = ..()
if(Adjacent(user)) //It literally has a light on the sprite, are you sure this is necessary?
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
@@ -144,13 +144,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.")
. = ..()
. += "It 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'>It seems to have broken down.</span>"
if(overheating)
to_chat(user, "<span class='danger'>\The [src] is overheating!</span>")
. += "<span class='danger'>It is overheating!</span>"
/obj/machinery/power/port_gen/pacman/HasFuel()
var/needed_sheets = power_output / time_per_sheet
+3 -3
View File
@@ -103,9 +103,9 @@ var/global/list/rad_collectors = list()
return ..()
/obj/machinery/power/rad_collector/examine(mob/user)
if (..(user, 3))
to_chat(user, "The meter indicates that \the [src] is collecting [last_power] W.")
return 1
. = ..()
if(get_dist(user, src) <= 3)
. += "The meter indicates that it is collecting [last_power] W."
/obj/machinery/power/rad_collector/ex_act(severity)
switch(severity)
+4 -4
View File
@@ -267,15 +267,15 @@
qdel(src)
/obj/machinery/power/emitter/examine(mob/user)
..()
. = ..()
var/integrity_percentage = round((integrity / initial(integrity)) * 100)
switch(integrity_percentage)
if(0 to 30)
to_chat(user, "<span class='danger'>\The [src] is close to falling apart!</span>")
. += "<span class='danger'>It is close to falling apart!</span>"
if(31 to 70)
to_chat(user, "<span class='danger'>\The [src] is damaged.</span>")
. += "<span class='danger'>It is damaged.</span>"
if(77 to 99)
to_chat(user, "<span class='warning'>\The [src] is slightly damaged.</span>")
. += "<span class='warning'It is slightly damaged.</span>"
//R-UST port
/obj/machinery/power/emitter/proc/get_initial_fire_delay()
@@ -112,20 +112,17 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
return 1
/obj/structure/particle_accelerator/examine(mob/user)
switch(src.construction_state)
. = ..()
switch(construction_state)
if(0)
src.desc = text("A [name], looks like it's not attached to the flooring")
. += "Looks like it's not attached to the flooring."
if(1)
src.desc = text("A [name], it is missing some cables")
. += "It is missing some cables."
if(2)
src.desc = text("A [name], the panel is open")
. += "The panel is open."
if(3)
src.desc = text("The [name] is assembled")
if(powered)
src.desc = src.desc_holder
..()
return
. += "It is assembled."
/obj/structure/particle_accelerator/attackby(obj/item/W, mob/user)
if(istool(W))
@@ -295,19 +292,17 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
return
/obj/machinery/particle_accelerator/examine(mob/user)
switch(src.construction_state)
. = ..()
switch(construction_state)
if(0)
src.desc = text("A [name], looks like it's not attached to the flooring")
. += "Looks like it's not attached to the flooring."
if(1)
src.desc = text("A [name], it is missing some cables")
. += "It is missing some cables."
if(2)
src.desc = text("A [name], the panel is open")
. += "The panel is open."
if(3)
src.desc = text("The [name] is assembled")
if(powered)
src.desc = src.desc_holder
..()
return
. += "It is assembled."
/obj/machinery/particle_accelerator/attackby(obj/item/W, mob/user)
@@ -37,11 +37,11 @@
..()
/obj/machinery/particle_smasher/examine(mob/user)
..()
if(user in view(1))
to_chat(user, "<span class='notice'>\The [src] contains:</span>")
. = ..()
if(Adjacent(user))
. += "<span class='notice'>\The [src] contains:</span>"
for(var/obj/item/I in contents)
to_chat(user, "<span class='notice'>\the [I]</span>")
. += "<span class='notice'>\the [I]</span>"
/obj/machinery/particle_smasher/attackby(obj/item/W as obj, mob/user as mob)
if(W.type == /obj/item/device/analyzer)
+2 -3
View File
@@ -71,10 +71,9 @@
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].")
. += "The amount of orbiting mini-balls is [orbiting_balls.len]."
/obj/singularity/energy_ball/proc/move_the_basket_ball(var/move_amount)
//we face the last thing we zapped, so this lets us favor that direction a bit