From 578609b42a0ce0c324c94745697c94e612f2c084 Mon Sep 17 00:00:00 2001 From: Vi3trice <80771500+Vi3trice@users.noreply.github.com> Date: Fri, 2 Jun 2023 13:13:03 -0400 Subject: [PATCH] You brought this upon yourself botany (#21117) --- code/__DEFINES/flags.dm | 1 + .../game/objects/items/weapons/storage/storage_base.dm | 1 + code/modules/lighting/lighting_source.dm | 10 ++++++++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/code/__DEFINES/flags.dm b/code/__DEFINES/flags.dm index a0d3514d60f..d4972d13802 100644 --- a/code/__DEFINES/flags.dm +++ b/code/__DEFINES/flags.dm @@ -48,6 +48,7 @@ #define STATIONLOVING_2 16 #define INFORM_ADMINS_ON_RELOCATE_2 32 #define BANG_PROTECT_2 64 +#define BLOCKS_LIGHT_2 128 // Light sources placed in anything with that flag will not emit light through them. // A mob with OMNITONGUE has no restriction in the ability to speak // languages that they know. So even if they wouldn't normally be able to diff --git a/code/game/objects/items/weapons/storage/storage_base.dm b/code/game/objects/items/weapons/storage/storage_base.dm index 3fb011695fc..57b16883cf5 100644 --- a/code/game/objects/items/weapons/storage/storage_base.dm +++ b/code/game/objects/items/weapons/storage/storage_base.dm @@ -9,6 +9,7 @@ name = "storage" icon = 'icons/obj/storage.dmi' w_class = WEIGHT_CLASS_NORMAL + flags_2 = BLOCKS_LIGHT_2 /// No message on putting items in. var/silent = FALSE /// List of objects which this item can store (if set, it can't store anything else) diff --git a/code/modules/lighting/lighting_source.dm b/code/modules/lighting/lighting_source.dm index 7738f245874..c56b91fa172 100644 --- a/code/modules/lighting/lighting_source.dm +++ b/code/modules/lighting/lighting_source.dm @@ -32,7 +32,10 @@ /datum/light_source/New(atom/owner, atom/top) source_atom = owner // Set our new owner. LAZYADD(source_atom.light_sources, src) - top_atom = top + if(top.flags_2 & BLOCKS_LIGHT_2) // If the top atom blocks light, then our owner becomes the topmost instead. This still allows atoms that block light to be a light of their own. + top_atom = source_atom + else + top_atom = top if(top_atom != source_atom) LAZYADD(top_atom.light_sources, src) @@ -77,7 +80,10 @@ if(top_atom != source_atom && top_atom.light_sources) // Remove ourselves from the light sources of that top atom. LAZYREMOVE(top_atom.light_sources, src) - top_atom = new_top_atom + if(new_top_atom.flags_2 & BLOCKS_LIGHT_2) + top_atom = source_atom + else + top_atom = new_top_atom if(top_atom != source_atom) LAZYADD(top_atom.light_sources, src) // Add ourselves to the light sources of our new top atom.