[MIRROR] Fix light eater affecting lava, space, openspace, and transparent turfs [MDB IGNORE] (#24826)

* Fix light eater affecting lava, space, openspace, and transparent turfs (#79393)

## About The Pull Request
Fixes #79388

Light eater element can no longer affect lava, space (starlight),
openspace, or any turf with transparency.

## Why It's Good For The Game
Better consistency.

## Changelog
🆑
fix: Fix light eater affecting lava, space, openspace, and transparent
turfs
/🆑

* Fix light eater affecting lava, space, openspace, and transparent turfs

---------

Co-authored-by: Tim <timothymtorres@gmail.com>
This commit is contained in:
SkyratBot
2023-11-06 21:21:31 -05:00
committed by GitHub
co-authored by Tim
parent 464d99bcf9
commit d6fdcd3d2c
+7 -2
View File
@@ -4,6 +4,10 @@
* The temporary equivalent is [/datum/component/light_eater]
*/
/datum/element/light_eater
var/static/list/blacklisted_areas = typecacheof(list(
/turf/open/space,
/turf/open/lava,
))
/datum/element/light_eater/Attach(datum/target)
if(isatom(target))
@@ -83,8 +87,9 @@
* - [eater][/datum]: The light eater eating the morsel. This is the datum that the element is attached to that started this chain.
*/
/datum/element/light_eater/proc/devour(atom/morsel, datum/eater)
var/static/list/undevourable = typecacheof(list(/turf/open/space))
if(is_type_in_typecache(morsel, undevourable))
if(is_type_in_typecache(morsel, blacklisted_areas))
return FALSE
if(istransparentturf(morsel))
return FALSE
if(morsel.light_power <= 0 || morsel.light_range <= 0 || !morsel.light_on)
return FALSE