From fb2b259d921f16e266f6451d158ff4368ff21a51 Mon Sep 17 00:00:00 2001
From: Ghommie <42542238+Ghommie@users.noreply.github.com>
Date: Thu, 19 Dec 2019 17:17:18 +0100
Subject: [PATCH 1/2] Ports "Refactors can_see_reagents"
---
code/__DEFINES/is_helpers.dm | 2 ++
code/__DEFINES/obj_flags.dm | 1 +
code/_globalvars/bitfields.dm | 1 +
code/modules/clothing/clothing.dm | 1 -
code/modules/clothing/glasses/_glasses.dm | 6 +++---
code/modules/clothing/spacesuits/hardsuit.dm | 4 ++--
code/modules/mob/living/carbon/carbon.dm | 11 +++++++++-
.../mob/living/carbon/human/human_helpers.dm | 11 ++++++++--
.../simple_animal/friendly/drone/_drone.dm | 9 +++++++++
code/modules/mob/mob.dm | 20 -------------------
code/modules/mob/mob_helpers.dm | 4 ++++
11 files changed, 41 insertions(+), 29 deletions(-)
diff --git a/code/__DEFINES/is_helpers.dm b/code/__DEFINES/is_helpers.dm
index 6f433374e7..68f293377e 100644
--- a/code/__DEFINES/is_helpers.dm
+++ b/code/__DEFINES/is_helpers.dm
@@ -222,6 +222,8 @@ GLOBAL_LIST_INIT(heavyfootmob, typecacheof(list(
#define isorgan(A) (istype(A, /obj/item/organ))
+#define isclothing(A) (istype(A, /obj/item/clothing))
+
GLOBAL_LIST_INIT(pointed_types, typecacheof(list(
/obj/item/pen,
/obj/item/screwdriver,
diff --git a/code/__DEFINES/obj_flags.dm b/code/__DEFINES/obj_flags.dm
index 94c2c372f0..831f73ac74 100644
--- a/code/__DEFINES/obj_flags.dm
+++ b/code/__DEFINES/obj_flags.dm
@@ -41,6 +41,7 @@
#define VOICEBOX_TOGGLABLE (1<<6) //The voicebox in this clothing can be toggled.
#define VOICEBOX_DISABLED (1<<7) //The voicebox is currently turned off.
#define IGNORE_HAT_TOSS (1<<8) //Hats with negative effects when worn (i.e the tinfoil hat).
+#define SCAN_REAGENTS (1<<9) // Allows helmets and glasses to scan reagents.
// Flags for the organ_flags var on /obj/item/organ
diff --git a/code/_globalvars/bitfields.dm b/code/_globalvars/bitfields.dm
index e0cf8ebdd5..bf179760c0 100644
--- a/code/_globalvars/bitfields.dm
+++ b/code/_globalvars/bitfields.dm
@@ -143,6 +143,7 @@ GLOBAL_LIST_INIT(bitfields, list(
"VOICEBOX_TOGGLABLE" = VOICEBOX_TOGGLABLE,
"VOICEBOX_DISABLED" = VOICEBOX_DISABLED,
"IGNORE_HAT_TOSS" = IGNORE_HAT_TOSS,
+ "SCAN_REAGENTS" = SCAN_REAGENTS
),
"tesla_flags" = list(
"TESLA_MOB_DAMAGE" = TESLA_MOB_DAMAGE,
diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm
index dc9e46c4b4..2b6b262395 100644
--- a/code/modules/clothing/clothing.dm
+++ b/code/modules/clothing/clothing.dm
@@ -22,7 +22,6 @@
var/cooldown = 0
var/obj/item/flashlight/F = null
var/can_flashlight = 0
- var/scan_reagents = 0 //Can the wearer see reagents while it's equipped?
var/blocks_shove_knockdown = FALSE //Whether wearing the clothing item blocks the ability for shove to knock down.
diff --git a/code/modules/clothing/glasses/_glasses.dm b/code/modules/clothing/glasses/_glasses.dm
index 206165a495..1a178158d8 100644
--- a/code/modules/clothing/glasses/_glasses.dm
+++ b/code/modules/clothing/glasses/_glasses.dm
@@ -99,7 +99,7 @@
desc = "A pair of snazzy goggles used to protect against chemical spills. Fitted with an analyzer for scanning items and reagents."
icon_state = "purple"
item_state = "glasses"
- scan_reagents = TRUE //You can see reagents while wearing science goggles
+ clothing_flags = SCAN_REAGENTS //You can see reagents while wearing science goggles
actions_types = list(/datum/action/item_action/toggle_research_scanner)
glass_colour_type = /datum/client_colour/glass_colour/purple
resistance_flags = ACID_PROOF
@@ -203,7 +203,7 @@
/obj/item/clothing/glasses/sunglasses/reagent
name = "beer goggles"
desc = "A pair of sunglasses outfitted with apparatus to scan reagents."
- scan_reagents = TRUE
+ clothing_flags = SCAN_REAGENTS
/obj/item/clothing/glasses/sunglasses/garb
name = "black gar glasses"
@@ -405,7 +405,7 @@
item_state = "godeye"
vision_flags = SEE_TURFS|SEE_MOBS|SEE_OBJS
darkness_view = 8
- scan_reagents = TRUE
+ clothing_flags = SCAN_REAGENTS
lighting_alpha = LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE
resistance_flags = LAVA_PROOF | FIRE_PROOF
diff --git a/code/modules/clothing/spacesuits/hardsuit.dm b/code/modules/clothing/spacesuits/hardsuit.dm
index c6eac4ac56..771e1c9534 100644
--- a/code/modules/clothing/spacesuits/hardsuit.dm
+++ b/code/modules/clothing/spacesuits/hardsuit.dm
@@ -445,7 +445,7 @@
flash_protect = 0
armor = list("melee" = 30, "bullet" = 5, "laser" = 10, "energy" = 5, "bomb" = 10, "bio" = 100, "rad" = 60, "fire" = 60, "acid" = 75)
flags_inv = HIDEMASK|HIDEEARS|HIDEEYES|HIDEFACE|HIDEHAIR|HIDEFACIALHAIR
- scan_reagents = TRUE
+ clothing_flags = STOPSPRESSUREDAMAGE | THICKMATERIAL | BLOCK_GAS_SMOKE_EFFECT | ALLOWINTERNALS | SCAN_REAGENTS
/obj/item/clothing/suit/space/hardsuit/medical
icon_state = "hardsuit-medical"
@@ -467,7 +467,7 @@
max_heat_protection_temperature = FIRE_SUIT_MAX_TEMP_PROTECT
armor = list("melee" = 30, "bullet" = 5, "laser" = 10, "energy" = 5, "bomb" = 100, "bio" = 100, "rad" = 60, "fire" = 60, "acid" = 80)
var/obj/machinery/doppler_array/integrated/bomb_radar
- scan_reagents = TRUE
+ clothing_flags = STOPSPRESSUREDAMAGE | THICKMATERIAL | BLOCK_GAS_SMOKE_EFFECT | ALLOWINTERNALS | SCAN_REAGENTS
actions_types = list(/datum/action/item_action/toggle_helmet_light, /datum/action/item_action/toggle_research_scanner)
/obj/item/clothing/head/helmet/space/hardsuit/rd/Initialize()
diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm
index 3a9495a5cb..b2dd4c8515 100644
--- a/code/modules/mob/living/carbon/carbon.dm
+++ b/code/modules/mob/living/carbon/carbon.dm
@@ -960,4 +960,13 @@
/mob/living/carbon/transfer_ckey(mob/new_mob, send_signal = TRUE)
if(combatmode)
toggle_combat_mode(TRUE, TRUE)
- return ..()
\ No newline at end of file
+ return ..()
+
+/mob/living/carbon/can_see_reagents()
+ . = ..()
+ if(.) //No need to run through all of this if it's already true.
+ return
+ if(isclothing(head) && (head.clothing_flags & SCAN_REAGENTS))
+ return TRUE
+ if(isclothing(wear_mask) && (wear_mask.clothing_flags & SCAN_REAGENTS))
+ return TRUE
diff --git a/code/modules/mob/living/carbon/human/human_helpers.dm b/code/modules/mob/living/carbon/human/human_helpers.dm
index 63d02af31a..e5e546fdf8 100644
--- a/code/modules/mob/living/carbon/human/human_helpers.dm
+++ b/code/modules/mob/living/carbon/human/human_helpers.dm
@@ -117,7 +117,8 @@
/mob/living/carbon/human/can_use_guns(obj/item/G)
. = ..()
-
+ if(!.)
+ return
if(G.trigger_guard == TRIGGER_GUARD_NORMAL)
if(HAS_TRAIT(src, TRAIT_CHUNKYFINGERS))
to_chat(src, "Your meaty finger is much too large for the trigger guard!")
@@ -126,7 +127,13 @@
to_chat(src, "Your fingers don't fit in the trigger guard!")
return FALSE
- return .
+/mob/living/carbon/human/can_see_reagents()
+ . = ..()
+ if(.) //No need to run through all of this if it's already true.
+ return
+ if(isclothing(glasses) && (glasses.clothing_flags & SCAN_REAGENTS))
+ return TRUE
+
/*
/mob/living/carbon/human/transfer_blood_dna(list/blood_dna)
..()
diff --git a/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm b/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm
index 7e0e43055f..4b3e7dba39 100644
--- a/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm
+++ b/code/modules/mob/living/simple_animal/friendly/drone/_drone.dm
@@ -274,3 +274,12 @@
/mob/living/simple_animal/drone/electrocute_act(shock_damage, obj/source, siemens_coeff = 1, safety = 0, tesla_shock = 0, illusion = 0, stun = TRUE)
return 0 //So they don't die trying to fix wiring
+
+/mob/living/simple_animal/drone/can_see_reagents()
+ . = ..()
+ if(.)
+ return
+ if(isclothing(head))
+ var/obj/item/clothing/H = head
+ if(H.clothing_flags & SCAN_REAGENTS)
+ return TRUE
diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm
index a47ea9d5a0..67d0ee5249 100644
--- a/code/modules/mob/mob.dm
+++ b/code/modules/mob/mob.dm
@@ -813,26 +813,6 @@ GLOBAL_VAR_INIT(exploit_warn_spam_prevention, 0)
/mob/proc/can_interact_with(atom/A)
return IsAdminGhost(src) || Adjacent(A)
-//Can the mob see reagents inside of containers?
-/mob/proc/can_see_reagents()
- if(stat == DEAD) //Ghosts and such can always see reagents
- return 1
- if(has_unlimited_silicon_privilege) //Silicons can automatically view reagents
- return 1
- if(ishuman(src))
- var/mob/living/carbon/human/H = src
- if(H.head && istype(H.head, /obj/item/clothing))
- var/obj/item/clothing/CL = H.head
- if(CL.scan_reagents)
- return 1
- if(H.wear_mask && H.wear_mask.scan_reagents)
- return 1
- if(H.glasses && istype(H.glasses, /obj/item/clothing))
- var/obj/item/clothing/CL = H.glasses
- if(CL.scan_reagents)
- return 1
- return 0
-
//Can the mob use Topic to interact with machines
/mob/proc/canUseTopic(atom/movable/M, be_close=FALSE, no_dextery=FALSE, no_tk=FALSE)
return
diff --git a/code/modules/mob/mob_helpers.dm b/code/modules/mob/mob_helpers.dm
index c18fc36e9a..18fc2bfb42 100644
--- a/code/modules/mob/mob_helpers.dm
+++ b/code/modules/mob/mob_helpers.dm
@@ -532,3 +532,7 @@ It's fairly easy to fix if dealing with single letters but not so much with comp
if(!held_item)
return
return held_item.GetID()
+
+//Can the mob see reagents inside of containers?
+/mob/proc/can_see_reagents()
+ return stat == DEAD || has_unlimited_silicon_privilege //Dead guys and silicons can always see reagents
From a46982efe387638b69290144223509f75e57988c Mon Sep 17 00:00:00 2001
From: Ghommie <42542238+Ghommie@users.noreply.github.com>
Date: Thu, 19 Dec 2019 17:40:22 +0100
Subject: [PATCH 2/2] F
---
code/modules/clothing/spacesuits/hardsuit.dm | 2 +-
code/modules/mob/living/carbon/carbon.dm | 6 ++++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/code/modules/clothing/spacesuits/hardsuit.dm b/code/modules/clothing/spacesuits/hardsuit.dm
index 771e1c9534..cc172e5bad 100644
--- a/code/modules/clothing/spacesuits/hardsuit.dm
+++ b/code/modules/clothing/spacesuits/hardsuit.dm
@@ -638,7 +638,7 @@
armor = list("melee" = 20, "bullet" = 15, "laser" = 15, "energy" = 45, "bomb" = 100, "bio" = 100, "rad" = 100, "fire" = 100, "acid" = 100)
item_color = "ancient"
brightness_on = 16
- scan_reagents = TRUE
+ clothing_flags = STOPSPRESSUREDAMAGE | THICKMATERIAL | BLOCK_GAS_SMOKE_EFFECT | ALLOWINTERNALS | SCAN_REAGENTS
flash_protect = 5 //We will not be flash by bombs
tint = 1
var/obj/machinery/doppler_array/integrated/bomb_radar
diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm
index b2dd4c8515..391e459435 100644
--- a/code/modules/mob/living/carbon/carbon.dm
+++ b/code/modules/mob/living/carbon/carbon.dm
@@ -966,7 +966,9 @@
. = ..()
if(.) //No need to run through all of this if it's already true.
return
- if(isclothing(head) && (head.clothing_flags & SCAN_REAGENTS))
- return TRUE
+ if(isclothing(head))
+ var/obj/item/clothing/H = head
+ if(H.clothing_flags & SCAN_REAGENTS)
+ return TRUE
if(isclothing(wear_mask) && (wear_mask.clothing_flags & SCAN_REAGENTS))
return TRUE