examine signature changed to include distance

- 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.
This commit is contained in:
Spookerton
2024-01-31 13:49:52 +00:00
parent e3393dc87b
commit 978f4511a5
240 changed files with 524 additions and 551 deletions
+4 -4
View File
@@ -134,7 +134,7 @@ GLOBAL_LIST_EMPTY(apcs)
var/static/list/status_overlays_lighting
var/static/list/status_overlays_environ
var/alarms_hidden = FALSE //If power alarms from this APC are visible on consoles
var/nightshift_lights = FALSE
var/nightshift_setting = NIGHTSHIFT_AUTO
var/last_nightshift_switch = 0
@@ -271,9 +271,9 @@ GLOBAL_LIST_EMPTY(apcs)
spawn(5)
update()
/obj/machinery/power/apc/examine(mob/user)
/obj/machinery/power/apc/examine(mob/user, distance, infix, suffix)
. = ..()
if(Adjacent(user))
if(distance < 2)
if(stat & BROKEN)
. += "This APC is broken."
@@ -1387,4 +1387,4 @@ GLOBAL_LIST_EMPTY(apcs)
#undef APC_HAS_ELECTRONICS_NONE
#undef APC_HAS_ELECTRONICS_WIRED
#undef APC_HAS_ELECTRONICS_SECURED
#undef APC_HAS_ELECTRONICS_SECURED
+1 -1
View File
@@ -44,7 +44,7 @@
..()
set_state(1)
/obj/machinery/power/breakerbox/examine(mob/user)
/obj/machinery/power/breakerbox/examine(mob/user, distance, infix, suffix)
. = ..()
if(on)
. += "<span class='notice'>It seems to be online.</span>"
+3 -3
View File
@@ -110,7 +110,7 @@ var/global/list/possible_cable_coil_colours = list(
cable_list -= src //remove it from global cable list
return ..() // then go ahead and delete the cable
/obj/structure/cable/examine(mob/user)
/obj/structure/cable/examine(mob/user, distance, infix, suffix)
. = ..()
if(isobserver(user))
. += "<span class='warning'>[powernet?.avail > 0 ? "[DisplayPower(powernet.avail)] in power network." : "The cable is not powered."]</span>"
@@ -966,10 +966,10 @@ var/global/list/possible_cable_coil_colours = list(
/obj/item/stack/cable_coil/alien/update_wclass()
return 0
/obj/item/stack/cable_coil/alien/examine(mob/user)
/obj/item/stack/cable_coil/alien/examine(mob/user, distance, infix, suffix)
. = ..()
if(Adjacent(user))
if(distance < 2)
. += "It doesn't seem to have a beginning, or an end."
/obj/item/stack/cable_coil/alien/attack_hand(mob/user as mob)
+3 -3
View File
@@ -155,9 +155,9 @@
return amount_used
/obj/item/cell/examine(mob/user)
/obj/item/cell/examine(mob/user, distance, infix, suffix)
. = ..()
if(Adjacent(user))
if(distance < 2)
. += "It has a power rating of [maxcharge]."
. += "The charge meter reads [round(src.percent() )]%."
@@ -270,4 +270,4 @@
if (1000 to 50000-1)
return min(rand(10,20),rand(10,20))
else
return 0
return 0
+1 -1
View File
@@ -5,7 +5,7 @@
density = 1
var/show_extended_information = 1 // Set to 0 to disable extra information on examining (for example, when used on admin events)
/obj/machinery/power/debug_items/examine(mob/user)
/obj/machinery/power/debug_items/examine(mob/user, distance, infix, suffix)
. = ..()
if(show_extended_information)
. += show_info(user)
+3 -3
View File
@@ -55,9 +55,9 @@ var/global/list/light_type_cache = list()
if(3)
icon_state = "tube-empty"
/obj/machinery/light_construct/examine(mob/user)
/obj/machinery/light_construct/examine(mob/user, distance, infix, suffix)
. = ..()
if(get_dist(user, src) <= 2)
if(distance <= 2)
switch(stage)
if(1)
. += "It's an empty frame."
@@ -459,7 +459,7 @@ var/global/list/light_type_cache = list()
return cell
// examine verb
/obj/machinery/light/examine(mob/user)
/obj/machinery/light/examine(mob/user, distance, infix, suffix)
. = ..()
var/fitting = get_fitting_name()
switch(status)
+9 -10
View File
@@ -57,13 +57,12 @@
if(!anchored)
return
/obj/machinery/power/port_gen/examine(mob/user)
/obj/machinery/power/port_gen/examine(mob/user, distance, infix, suffix)
. = ..()
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>"
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
@@ -125,7 +124,7 @@
default_apply_parts()
if(anchored)
connect_to_network()
/obj/machinery/power/port_gen/pacman/Destroy()
DropFuel()
return ..()
@@ -145,7 +144,7 @@
power_gen = round(initial(power_gen) * (max(2, temp_rating) / 2))
/obj/machinery/power/port_gen/pacman/examine(mob/user)
/obj/machinery/power/port_gen/pacman/examine(mob/user, distance, infix, suffix)
. = ..()
. += "It appears to be producing [power_gen*power_output] W."
. += "There [sheets == 1 ? "is" : "are"] [sheets] sheet\s left in the hopper."
@@ -312,7 +311,7 @@
if(!ui)
ui = new(user, src, "PortableGenerator", name)
ui.open()
/obj/machinery/power/port_gen/pacman/tgui_data(mob/user)
var/list/data = list()
@@ -324,7 +323,7 @@
data["is_ai"] = TRUE
else
data["is_ai"] = FALSE
data["sheet_name"] = capitalize(sheet_name)
data["fuel_stored"] = round((sheets * 1000) + (sheet_left * 1000))
data["fuel_capacity"] = round(max_sheets * 1000, 0.1)
+2 -3
View File
@@ -102,9 +102,9 @@ var/global/list/rad_collectors = list()
return 1
return ..()
/obj/machinery/power/rad_collector/examine(mob/user)
/obj/machinery/power/rad_collector/examine(mob/user, distance, infix, suffix)
. = ..()
if(get_dist(user, src) <= 3)
if(distance <= 3)
. += "The meter indicates that it is collecting [last_power] W."
/obj/machinery/power/rad_collector/ex_act(severity)
@@ -157,4 +157,3 @@ var/global/list/rad_collectors = list()
flick("ca_deactive", src)
update_icons()
return
+2 -2
View File
@@ -266,7 +266,7 @@
if(src)
qdel(src)
/obj/machinery/power/emitter/examine(mob/user)
/obj/machinery/power/emitter/examine(mob/user, distance, infix, suffix)
. = ..()
var/integrity_percentage = round((integrity / initial(integrity)) * 100)
switch(integrity_percentage)
@@ -288,4 +288,4 @@
return burst_delay
/obj/machinery/power/emitter/proc/get_emitter_beam()
return new /obj/item/projectile/beam/emitter(get_turf(src))
return new /obj/item/projectile/beam/emitter(get_turf(src))
@@ -111,9 +111,9 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
src.set_dir(turn(src.dir, 90))
return 1
/obj/structure/particle_accelerator/examine(mob/user)
/obj/structure/particle_accelerator/examine(mob/user, distance, infix, suffix)
. = ..()
switch(construction_state)
if(0)
. += "Looks like it's not attached to the flooring."
@@ -290,9 +290,9 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
/obj/machinery/particle_accelerator/update_icon()
return
/obj/machinery/particle_accelerator/examine(mob/user)
/obj/machinery/particle_accelerator/examine(mob/user, distance, infix, suffix)
. = ..()
switch(construction_state)
if(0)
. += "Looks like it's not attached to the flooring."
@@ -36,9 +36,9 @@
recipes.Cut()
..()
/obj/machinery/particle_smasher/examine(mob/user)
/obj/machinery/particle_smasher/examine(mob/user, distance, infix, suffix)
. = ..()
if(Adjacent(user))
if(distance < 2)
. += "<span class='notice'>\The [src] contains:</span>"
for(var/obj/item/I in contents)
. += "<span class='notice'>\the [I]</span>"
@@ -378,4 +378,4 @@
required_atmos_temp_min = 3000
required_atmos_temp_max = 10000
probability = 1
probability = 1
+2 -2
View File
@@ -468,7 +468,7 @@ GLOBAL_LIST_EMPTY(smeses)
// Given the SMES creates another explosion on it's destruction it sounds fairly reasonable.
take_damage(250 / severity)
/obj/machinery/power/smes/examine(var/mob/user)
/obj/machinery/power/smes/examine(mob/user, distance, infix, suffix)
. = ..()
. += "<span class='filter_notice'>The service hatch is [panel_open ? "open" : "closed"].</span>"
if(!damage)
@@ -482,4 +482,4 @@ GLOBAL_LIST_EMPTY(smeses)
if(25 to 49)
. += "<span class='filter_notice'><span class='notice'>It's casing is quite seriously damaged.</span></span>"
if(0 to 24)
. += "<span class='filter_notice'>It's casing has some minor damage.</span>"
. += "<span class='filter_notice'>It's casing has some minor damage.</span>"
+1 -1
View File
@@ -67,7 +67,7 @@
else
energy = 0 // ensure we dont have miniballs of miniballs
/obj/singularity/energy_ball/examine(mob/user)
/obj/singularity/energy_ball/examine(mob/user, distance, infix, suffix)
. = ..()
if(orbiting_balls.len)
. += "The amount of orbiting mini-balls is [orbiting_balls.len]."