mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-27 15:17:01 +01:00
[MIRROR] Makes only mapload foods require players to pick them up to decompose (#7131)
* Makes only mapload foods require players to pick them up to decompose (#60392) Co-authored-by: Changelogs <action@ github.com> * Makes only mapload foods require players to pick them up to decompose Co-authored-by: Wallemations <66052067+Wallemations@users.noreply.github.com> Co-authored-by: Changelogs <action@ github.com>
This commit is contained in:
co-authored by
Changelogs
Wallemations
parent
016c79d464
commit
20fbe40187
@@ -10,8 +10,8 @@
|
||||
|
||||
/datum/component/decomposition
|
||||
dupe_mode = COMPONENT_DUPE_UNIQUE
|
||||
/// Makes sure food only starts decomposing if a player's EVER picked it up before
|
||||
var/handled = FALSE
|
||||
/// Makes sure maploaded food only starts decomposing if a player's EVER picked it up before
|
||||
var/handled = TRUE
|
||||
/// Used to stop food in someone's hand & in storage slots from decomposing.
|
||||
var/protected = FALSE
|
||||
/// Used to stop the timer & check for the examine proc
|
||||
@@ -23,11 +23,13 @@
|
||||
/// Used for examining
|
||||
var/examine_type = DECOMP_EXAM_NORMAL
|
||||
|
||||
/datum/component/decomposition/Initialize(decomp_flags = NONE)
|
||||
/datum/component/decomposition/Initialize(mapload, decomp_flags = NONE)
|
||||
if(!isobj(parent))
|
||||
return COMPONENT_INCOMPATIBLE
|
||||
|
||||
src.decomp_flags = decomp_flags
|
||||
if(mapload)
|
||||
handled = FALSE
|
||||
|
||||
RegisterSignal(parent, COMSIG_MOVABLE_MOVED, .proc/handle_movement)
|
||||
RegisterSignal(parent, list(
|
||||
@@ -47,6 +49,9 @@
|
||||
time_remaining = DECOMPOSITION_TIME_GROSS
|
||||
examine_type = DECOMP_EXAM_GROSS
|
||||
|
||||
handle_movement()
|
||||
|
||||
|
||||
/datum/component/decomposition/UnregisterFromParent()
|
||||
UnregisterSignal(parent, list(
|
||||
COMSIG_ITEM_PICKUP,
|
||||
@@ -57,7 +62,8 @@
|
||||
COMSIG_PARENT_EXAMINE))
|
||||
|
||||
/datum/component/decomposition/proc/handle_movement()
|
||||
if(!handled) // Has someone touched this previously?
|
||||
SIGNAL_HANDLER
|
||||
if(!handled) // If maploaded, has someone touched this previously?
|
||||
return
|
||||
var/obj/food = parent // Doesn't HAVE to be food, that's just what it's intended for
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
///Food that's immune to decomposition.
|
||||
var/preserved_food = FALSE
|
||||
|
||||
/obj/item/food/Initialize()
|
||||
/obj/item/food/Initialize(mapload)
|
||||
. = ..()
|
||||
if(food_reagents)
|
||||
food_reagents = string_assoc_list(food_reagents)
|
||||
@@ -53,7 +53,7 @@
|
||||
MakeProcessable()
|
||||
MakeLeaveTrash()
|
||||
MakeGrillable()
|
||||
MakeDecompose()
|
||||
MakeDecompose(mapload)
|
||||
|
||||
///This proc adds the edible component, overwrite this if you for some reason want to change some specific args like callbacks.
|
||||
/obj/item/food/proc/MakeEdible()
|
||||
@@ -87,6 +87,6 @@
|
||||
return
|
||||
|
||||
///This proc makes things decompose. Set preserved_food to TRUE to make it never decompose.
|
||||
/obj/item/food/proc/MakeDecompose()
|
||||
/obj/item/food/proc/MakeDecompose(mapload)
|
||||
if(!preserved_food)
|
||||
AddComponent(/datum/component/decomposition, decomp_flags = foodtypes)
|
||||
AddComponent(/datum/component/decomposition, mapload, decomp_flags = foodtypes)
|
||||
|
||||
Reference in New Issue
Block a user