Porting "Personal interaction messages to simple animals" and more. (#12268)
* Porting "Personal interaction messages to simple animals" and more. * Travis check. * doc * whoopsie. * )
This commit is contained in:
+18
-4
@@ -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)
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user