This commit is contained in:
Ghommie
2020-05-24 04:00:51 +02:00
423 changed files with 6450 additions and 3566 deletions
+23 -9
View File
@@ -125,8 +125,10 @@
* * blind_message (optional) is what blind people will hear e.g. "You hear something!"
* * vision_distance (optional) define how many tiles away the message can be seen.
* * ignored_mobs (optional) doesn't show any message to any given mob in the list.
* * target (optional) is the other mob involved with the visible message. For example, the attacker in many combat messages.
* * target_message (optional) is what the target mob will see e.g. "[src] does something to you!"
*/
/atom/proc/visible_message(message, self_message, blind_message, vision_distance = DEFAULT_MESSAGE_RANGE, list/ignored_mobs)
/atom/proc/visible_message(message, self_message, blind_message, vision_distance = DEFAULT_MESSAGE_RANGE, list/ignored_mobs, mob/target, target_message)
var/turf/T = get_turf(src)
if(!T)
return
@@ -136,7 +138,19 @@
if(!islist(ignored_mobs))
ignored_mobs = list(ignored_mobs)
hearers -= ignored_mobs
if(self_message)
if(target_message && target && istype(target) && target.client)
hearers -= target
//This entire if/else chain could be in two lines but isn't for readibilties sake.
var/msg = target_message
if(target.see_invisible<invisibility) //if src is invisible to us,
msg = blind_message
//the light object is dark and not invisible to us, darkness does not matter if you're directly next to the target
else if(T.lighting_object && T.lighting_object.invisibility <= target.see_invisible && T.is_softly_lit() && !in_range(T,target))
msg = blind_message
if(msg)
target.show_message(msg, MSG_VISUAL,blind_message, MSG_AUDIBLE)
else if(self_message)
hearers -= src
for(var/mob/M in hearers)
if(!M.client)
@@ -155,9 +169,9 @@
M.show_message(msg, MSG_VISUAL,blind_message, MSG_AUDIBLE)
///Adds the functionality to self_message.
mob/visible_message(message, self_message, blind_message, vision_distance = DEFAULT_MESSAGE_RANGE, list/ignored_mobs)
mob/visible_message(message, self_message, blind_message, vision_distance = DEFAULT_MESSAGE_RANGE, list/ignored_mobs, mob/target, target_message)
. = ..()
if(self_message)
if(self_message && target != src)
show_message(self_message, MSG_VISUAL, blind_message, MSG_AUDIBLE)
/**
@@ -319,12 +333,12 @@ mob/visible_message(message, self_message, blind_message, vision_distance = DEFA
return
//view() but with a signal, to allow blacklisting some of the otherwise visible atoms.
/mob/proc/visible_atoms(dist = world.view)
/mob/proc/fov_view(dist = world.view)
. = view(dist, src)
SEND_SIGNAL(src, COMSIG_MOB_VISIBLE_ATOMS, .)
SEND_SIGNAL(src, COMSIG_MOB_FOV_VIEW, .)
//mob verbs are faster than object verbs. See https://secure.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 visible_atoms()) //It used to be oview(12), but I can't really say why
/mob/verb/examinate(atom/A as mob|obj|turf in fov_view()) //It used to be oview(12), but I can't really say why
set name = "Examine"
set category = "IC"
@@ -349,7 +363,7 @@ mob/visible_message(message, self_message, blind_message, vision_distance = DEFA
//note: ghosts can point, this is intended
//visible_message will handle invisibility properly
//overridden here and in /mob/dead/observer for different point span classes and sanity checks
/mob/verb/pointed(atom/A as mob|obj|turf in visible_atoms())
/mob/verb/pointed(atom/A as mob|obj|turf in fov_view())
set name = "Point To"
set category = "Object"
@@ -1041,7 +1055,7 @@ GLOBAL_VAR_INIT(exploit_warn_spam_prevention, 0)
///Adjust the nutrition of a mob
/mob/proc/adjust_nutrition(change, max = INFINITY) //Honestly FUCK the oldcoders for putting nutrition on /mob someone else can move it up because holy hell I'd have to fix SO many typechecks
nutrition = clamp(0, nutrition + change, max)
nutrition = clamp(nutrition + change, 0, max)
///Force set the mob nutrition
/mob/proc/set_nutrition(var/change) //Seriously fuck you oldcoders.