[MIRROR] Drones can now vent crawl around people [MDB IGNORE] (#10489)

* Drones can now vent crawl around people (#63854)

Also adds in the ability to whitelist machines with the shy component

* Drones can now vent crawl around people

Co-authored-by: Seth Scherer <supernovaa41@gmx.com>
This commit is contained in:
SkyratBot
2022-01-07 11:43:40 +00:00
committed by GitHub
co-authored by Seth Scherer
parent 803eb01652
commit de71b6d831
2 changed files with 18 additions and 6 deletions
+12 -5
View File
@@ -6,7 +6,9 @@
/// How close you are before you get shy
var/shy_range = 4
/// Typecache of mob types you are okay around
var/list/whitelist
var/list/mob_whitelist
/// Typecache of machines you can avoid being shy with
var/list/machine_whitelist = null
/// Message shown when you are is_shy
var/message = "You find yourself too shy to do that around %TARGET!"
/// Are you shy around a dead body?
@@ -16,16 +18,18 @@
/// What was our last result?
var/last_result = FALSE
/datum/component/shy/Initialize(whitelist, shy_range, message, dead_shy)
/datum/component/shy/Initialize(mob_whitelist, shy_range, message, dead_shy, machine_whitelist)
if(!ismob(parent))
return COMPONENT_INCOMPATIBLE
src.whitelist = whitelist
src.mob_whitelist = mob_whitelist
if(shy_range)
src.shy_range = shy_range
if(message)
src.message = message
if(dead_shy)
src.dead_shy = dead_shy
if(machine_whitelist)
src.machine_whitelist = machine_whitelist
/datum/component/shy/RegisterWithParent()
RegisterSignal(parent, COMSIG_MOB_CLICKON, .proc/on_clickon)
@@ -50,7 +54,7 @@
/datum/component/shy/InheritComponent(datum/component/shy/friend, i_am_original, list/arguments)
if(i_am_original)
shy_range = friend.shy_range
whitelist = friend.whitelist
mob_whitelist = friend.mob_whitelist
message = friend.message
/// Returns TRUE or FALSE if you are within shy_range tiles from a /mob/living
@@ -60,6 +64,9 @@
if(target in owner.DirectAccess())
return
for(var/type in machine_whitelist)
if(istype(target, type))
return
if(!COOLDOWN_FINISHED(src, result_cooldown))
return last_result
@@ -68,7 +75,7 @@
if(length(strangers) && locate(/mob/living) in strangers)
for(var/mob/living/person in strangers)
if(person != owner && !is_type_in_typecache(person, whitelist) && (person.stat != DEAD || dead_shy))
if(person != owner && !is_type_in_typecache(person, mob_whitelist) && (person.stat != DEAD || dead_shy))
to_chat(owner, span_warning("[replacetext(message, "%TARGET", person)]"))
result = TRUE
break