Split examine verb and function, and improve it (#17251)

* Split examine verb and function, and include adjacency and distance checking in examine function

* Fix various issues

* Update code/modules/mob/examinations.dm

Co-authored-by: SleepyGemmy <99297919+SleepyGemmy@users.noreply.github.com>

* Add required define vars

* Update code/game/objects/items/stacks/wrap.dm

Co-authored-by: SleepyGemmy <99297919+SleepyGemmy@users.noreply.github.com>

---------

Co-authored-by: SleepyGemmy <99297919+SleepyGemmy@users.noreply.github.com>
This commit is contained in:
Cody Brittain
2023-09-09 08:07:36 +00:00
committed by GitHub
co-authored by SleepyGemmy
parent 39228d3a2c
commit ce5ac79e3c
241 changed files with 617 additions and 518 deletions
+3 -2
View File
@@ -535,8 +535,9 @@
if (!mapload)
addtimer(CALLBACK(src, PROC_REF(update)), 5, TIMER_UNIQUE)
/obj/machinery/power/apc/examine(mob/user)
if(..(user, 1))
/obj/machinery/power/apc/examine(mob/user, distance, is_adjacent)
. = ..()
if(distance <= 1)
if(stat & BROKEN)
to_chat(user, "Looks broken.")
return
+1 -1
View File
@@ -41,7 +41,7 @@
set_state(1)
/obj/machinery/power/breakerbox/examine(mob/user)
..()
. = ..()
if(on)
to_chat(user, SPAN_GOOD("It seems to be online."))
else
+1 -1
View File
@@ -656,7 +656,7 @@ By design, d1 is the smallest direction and d2 is the highest
slot_flags = SLOT_BELT
/obj/item/stack/cable_coil/examine(mob/user)
..()
. = ..()
if(!uses_charge)
to_chat(user, "There [src.amount == 1 ? "is" : "are"] <b>[src.amount]</b> [src.singular_name]\s of cable in the coil.")
else
+2 -2
View File
@@ -81,10 +81,10 @@
return amount_used
/obj/item/cell/examine(mob/user)
/obj/item/cell/examine(mob/user, distance, is_adjacent)
. = ..()
if(get_dist(src, user) > 1)
if(distance > 1)
return
if(maxcharge <= 2500)
+2 -2
View File
@@ -28,8 +28,8 @@
QDEL_NULL(cell)
return ..()
/obj/machinery/light_construct/examine(mob/user)
if(!..(user, 2))
/obj/machinery/light_construct/examine(mob/user, distance, is_adjacent)
if(distance > 2)
return
switch(stage)
+5 -5
View File
@@ -66,8 +66,8 @@
icon_state = "[base_icon]_[active]"
return ..()
/obj/machinery/power/portgen/examine(mob/user)
if(!..(user, 1))
/obj/machinery/power/portgen/examine(mob/user, distance, is_adjacent)
if(distance > 1)
return
if(active)
to_chat(user, SPAN_NOTICE("The generator is on."))
@@ -160,8 +160,8 @@
power_gen = round(initial(power_gen) * (max(2, temp_rating) / 2))
/obj/machinery/power/portgen/basic/examine(mob/user)
..(user)
/obj/machinery/power/portgen/basic/examine(mob/user, distance, is_adjacent)
. = ..()
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.")
if(IsBroken()) to_chat(user, SPAN_WARNING("\The [src] seems to have broken down."))
@@ -490,7 +490,7 @@
create_reagents(coolant_volume)
..()
/obj/machinery/power/portgen/basic/fusion/examine(mob/user)
/obj/machinery/power/portgen/basic/fusion/examine(mob/user, distance, is_adjacent)
. = ..()
to_chat(user, "The auxilary tank shows [reagents.total_volume]u of liquid in it.")
+3 -3
View File
@@ -35,8 +35,8 @@
var/datum/effect_system/sparks/spark_system
/obj/machinery/power/emitter/examine(mob/user)
..()
/obj/machinery/power/emitter/examine(mob/user, distance, is_adjacent)
. = ..()
switch(state)
if(EMITTER_LOOSE)
to_chat(user, SPAN_NOTICE("\The [src] isn't attached to anything and is not ready to fire."))
@@ -44,7 +44,7 @@
to_chat(user, SPAN_NOTICE("\The [src] is bolted to the floor, but not yet ready to fire."))
if(EMITTER_WELDED)
to_chat(user, SPAN_WARNING("\The [src] is bolted and welded to the floor, and ready to fire."))
if(Adjacent(user))
if(is_adjacent)
to_chat(user, SPAN_NOTICE("The shot counter display reads: [shot_counter]"))
/obj/machinery/power/emitter/Destroy()
@@ -95,7 +95,7 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
desc = "[initial(desc)] It seems completely assembled."
if(powered)
desc = initial(desc)
..()
. = ..()
return
/obj/structure/particle_accelerator/attackby(obj/item/W, mob/user)
@@ -249,7 +249,7 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
desc = "[initial(desc)] It seems completely assembled."
if(powered)
desc = initial(desc)
..()
. = ..()
return
+2 -2
View File
@@ -15,9 +15,9 @@
var/ChargeCapacity = 5000000
var/IOCapacity = 250000
/obj/item/smes_coil/examine(mob/user)
/obj/item/smes_coil/examine(mob/user, distance, is_adjacent)
. = ..()
if(Adjacent(user))
if(is_adjacent)
to_chat(user, "The label reads:\
<div class='notice' style='padding-left:2rem'>Only certified professionals are allowed to handle and install this component.<br>\
Charge capacity: [ChargeCapacity/1000000] MJ<br>\
+1 -1
View File
@@ -70,7 +70,7 @@
..()
/obj/singularity/energy_ball/examine(mob/user)
..()
. = ..()
if(orbiting_balls.len)
to_chat(user, "There are [orbiting_balls.len] energy balls orbiting \the [src].")