Fixing crew monitor suit sensors (#51268)

* first steps

* Update _under.dm

* time for bug testing

* Update clothing.dm

* Update clothing.dm

* Update clothing.dm

* Update clothing.dm

* Update clothing.dm

* Update clothing.dm

* Update clothing.dm

* Update clothing.dm

* more fixes and implementation

* Update crew.dm

* Update clothing.dm

* more bug fixing

* Update crew.dm

* debugging

* Update clothing.dm

* Update clothing.dm

* Update clothing.dm

* added stuff to nanites

* goddamn nanites

* nanite cleanup

* Update crew.dm

* Update crew.dm
This commit is contained in:
MacBlaze1
2020-05-27 15:54:37 +08:00
committed by GitHub
parent e22bb7d202
commit 666e1e2653
5 changed files with 71 additions and 9 deletions
+2
View File
@@ -30,6 +30,8 @@ GLOBAL_LIST_INIT(simple_animals, list(list(),list(),list(),list())) // One for e
GLOBAL_LIST_EMPTY(spidermobs) //all sentient spider mobs
GLOBAL_LIST_EMPTY(bots_list)
GLOBAL_LIST_EMPTY(aiEyes)
GLOBAL_LIST_EMPTY(suit_sensors_list) //all people with suit sensors on
GLOBAL_LIST_EMPTY(nanite_sensors_list) //app people with nanite monitoring program
///underages who have been reported to security for trying to buy things they shouldn't, so they can't spam
GLOBAL_LIST_EMPTY(narcd_underages)
+45 -7
View File
@@ -121,19 +121,57 @@ GLOBAL_DATUM_INIT(crewmonitor, /datum/crewmonitor, new)
var/pos_y
var/life_status
for(var/i in GLOB.human_list)
for(var/i in GLOB.nanite_sensors_list)
var/mob/living/carbon/human/H = i
var/nanite_sensors = FALSE
if(H in SSnanites.nanite_monitored_mobs)
nanite_sensors = TRUE
// Check if their z-level is correct and if they are wearing a uniform.
// Accept H.z==0 as well in case the mob is inside an object.
if ((H.z == 0 || H.z == z) && (istype(H.w_uniform, /obj/item/clothing/under) || nanite_sensors))
if(((H.z == 0 || H.z == z) && (nanite_sensors)))
pos = H.z == 0 || (nanite_sensors) ? get_turf(H) : null
// Special case: If the mob is inside an object confirm the z-level on turf level.
if (H.z == 0 && (!pos || pos.z != z))
continue
I = H.wear_id ? H.wear_id.GetID() : null
if (I)
name = I.registered_name
assignment = I.assignment
ijob = jobs[I.assignment]
else
name = "Unknown"
assignment = ""
ijob = 80
life_status = (!H.stat ? TRUE : FALSE)
oxydam = round(H.getOxyLoss(),1)
toxdam = round(H.getToxLoss(),1)
burndam = round(H.getFireLoss(),1)
brutedam = round(H.getBruteLoss(),1)
if (!pos)
pos = get_turf(H)
area = get_area_name(H, TRUE)
pos_x = pos.x
pos_y = pos.y
results[++results.len] = list("name" = name, "assignment" = assignment, "ijob" = ijob, "life_status" = life_status, "oxydam" = oxydam, "toxdam" = toxdam, "burndam" = burndam, "brutedam" = brutedam, "area" = area, "pos_x" = pos_x, "pos_y" = pos_y, "can_track" = H.can_track(null))
for(var/i in GLOB.suit_sensors_list)
var/mob/living/carbon/human/H = i
// Check if their z-level is correct and if they are wearing a uniform.
// Accept H.z==0 as well in case the mob is inside an object. Nanite sensors come before normal sensors.
if((H.z == 0 || H.z == z) && (istype(H.w_uniform, /obj/item/clothing/under)) && !(H in GLOB.nanite_sensors_list))
U = H.w_uniform
// Are the suit sensors on?
if (nanite_sensors || ((U.has_sensor > 0) && U.sensor_mode))
pos = H.z == 0 || (nanite_sensors || U.sensor_mode == SENSOR_COORDS) ? get_turf(H) : null
if (((U.has_sensor > 0) && U.sensor_mode))
pos = H.z == 0 || (U.sensor_mode == SENSOR_COORDS) ? get_turf(H) : null
// Special case: If the mob is inside an object confirm the z-level on turf level.
if (H.z == 0 && (!pos || pos.z != z))
@@ -150,12 +188,12 @@ GLOBAL_DATUM_INIT(crewmonitor, /datum/crewmonitor, new)
assignment = ""
ijob = 80
if (nanite_sensors || U.sensor_mode >= SENSOR_LIVING)
if (U.sensor_mode >= SENSOR_LIVING)
life_status = (!H.stat ? TRUE : FALSE)
else
life_status = null
if (nanite_sensors || U.sensor_mode >= SENSOR_VITALS)
if (U.sensor_mode >= SENSOR_VITALS)
oxydam = round(H.getOxyLoss(),1)
toxdam = round(H.getToxLoss(),1)
burndam = round(H.getFireLoss(),1)
@@ -166,7 +204,7 @@ GLOBAL_DATUM_INIT(crewmonitor, /datum/crewmonitor, new)
burndam = null
brutedam = null
if (nanite_sensors || U.sensor_mode >= SENSOR_COORDS)
if (U.sensor_mode >= SENSOR_COORDS)
if (!pos)
pos = get_turf(H)
area = get_area_name(H, TRUE)
+14 -1
View File
@@ -294,7 +294,7 @@ BLIND // can't see anything
to_chat(usr, "<span class='warning'>You have moved too far away!</span>")
return
sensor_mode = modes.Find(switchMode) - 1
set_sensor_glob()
if (src.loc == usr)
switch(sensor_mode)
if(0)
@@ -411,3 +411,16 @@ BLIND // can't see anything
deconstruct(FALSE)
else
..()
/obj/item/clothing/proc/set_sensor_glob()
var/mob/living/carbon/human/H = src.loc
if (istype(H.w_uniform, /obj/item/clothing/under))
var/obj/item/clothing/under/U = H.w_uniform
if (((U.has_sensor && U.sensor_mode) && !(H in GLOB.suit_sensors_list) && U.has_sensor != BROKEN_SENSORS))
GLOB.suit_sensors_list |= H
else
GLOB.suit_sensors_list -= H
else
GLOB.suit_sensors_list -= H
+2 -1
View File
@@ -87,6 +87,7 @@
H.fan_hud_set_fandom()
if(attached_accessory.above_suit)
H.update_inv_wear_suit()
set_sensor_glob()
/obj/item/clothing/under/dropped(mob/user)
if(attached_accessory)
@@ -96,7 +97,7 @@
H.fan_hud_set_fandom()
if(attached_accessory.above_suit)
H.update_inv_wear_suit()
set_sensor_glob()
..()
/obj/item/clothing/under/proc/attach_accessory(obj/item/I, mob/user, notifyAttach = 1)
@@ -34,11 +34,19 @@
/datum/nanite_program/monitoring/enable_passive_effect()
. = ..()
SSnanites.nanite_monitored_mobs |= host_mob
if(ishuman(host_mob))
var/mob/living/carbon/human/H = host_mob
if(!(H in GLOB.nanite_sensors_list))
GLOB.nanite_sensors_list |= H
host_mob.hud_set_nanite_indicator()
/datum/nanite_program/monitoring/disable_passive_effect()
. = ..()
SSnanites.nanite_monitored_mobs -= host_mob
if(ishuman(host_mob))
var/mob/living/carbon/human/H = host_mob
GLOB.nanite_sensors_list -= H
host_mob.hud_set_nanite_indicator()
/datum/nanite_program/self_scan