mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-24 21:40:55 +01:00
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:
co-authored by
SleepyGemmy
parent
39228d3a2c
commit
ce5ac79e3c
@@ -55,7 +55,7 @@
|
||||
airflow_speed = 0
|
||||
airflow_dest = null
|
||||
|
||||
/mob/abstract/eye/examinate()
|
||||
/mob/abstract/eye/ExaminateVerb()
|
||||
set popup_menu = 0
|
||||
set src = usr.contents
|
||||
return 0
|
||||
@@ -97,7 +97,7 @@
|
||||
/mob/abstract/eye/proc/setLoc(var/T)
|
||||
if(!owner)
|
||||
return FALSE
|
||||
|
||||
|
||||
T = get_turf(T)
|
||||
if(!T || T == loc)
|
||||
return FALSE
|
||||
@@ -108,7 +108,7 @@
|
||||
owner.client.eye = src
|
||||
if(owner_follows_eye)
|
||||
owner.forceMove(loc)
|
||||
|
||||
|
||||
visualnet.update_eye_chunks(src)
|
||||
return TRUE
|
||||
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/proc/examinate(mob/user, atom/target, show_extended = FALSE)
|
||||
if((user.is_blind() || user.stat) && isobserver(user))
|
||||
to_chat(user, SPAN_NOTICE("Something is there, but you cannot see it."))
|
||||
|
||||
user.face_atom(target)
|
||||
|
||||
var/distance = INFINITY
|
||||
var/is_adjacent = FALSE
|
||||
if(isobserver(user) || user.stat == DEAD)
|
||||
distance = 0
|
||||
is_adjacent = TRUE
|
||||
else
|
||||
var/turf/source_turf = get_turf(user)
|
||||
var/turf/target_turf = get_turf(target)
|
||||
if(source_turf && source_turf.z == target_turf?.z)
|
||||
distance = get_dist(source_turf, target_turf)
|
||||
is_adjacent = user.Adjacent(target)
|
||||
|
||||
SEND_SIGNAL(user, COMSIG_MOB_EXAMINATE, target)
|
||||
|
||||
if(!show_extended) //This won't last long. This will be passed into /examine later on
|
||||
if(!target.examine(user, distance, is_adjacent))
|
||||
crash_with("Improper /examine() override: [log_info_line(target)]")
|
||||
else
|
||||
if(!target.examine_fluff(user, distance, is_adjacent))
|
||||
crash_with("Improper /examine_fluff() override: [log_info_line(target)]")
|
||||
@@ -768,19 +768,19 @@
|
||||
var/obj/item/I = locate(href_list["lookitem"])
|
||||
if(!I)
|
||||
return
|
||||
src.examinate(I)
|
||||
examinate(src, I)
|
||||
|
||||
if (href_list["lookitem_desc_only"])
|
||||
var/obj/item/I = locate(href_list["lookitem_desc_only"])
|
||||
if(!I)
|
||||
return
|
||||
usr.examinate(I, 1)
|
||||
examinate(usr, I)
|
||||
|
||||
if (href_list["lookmob"])
|
||||
var/mob/M = locate(href_list["lookmob"])
|
||||
if(!M)
|
||||
return
|
||||
src.examinate(M)
|
||||
examinate(src, M)
|
||||
|
||||
if (href_list["flavor_change"])
|
||||
if(src != usr)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/mob/living/carbon/slime/examine(mob/user)
|
||||
..(user)
|
||||
. = ..()
|
||||
var/msg = ""
|
||||
if(src.stat == DEAD)
|
||||
msg += span("deadsay", "It is limp and unresponsive.\n")
|
||||
@@ -22,4 +22,4 @@
|
||||
|
||||
msg += "*---------*"
|
||||
to_chat(user, msg)
|
||||
return
|
||||
return
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/mob/living/silicon/pai/examine(mob/user)
|
||||
..(user, infix = ", personal AI")
|
||||
/mob/living/silicon/pai/examine(mob/user, distance, is_adjacent)
|
||||
. = ..(user, distance, is_adjacent, infix = ", personal AI")
|
||||
|
||||
var/msg = ""
|
||||
switch(src.stat)
|
||||
@@ -16,4 +16,4 @@
|
||||
pose = addtext(pose,".") //Makes sure all emotes end with a period.
|
||||
msg += "\nIt [pose]"
|
||||
|
||||
to_chat(user, msg)
|
||||
to_chat(user, msg)
|
||||
|
||||
@@ -577,7 +577,7 @@
|
||||
gib()
|
||||
|
||||
/mob/living/silicon/robot/drone/examine(mob/user)
|
||||
..()
|
||||
. = ..()
|
||||
|
||||
/mob/living/silicon/robot/drone/self_diagnosis()
|
||||
if(!is_component_functioning("diagnosis unit"))
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
visible_message(SPAN_NOTICE("\The [src] voices a strident beep, indicating a drone chassis is prepared."))
|
||||
|
||||
/obj/machinery/drone_fabricator/examine(mob/user)
|
||||
..(user)
|
||||
. = ..()
|
||||
if(produce_drones && drone_progress >= 100 && istype(user,/mob/abstract) && config.allow_drone_spawn && count_drones() < config.max_maint_drones)
|
||||
to_chat(user, SPAN_NOTICE("<B>A drone is prepared. use 'Ghost Spawner' from the Ghost tab to spawn as a maintenance drone.</B>"))
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/mob/living/silicon/robot/examine(mob/user)
|
||||
/mob/living/silicon/robot/examine(mob/user, distance, is_adjacent)
|
||||
var/custom_infix = custom_name ? ", [mod_type] [braintype]" : ""
|
||||
..(user, infix = custom_infix)
|
||||
. = ..(user, distance, is_adjacent, infix = custom_infix)
|
||||
|
||||
var/msg = ""
|
||||
|
||||
@@ -47,4 +47,4 @@
|
||||
msg += "\nIt [pose]"
|
||||
|
||||
to_chat(user, msg)
|
||||
user.showLaws(src)
|
||||
user.showLaws(src)
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
var/force_holder
|
||||
|
||||
/obj/item/gripper/examine(var/mob/user)
|
||||
..()
|
||||
. = ..()
|
||||
if(wrapped)
|
||||
to_chat(user, SPAN_NOTICE("It is holding \the [wrapped]"))
|
||||
|
||||
|
||||
@@ -16,9 +16,9 @@
|
||||
. = ..()
|
||||
files = new /datum/research/techonly(src) //Setup the research data holder.
|
||||
|
||||
/obj/item/portable_destructive_analyzer/examine(mob/user, distance)
|
||||
/obj/item/portable_destructive_analyzer/examine(mob/user, distance, is_adjacent)
|
||||
. = ..()
|
||||
if(loaded_item && Adjacent(user))
|
||||
if(loaded_item && is_adjacent)
|
||||
to_chat(user, SPAN_NOTICE("It is holding \a [loaded_item]."))
|
||||
|
||||
/obj/item/portable_destructive_analyzer/attack_self(mob/user)
|
||||
|
||||
@@ -20,8 +20,7 @@
|
||||
stored_doors = max_doors
|
||||
|
||||
/obj/item/inflatable_dispenser/examine(mob/user)
|
||||
if(!..(user))
|
||||
return
|
||||
. = ..()
|
||||
to_chat(user, SPAN_NOTICE("It has [stored_walls] wall segment\s and [stored_doors] door segment\s stored."))
|
||||
to_chat(user, SPAN_NOTICE("It is set to deploy [mode ? "doors" : "walls"]"))
|
||||
|
||||
|
||||
@@ -28,9 +28,9 @@
|
||||
else
|
||||
name = "robot [initial(name)]"
|
||||
|
||||
/obj/item/robot_parts/examine(mob/user, distance)
|
||||
/obj/item/robot_parts/examine(mob/user, distance, is_adjacent)
|
||||
. = ..()
|
||||
if(Adjacent(user))
|
||||
if(is_adjacent)
|
||||
report_missing_parts(user)
|
||||
|
||||
/obj/item/robot_parts/proc/report_missing_parts(var/mob/user)
|
||||
|
||||
@@ -105,7 +105,7 @@
|
||||
return ..()
|
||||
|
||||
/mob/living/simple_animal/construct/examine(mob/user)
|
||||
..(user)
|
||||
. = ..()
|
||||
if(health < maxHealth)
|
||||
if(health >= maxHealth / 2)
|
||||
to_chat(user, SPAN_WARNING("It looks slightly dented."))
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
..()
|
||||
|
||||
/mob/living/simple_animal/capybara/examine(mob/user)
|
||||
..()
|
||||
. = ..()
|
||||
if(stat == DEAD)
|
||||
to_chat(user, "How can someone kill such a friendly creature?")
|
||||
|
||||
|
||||
@@ -290,7 +290,7 @@
|
||||
holder_type = /obj/item/holder/cat/black
|
||||
|
||||
/mob/living/simple_animal/cat/fluff/examine(mob/user)
|
||||
..()
|
||||
. = ..()
|
||||
if(stat == DEAD)
|
||||
to_chat(user, "Oh no, [name] is dead! What kind of monster would do this?")
|
||||
|
||||
@@ -306,7 +306,7 @@
|
||||
holder_type = /obj/item/holder/cat/kitten
|
||||
|
||||
/mob/living/simple_animal/cat/kitten/examine(mob/user)
|
||||
..()
|
||||
. = ..()
|
||||
if(stat == DEAD)
|
||||
to_chat(user, "It's a dead kitten! What kind of monster would do this?")
|
||||
|
||||
@@ -353,6 +353,6 @@
|
||||
holder_type = /obj/item/holder/cat/crusher
|
||||
|
||||
/mob/living/simple_animal/cat/crusher/examine(mob/user)
|
||||
..()
|
||||
. = ..()
|
||||
if(stat == DEAD)
|
||||
to_chat(user, "Crusher's dead. How could this have happened? She counted on you!")
|
||||
|
||||
@@ -312,7 +312,7 @@
|
||||
return 0
|
||||
|
||||
/mob/living/simple_animal/spiderbot/examine(mob/user)
|
||||
..(user)
|
||||
. = ..()
|
||||
if(src.held_item)
|
||||
to_chat(user, "It is carrying [icon2html(src.held_item, user)] \a [src.held_item].")
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
qdel(src)
|
||||
|
||||
/mob/living/simple_animal/hostile/icarus_drone/examine(mob/user)
|
||||
..()
|
||||
. = ..()
|
||||
if(malfunctioning)
|
||||
if(hostile_drone)
|
||||
to_chat(user, SPAN_WARNING("It's completely lit up, and its targetting vanes are deployed."))
|
||||
|
||||
@@ -99,10 +99,10 @@
|
||||
else
|
||||
see_invisible = SEE_INVISIBLE_NOLIGHTING
|
||||
|
||||
/mob/living/simple_animal/hostile/morph/examine(mob/user)
|
||||
/mob/living/simple_animal/hostile/morph/examine(mob/user, distance, is_adjacent)
|
||||
if(morphed)
|
||||
. = form.examine(user)
|
||||
if(get_dist(src, user) > 2)
|
||||
if(distance > 2)
|
||||
return
|
||||
to_chat(user, SPAN_WARNING("It doesn't look quite right..."))
|
||||
else
|
||||
|
||||
@@ -29,9 +29,9 @@
|
||||
|
||||
// Because we can't perfectly duplicate some examine() output, we directly examine the AM it is copying. It's messy but
|
||||
// this is to prevent easy checks from the opposing force.
|
||||
/mob/living/simple_animal/illusion/examine(mob/user)
|
||||
/mob/living/simple_animal/illusion/examine(mob/user, distance, is_adjacent)
|
||||
if(copying)
|
||||
return copying.examine(user)
|
||||
return copying.examine(user, distance, is_adjacent)
|
||||
else
|
||||
return list("???")
|
||||
|
||||
|
||||
@@ -210,7 +210,7 @@
|
||||
..()
|
||||
|
||||
/mob/living/simple_animal/examine(mob/user)
|
||||
..()
|
||||
. = ..()
|
||||
|
||||
if (stat == DEAD)
|
||||
to_chat(user, "<span class='danger'>It looks dead.</span>")
|
||||
|
||||
+2
-10
@@ -360,19 +360,11 @@
|
||||
mob_win.open()
|
||||
|
||||
//mob verbs are faster than object verbs. See http://www.byond.com/forum/?post=1326139&page=2#comment8198716 for why this isn't atom/verb/examine()
|
||||
/mob/verb/examinate(atom/A as mob|obj|turf in view())
|
||||
/mob/verb/ExaminateVerb(atom/A as mob|obj|turf in view())
|
||||
set name = "Examine"
|
||||
set category = "IC"
|
||||
|
||||
if(!A)
|
||||
return
|
||||
|
||||
if((is_blind() || usr.stat) && !isobserver(src))
|
||||
to_chat(src, "<span class='notice'>Something is there but you can't see it.</span>")
|
||||
return 1
|
||||
|
||||
face_atom(A)
|
||||
A.examine(src)
|
||||
examinate(usr, A)
|
||||
|
||||
/mob/proc/can_examine()
|
||||
if(client?.eye == src)
|
||||
|
||||
Reference in New Issue
Block a user