Skip to content

Commit

Permalink
examine signature changed to include distance
Browse files Browse the repository at this point in the history
- distance is INFINITE, 0, or a positive integer based on get_dist() between
the examiner and examinee's turfs when they are on the same Z. When the
examiner is dead or a ghost, distance is always 0.
- also updates /examine( implementations to use it!
- adds w_class_to_name proc for reusing "It is a X item." examine behavior.
  • Loading branch information
Spookerton committed Jan 31, 2024
1 parent e3393dc commit 978f451
Show file tree
Hide file tree
Showing 240 changed files with 524 additions and 551 deletions.
4 changes: 2 additions & 2 deletions code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,9 @@

return 1

/obj/machinery/atmospherics/binary/dp_vent_pump/examine(mob/user)
/obj/machinery/atmospherics/binary/dp_vent_pump/examine(mob/user, distance, infix, suffix)
. = ..()
if(Adjacent(user))
if(distance < 2)
. += "A small gauge in the corner reads [round(last_flow_rate, 0.1)] L/s; [round(last_power_draw)] W"


Expand Down
2 changes: 1 addition & 1 deletion code/ATMOSPHERICS/components/shutoff.dm
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ GLOBAL_LIST_EMPTY(shutoff_valves)
/obj/machinery/atmospherics/valve/shutoff/update_icon()
icon_state = "vclamp[open]"

/obj/machinery/atmospherics/valve/shutoff/examine(var/mob/user)
/obj/machinery/atmospherics/valve/shutoff/examine(mob/user, distance, infix, suffix)
. = ..()
. += "The automatic shutoff circuit is [close_on_leaks ? "enabled" : "disabled"]."

Expand Down
4 changes: 2 additions & 2 deletions code/ATMOSPHERICS/components/unary/cold_sink.dm
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
/obj/machinery/atmospherics/unary/freezer/tgui_act(action, params)
if(..())
return TRUE

. = TRUE
switch(action)
if("toggleStatus")
Expand Down Expand Up @@ -169,7 +169,7 @@

..()

/obj/machinery/atmospherics/unary/freezer/examine(mob/user)
/obj/machinery/atmospherics/unary/freezer/examine(mob/user, distance, infix, suffix)
. = ..()
if(panel_open)
. += "The maintenance hatch is open."
2 changes: 1 addition & 1 deletion code/ATMOSPHERICS/components/unary/heat_source.dm
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@

..()

/obj/machinery/atmospherics/unary/heater/examine(mob/user)
/obj/machinery/atmospherics/unary/heater/examine(mob/user, distance, infix, suffix)
. = ..()
if(panel_open)
. += "The maintenance hatch is open."
6 changes: 3 additions & 3 deletions code/ATMOSPHERICS/components/unary/vent_pump.dm
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@
soundloop.stop()
return 0
if(!use_power)
soundloop.stop()
soundloop.stop()
return 0
if(welded)
soundloop.stop()
Expand Down Expand Up @@ -400,9 +400,9 @@
else
..()

/obj/machinery/atmospherics/unary/vent_pump/examine(mob/user)
/obj/machinery/atmospherics/unary/vent_pump/examine(mob/user, distance, infix, suffix)
. = ..()
if(Adjacent(user))
if(distance < 2)
. += "A small gauge in the corner reads [round(last_flow_rate, 0.1)] L/s; [round(last_power_draw)] W"
else
. += "You are too far away to read the gauge."
Expand Down
4 changes: 2 additions & 2 deletions code/ATMOSPHERICS/components/unary/vent_scrubber.dm
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,9 @@
"You hear a ratchet.")
deconstruct()

/obj/machinery/atmospherics/unary/vent_scrubber/examine(mob/user)
/obj/machinery/atmospherics/unary/vent_scrubber/examine(mob/user, distance, infix, suffix)
. = ..()
if(Adjacent(user))
if(distance < 2)
. += "A small gauge in the corner reads [round(last_flow_rate, 0.1)] L/s; [round(last_power_draw)] W"
else
. += "You are too far away to read the gauge."
2 changes: 1 addition & 1 deletion code/ATMOSPHERICS/components/valve.dm
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,6 @@
"You hear a ratchet.")
deconstruct()

