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
+2 -2
View File
@@ -79,7 +79,7 @@
icon_state = spent_icon
/obj/item/ammo_casing/examine(mob/user)
..()
. = ..()
if (!BB)
to_chat(user, "This one is spent.")
@@ -182,7 +182,7 @@
recyclable = FALSE
/obj/item/ammo_magazine/examine(mob/user)
..()
. = ..()
to_chat(user, "There [(stored_ammo.len == 1)? "is" : "are"] [stored_ammo.len] round\s left!")
//magazine icon state caching (caching lists are in SSicon_cache)
@@ -27,9 +27,9 @@
add_ammo(C)
addtimer(CALLBACK(src, PROC_REF(check_ammo)), 5) // if we don't have any ammo in 5 deciseconds, we're an empty pile, which is worthless, so self-delete
/obj/item/ammo_pile/examine(mob/user)
/obj/item/ammo_pile/examine(mob/user, distance, is_adjacent)
. = ..()
if(Adjacent(user))
if(is_adjacent)
to_chat(user, SPAN_NOTICE("It contains [length(ammo)] rounds."))
/obj/item/ammo_pile/attack()
+3 -3
View File
@@ -664,9 +664,9 @@
suppressor = null
update_icon()
/obj/item/gun/examine(mob/user)
..()
if(get_dist(src, user) > 1)
/obj/item/gun/examine(mob/user, distance, is_adjacent)
. = ..()
if(distance > 1)
return
if(markings)
to_chat(user, SPAN_NOTICE("It has [markings] [markings == 1 ? "notch" : "notches"] carved into the stock."))
+3 -3
View File
@@ -34,9 +34,9 @@
if (spikes < max_spikes)
addtimer(CALLBACK(src, PROC_REF(regen_spike)), spike_gen_time, TIMER_UNIQUE)
/obj/item/gun/launcher/spikethrower/examine(mob/user)
..(user)
if(get_dist(src, user) > 1)
/obj/item/gun/launcher/spikethrower/examine(mob/user, distance, is_adjacent)
. = ..()
if(distance > 1)
return
to_chat(user, "It has [spikes] spike\s remaining.")
+3 -3
View File
@@ -129,9 +129,9 @@
return null
/obj/item/gun/energy/examine(mob/user)
..(user)
if(get_dist(src, user) > 1)
/obj/item/gun/energy/examine(mob/user, distance, is_adjacent)
. = ..()
if(distance > 1)
return
var/shots_remaining = round(power_supply.charge / charge_cost)
to_chat(user, "Has [shots_remaining] shot\s remaining.")
@@ -21,9 +21,9 @@
charge_cost = 666.66 // 15 shots on a high cap cell
needspin = FALSE
/obj/item/gun/energy/plasmacutter/examine(mob/user)
/obj/item/gun/energy/plasmacutter/examine(mob/user, distance, is_adjacent)
..()
if(user.Adjacent(src))
if(is_adjacent)
if(power_supply)
to_chat(user, FONT_SMALL(SPAN_NOTICE("It has a <b>[capitalize_first_letters(power_supply.name)]</b> installed as its power supply.")))
else
@@ -30,9 +30,9 @@
var/named = 0
var/described = 0
/obj/item/gun/energy/laser/prototype/examine(mob/user)
..(user)
if(get_dist(src, user) > 1)
/obj/item/gun/energy/laser/prototype/examine(mob/user, distance, is_adjacent)
. = ..(user)
if(distance > 1)
return
if(gun_mods.len)
for(var/obj/item/laser_components/modifier/modifier in gun_mods)
@@ -220,7 +220,7 @@
icon_state = "crossbowframe[buildstate]"
/obj/item/crossbowframe/examine(mob/user)
..(user)
. = ..()
switch(buildstate)
if(1) to_chat(user, "It has a loose rod frame in place.")
if(2) to_chat(user, "It has a steel backbone welded in place.")
@@ -370,5 +370,4 @@
/obj/item/gun/launcher/crossbow/RFD/examine(var/user)
. = ..()
if(.)
to_chat(user, "It currently holds <b>[stored_matter]/[max_stored_matter]</b> matter-units.")
to_chat(user, "It currently holds <b>[stored_matter]/[max_stored_matter]</b> matter-units.")
@@ -43,9 +43,9 @@
to_chat(M, SPAN_WARNING("You pump [src], but the magazine is empty."))
update_icon()
/obj/item/gun/launcher/grenade/examine(mob/user)
/obj/item/gun/launcher/grenade/examine(mob/user, distance, is_adjacent)
. = ..()
if(Adjacent(user))
if(is_adjacent)
to_chat(user, SPAN_NOTICE("It has [get_ammo()] grenade\s remaining."))
if(chambered)
to_chat(user, SPAN_NOTICE("\A [chambered] is chambered."))
@@ -100,8 +100,9 @@
item_storage.remove_from_storage(launched, src)
return launched
/obj/item/gun/launcher/pneumatic/examine(mob/user)
if(!..(user, 2))
/obj/item/gun/launcher/pneumatic/examine(mob/user, distance, is_adjacent)
. = ..()
if(distance > 2)
return
to_chat(user, "The valve is dialed to [pressure_setting]%.")
if(tank)
@@ -152,7 +153,7 @@
icon_state = "pneumatic[buildstate]"
/obj/item/cannonframe/examine(mob/user)
..(user)
. = ..()
switch(buildstate)
if(1) to_chat(user, "It has a pipe segment installed.")
if(2) to_chat(user, "It has a pipe segment welded in place.")
@@ -19,8 +19,8 @@
var/max_rockets = 1
var/list/rockets = new/list()
/obj/item/gun/launcher/rocket/examine(mob/user)
if(!..(user, 2))
/obj/item/gun/launcher/rocket/examine(mob/user, distance, is_adjacent)
if(distance > 2)
return
to_chat(user, "<span class='notice'>[rockets.len] / [max_rockets] rockets.</span>")
+3 -3
View File
@@ -285,9 +285,9 @@
ammo_magazine = null
update_icon() //make sure to do this after unsetting ammo_magazine
/obj/item/gun/projectile/examine(mob/user)
..(user)
if(get_dist(src, user) > 1)
/obj/item/gun/projectile/examine(mob/user, distance, is_adjacent)
. = ..()
if(distance > 1)
return
if(jam_num)
to_chat(user, "<span class='warning'>It looks jammed.</span>")
@@ -347,7 +347,7 @@
icon_state = "carbine-empty"
/obj/item/gun/projectile/automatic/rifle/z8/examine(mob/user)
..()
. = ..()
if(launcher.chambered)
to_chat(user, "\The [launcher] has \a [launcher.chambered] loaded.")
else
@@ -98,7 +98,7 @@
fill_dart(dart)
/obj/item/gun/projectile/dartgun/examine(mob/user)
..()
. = ..()
if (beakers.len)
to_chat(user, "<span class='notice'>[src] contains:</span>")
for(var/obj/item/reagent_containers/glass/beaker/B in beakers)
@@ -53,7 +53,7 @@
..()
/obj/item/gun/projectile/shotgun/improvised/examine(mob/user)
..(user)
. = ..()
switch(fail_chance)
if(1) to_chat(user, "All craftsmanship is of the highest quality.")
if(2 to 25) to_chat(user, "All craftsmanship is of high quality.")
@@ -90,7 +90,7 @@
icon_state = "ishotgun[buildstate]"
/obj/item/receivergun/examine(mob/user)
..(user)
. = ..()
switch(buildstate)
if(1) to_chat(user, "It has a pipe segment installed.")
if(2) to_chat(user, "It has a stock installed.")
@@ -156,7 +156,7 @@
magazine_type = /obj/item/ammo_magazine/c45m
/obj/item/gun/projectile/improvised_handgun/examine(mob/user)
..(user)
. = ..()
switch(jam_chance)
if(1) to_chat(user, "All craftsmanship is of the highest quality.")
if(2 to 25) to_chat(user, "All craftsmanship is of high quality.")
@@ -168,7 +168,7 @@
icon_state = "ipistol[buildstate]"
/obj/item/stock/examine(mob/user)
..(user)
. = ..()
switch(buildstate)
if(1) to_chat(user, "It is carved in the shape of a pistol handle.")
if(2) to_chat(user, "It has a receiver installed.")
@@ -243,7 +243,7 @@
chamber_offset = rand(0,max_shells - loaded.len)
/obj/item/gun/projectile/revolver/lemat/examine(mob/user)
..()
. = ..()
if(secondary_loaded)
var/to_print
for(var/round in secondary_loaded)
+11 -13
View File
@@ -44,9 +44,9 @@
var/criticality
repair_item = /obj/item/weldingtool
/obj/item/laser_components/modifier/examine(mob/user)
. = ..(user, 1)
if(.)
/obj/item/laser_components/modifier/examine(mob/user, distance, is_adjacent)
. = ..()
if(distance <= 1)
if(malus > base_malus)
to_chat(user, "<span class='warning'>\The [src] appears damaged.</span>")
@@ -85,11 +85,10 @@
return 1
return 0
/obj/item/laser_components/capacitor/examine(mob/user)
. = ..(user, 1)
if(.)
if(condition > 0)
to_chat(user, "<span class='warning'>\The [src] appears damaged.</span>")
/obj/item/laser_components/capacitor/examine(mob/user, distance, is_adjacent)
. = ..()
if(distance <= 1 && condition > 0)
to_chat(user, "<span class='warning'>\The [src] appears damaged.</span>")
/obj/item/laser_components/capacitor/proc/small_fail(var/mob/user, var/obj/item/gun/energy/laser/prototype/prototype)
return
@@ -119,11 +118,10 @@
return 1
return 0
/obj/item/laser_components/focusing_lens/examine(mob/user)
. = ..(user, 1)
if(.)
if(condition > 0)
to_chat(user, "<span class='warning'>\The [src] appears damaged.</span>")
/obj/item/laser_components/focusing_lens/examine(mob/user, distance, is_adjacent)
. = ..()
if(distance <= 1 && condition > 0)
to_chat(user, "<span class='warning'>\The [src] appears damaged.</span>")
/obj/item/laser_components/modulator
name = "laser modulator"