Skip to content

Commit

Permalink
Fix spicy weed_food fires (#5488)
Browse files Browse the repository at this point in the history
# About the pull request

This PR adds a signal response to prevent pre-ignition if the mob is
merged with weeds and also extinguishes the mob when they begin merging.
Usually in this state the weeds will simply burn away and then another
tick will then ignite the un-merged mob, but apparently there were weird
edge cases where the mob would be ignited on weeds.

Because its a weird scenario I am not 100% certain I have solved the
issue (as in I can't guarantee what ignited the mob calls and respects
the signal if the extinguish call when merging isn't enough), but I am
almost certain what I have done should hit most if not all scenarios
that made this possible.

# Explain why it's good for the game

Fixes #5483 

# Testing Photographs and Procedure
<details>
<summary>Screenshots & Videos</summary>


![spicy](https://github.com/cmss13-devs/cmss13/assets/76988376/d84feb7c-5a4c-48a8-9cee-d955d80136d5)

</details>


# Changelog
:cl: Drathek
fix: Fixed mobs merged with weeds remaining ignited
/:cl:
  • Loading branch information
Drulikar authored Jan 19, 2024
1 parent 84dc482 commit 3f26e72
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions code/datums/components/weed_food.dm
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
RegisterSignal(parent_mob, COMSIG_MOVABLE_MOVED, PROC_REF(on_move))
RegisterSignal(parent_mob, list(COMSIG_LIVING_REJUVENATED, COMSIG_HUMAN_REVIVED), PROC_REF(on_rejuv))
RegisterSignal(parent_mob, COMSIG_HUMAN_SET_UNDEFIBBABLE, PROC_REF(on_update))
RegisterSignal(parent_mob, COMSIG_LIVING_PREIGNITION, PROC_REF(on_preignition))
RegisterSignal(SSdcs, COMSIG_GLOB_GROUNDSIDE_FORSAKEN_HANDLING, PROC_REF(on_forsaken))
if(parent_turf)
RegisterSignal(parent_turf, COMSIG_WEEDNODE_GROWTH, PROC_REF(on_update))
Expand All @@ -101,6 +102,7 @@
COMSIG_LIVING_REJUVENATED,
COMSIG_HUMAN_REVIVED,
COMSIG_HUMAN_SET_UNDEFIBBABLE,
COMSIG_LIVING_PREIGNITION,
))
if(absorbing_weeds)
UnregisterSignal(absorbing_weeds, COMSIG_PARENT_QDELETING)
Expand Down Expand Up @@ -194,6 +196,13 @@
var/datum/hive_status/hive = GLOB.hive_datum[XENO_HIVE_FORSAKEN]
weed_appearance.color = hive.color

/// SIGNAL_HANDLER for COMSIG_LIVING_PREIGNITION of weeds
/datum/component/weed_food/proc/on_preignition()
SIGNAL_HANDLER

if(merged)
return COMPONENT_CANCEL_IGNITION

/**
* Try to start the process to turn into weeds
* Returns TRUE if started successfully
Expand Down Expand Up @@ -304,6 +313,7 @@
if(!parent_nest)
parent_mob.plane = FLOOR_PLANE
parent_mob.remove_from_all_mob_huds()
parent_mob.ExtinguishMob()

if(!weed_appearance) // Make a new sprite if we aren't re-merging
var/is_flipped = parent_mob.transform.b == -1 // Technically we should check if d is 1 too, but corpses can only be rotated 90 or 270 (1/-1 or -1/1)
Expand Down

0 comments on commit 3f26e72

Please sign in to comment.