/obj/machinery/atmospherics/valve/examine(mob/user)
/obj/machinery/atmospherics/valve/examine(mob/user, distance, infix, suffix)
. = ..()
. += "It is [open ? "open" : "closed"]."
2 changes: 1 addition & 1 deletion code/__defines/dcs/signals.dm
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
#define COMSIG_ATOM_HULK_ATTACK "hulk_attack"
///from base of atom/animal_attack(): (/mob/user)
#define COMSIG_ATOM_ATTACK_ANIMAL "attack_animal"
///from base of atom/examine(): (/mob)
///from base of atom/examine(mob/user, distance, infix, suffix): (/mob)
#define COMSIG_PARENT_EXAMINE "atom_examine"
///from base of atom/get_examine_name(): (/mob, list/overrides)
#define COMSIG_ATOM_GET_EXAMINE_NAME "atom_examine_name"
Expand Down
2 changes: 1 addition & 1 deletion code/game/atoms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ var/global/list/pre_init_created_atoms // atom creation ordering means some stuf
/atom/proc/get_examine_desc()
return desc

/atom/proc/examine(mob/user, infix = "", suffix = "")
/atom/proc/examine(mob/user, distance, infix = "", suffix = "")
var/f_name = "\a [src][infix]."
if (blood_DNA && !istype(src, /obj/effect/decal))
if (gender == PLURAL)
Expand Down
4 changes: 2 additions & 2 deletions code/game/gamemodes/cult/ritual.dm
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ var/global/list/rnwords = list("ire","ego","nahlizet","certum","veri","jatkaa","
rune_list.Remove(src)
..()

/obj/effect/rune/examine(mob/user)
/obj/effect/rune/examine(mob/user, distance, infix, suffix)
. = ..()
if(iscultist(user))
. += "This spell circle reads: <i>[word1] [word2] [word3]</i>."
Expand Down Expand Up @@ -425,7 +425,7 @@ var/global/list/rnwords = list("ire","ego","nahlizet","certum","veri","jatkaa","
to_chat(user, "The book seems full of illegible scribbles. Is this a joke?")
return

/obj/item/book/tome/examine(mob/user)
/obj/item/book/tome/examine(mob/user, distance, infix, suffix)
. = ..()
if(!iscultist(user))
. += "An old, dusty tome with frayed edges and a sinister looking cover."
Expand Down
14 changes: 7 additions & 7 deletions code/game/gamemodes/nuclear/pinpointer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@
/obj/item/pinpointer/process()
if(!active)
return PROCESS_KILL

if(!the_disk)
the_disk = locate()
if(!the_disk)
icon_state = "pinonnull"
return

set_dir(get_dir(src,the_disk))

switch(get_dist(src,the_disk))
if(0)
icon_state = "pinondirect"
Expand All @@ -52,7 +52,7 @@
if(16 to INFINITY)
icon_state = "pinonfar"

/obj/item/pinpointer/examine(mob/user)
/obj/item/pinpointer/examine(mob/user, distance, infix, suffix)
. = ..()
for(var/obj/machinery/nuclearbomb/bomb in machines)
if(bomb.timing)
Expand Down Expand Up @@ -299,10 +299,10 @@

if(loc.z != our_shuttle.z) //If you are on a different z-level from the shuttle
icon_state = "pinonnull"

else
set_dir(get_dir(src, our_shuttle))

switch(get_dist(src, our_shuttle))
if(0)
icon_state = "pinondirect"
Expand All @@ -318,4 +318,4 @@
shuttle_comp_id = "Mercenary"

/obj/item/pinpointer/shuttle/heist
shuttle_comp_id = "Skipjack"
shuttle_comp_id = "Skipjack"
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
one has been provided to allow you to leave your hideout."
uses = 1

/obj/item/disposable_teleporter/examine(mob/user)
/obj/item/disposable_teleporter/examine(mob/user, distance, infix, suffix)
. = ..()
. += "[uses] uses remaining."

Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/CableLayer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
else
to_chat(usr, "<span class='warning'>There's no more cable on the reel.</span>")

/obj/machinery/cablelayer/examine(mob/user)
/obj/machinery/cablelayer/examine(mob/user, distance, infix, suffix)
. = ..()
. += "[src]'s cable reel has [cable.amount] length\s left."

Expand Down
7 changes: 2 additions & 5 deletions code/game/machinery/atmoalter/meter.dm
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,12 @@
)
radio_connection.post_signal(src, signal)

/obj/machinery/meter/examine(mob/user)
/obj/machinery/meter/examine(mob/user, distance, infix, suffix)
. = ..()

if(get_dist(user, src) > 3 && !(istype(user, /mob/living/silicon/ai) || istype(user, /mob/observer/dead)))
if(distance > 3 && !(istype(user, /mob/living/silicon/ai) || istype(user, /mob/observer/dead)))
. += "<span class='warning'>You are too far away to read it.</span>"

else if(stat & (NOPOWER|BROKEN))
. += "<span class='warning'>The display is off.</span>"

else if(target)
var/datum/gas_mixture/environment = target.return_air()
if(environment)
Expand Down
6 changes: 3 additions & 3 deletions code/game/machinery/cell_charger.dm
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
else
cut_overlays()

/obj/machinery/cell_charger/examine(mob/user)
/obj/machinery/cell_charger/examine(mob/user, distance, infix, suffix)
. = ..()
if(get_dist(user, src) <= 5)
if(distance <= 5)
. += "[charging ? "[charging]" : "Nothing"] is in [src]."
if(charging)
. += "Current charge: [charging.charge] / [charging.maxcharge]"
Expand Down Expand Up @@ -128,4 +128,4 @@
var/E = 0
for(var/obj/item/stock_parts/capacitor/C in component_parts)
E += C.rating
efficiency = active_power_usage * (1+ (E - 1)*0.5)
efficiency = active_power_usage * (1+ (E - 1)*0.5)
2 changes: 1 addition & 1 deletion code/game/machinery/cloning.dm
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@
read_only = !read_only
to_chat(user, "You flip the write-protect tab to [read_only ? "protected" : "unprotected"].")

/obj/item/disk/data/examine(mob/user)
/obj/item/disk/data/examine(mob/user, distance, infix, suffix)
. = ..()
. += "The write-protect tab is set to [read_only ? "protected" : "unprotected"]."

Expand Down
4 changes: 2 additions & 2 deletions code/game/machinery/computer/arcade.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1033,9 +1033,9 @@
w_class = ITEMSIZE_SMALL
var/active = 0 //if the ship is on

/obj/item/orion_ship/examine(mob/user)
/obj/item/orion_ship/examine(mob/user, distance, infix, suffix)
. = ..()
if(in_range(user, src))
if(distance < 2)
if(!active)
. += span("notice", "There's a little switch on the bottom. It's flipped down.")
else
Expand Down
4 changes: 2 additions & 2 deletions code/game/machinery/computer/guestpass.dm
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
else
return temp_access

/obj/item/card/id/guest/examine(mob/user)
/obj/item/card/id/guest/examine(mob/user, distance, infix, suffix)
. = ..()
if (world.time < expiration_time)
. += "<span class='notice'>This pass expires at [worldtime2stationtime(expiration_time)].</span>"
Expand Down Expand Up @@ -244,4 +244,4 @@
to_chat(usr, "<span class='warning'>Cannot issue pass without issuing ID.</span>")

src.add_fingerprint(usr)
SSnanoui.update_uis(src)
SSnanoui.update_uis(src)
2 changes: 1 addition & 1 deletion code/game/machinery/doors/door.dm
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@
return


/obj/machinery/door/examine(mob/user)
/obj/machinery/door/examine(mob/user, distance, infix, suffix)
. = ..()
if(src.health <= 0)
. += "It is broken!"
Expand Down
9 changes: 3 additions & 6 deletions code/game/machinery/doors/firedoor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
if(F != src)
log_debug("Duplicate firedoors at [x],[y],[z]")
return INITIALIZE_HINT_QDEL

var/area/A = get_area(src)
ASSERT(istype(A))

Expand All @@ -78,15 +78,12 @@
/obj/machinery/door/firedoor/get_material()
return get_material_by_name(DEFAULT_WALL_MATERIAL)

/obj/machinery/door/firedoor/examine(mob/user)
/obj/machinery/door/firedoor/examine(mob/user, distance, infix, suffix)
. = ..()

if(!Adjacent(user))
if(distance > 1)
return .

if(pdiff >= FIREDOOR_MAX_PRESSURE_DIFF)
. += "<span class='warning'>WARNING: Current pressure differential is [pdiff]kPa! Opening door may result in injury!</span>"

. += "<b>Sensor readings:</b>"
for(var/index = 1; index <= tile_info.len; index++)
var/o = "&nbsp;&nbsp;"
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/fire_alarm.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ FIRE ALARM
/obj/machinery/firealarm/alarms_hidden
alarms_hidden = TRUE

/obj/machinery/firealarm/examine()
/obj/machinery/firealarm/examine(mob/user, distance, infix, suffix)
. = ..()
. += "Current security level: [seclevel]"

Expand Down
4 changes: 2 additions & 2 deletions code/game/machinery/floorlayer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
return
..()

/obj/machinery/floorlayer/examine(mob/user)
/obj/machinery/floorlayer/examine(mob/user, distance, infix, suffix)
. = ..()
var/dismantle = mode["dismantle"]
var/laying = mode["laying"]
Expand Down Expand Up @@ -107,4 +107,4 @@

/obj/machinery/floorlayer/proc/CollectTiles(var/turf/w_turf)
for(var/obj/item/stack/tile/tile in w_turf)
TakeTile(tile)
TakeTile(tile)
2 changes: 1 addition & 1 deletion code/game/machinery/frame.dm
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@
anchored = TRUE
density = TRUE

/obj/structure/frame/examine(mob/user)
/obj/structure/frame/examine(mob/user, distance, infix, suffix)
. = ..()
if(circuit)
. += "It has \a [circuit] installed."
Expand Down
6 changes: 2 additions & 4 deletions code/game/machinery/iv_drip.dm
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,10 @@
mode = !mode
to_chat(usr, "The IV drip is now [mode ? "injecting" : "taking blood"].")

/obj/machinery/iv_drip/examine(mob/user)
/obj/machinery/iv_drip/examine(mob/user, distance, infix, suffix)
. = ..()

if(get_dist(user, src) <= 2)
if(distance < 3)
. += "The IV drip is [mode ? "injecting" : "taking blood"]."

if(beaker)
if(beaker.reagents?.reagent_list?.len)
. += "<span class='notice'>Attached is \a [beaker] with [beaker.reagents.total_volume] units of liquid.</span>"
Expand Down
6 changes: 3 additions & 3 deletions code/game/machinery/lightswitch.dm
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@
add_overlay(overlay)
set_light(2, 0.1, on ? "#82FF4C" : "#F86060")

/obj/machinery/light_switch/examine(mob/user)
/obj/machinery/light_switch/examine(mob/user, distance, infix, suffix)
. = ..()
if(Adjacent(user))
if(distance < 2)
. += "A light switch. It is [on? "on" : "off"]."

/obj/machinery/light_switch/attack_hand(mob/user)
Expand Down Expand Up @@ -84,4 +84,4 @@
..(severity)
return
power_change()
..(severity)
..(severity)
2 changes: 1 addition & 1 deletion code/game/machinery/oxygen_pump.dm
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@
if(istype(W, /obj/item/tank) && !stat)
to_chat(user, "<span class='warning'>Please open the maintenance hatch first.</span>")

/obj/machinery/oxygen_pump/examine(var/mob/user)
/obj/machinery/oxygen_pump/examine(mob/user, distance, infix, suffix)
. = ..()
if(tank)
. += "The meter shows [round(tank.air_contents.return_pressure())] kPa."
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/pipe/pipelayer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@

..()

/obj/machinery/pipelayer/examine(mob/user)
/obj/machinery/pipelayer/examine(mob/user, distance, infix, suffix)
. = ..()
. += "[src] has [metal] sheet\s, is set to produce [P_type_t], and auto-dismantling is [!a_dis?"de":""]activated."

Expand Down
Loading

0 comments on commit 978f451

Please sign in to comment.