Skip to content

Commit

Permalink
[MIRROR] Fixes Dead Lingering Ghost-Control Mobs [MDB IGNORE] (#24987) (
Browse files Browse the repository at this point in the history
#615)

* Fixes Dead Lingering Ghost-Control Mobs (#79615)

## About The Pull Request

Fixes #79008

This is the same method bots use (though a bit more extravagant)- the
component is meant to delete itself when a user assumes control but it
had no cases for deleting itself on the user's death. This component
already has so many args that I don't particularly feel like adding
another one for `qdel_ourselves_on_mob_death` or whatever so let's just
repeat the pattern we already have going on for the time being.
## Why It's Good For The Game

Fixes bug.
## Changelog
:cl:
fix: Gorillas and Regal Rats will no longer show up in the ghost-control
menu if they died without anyone ever taking control of them.
/:cl:

* Fixes Dead Lingering Ghost-Control Mobs

---------

Co-authored-by: SkyratBot <[email protected]>
Co-authored-by: san7890 <[email protected]>
  • Loading branch information
3 people authored Nov 14, 2023
1 parent 62269dd commit fd611ed
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions code/modules/mob/living/basic/farm_animals/gorilla/gorilla.dm
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,12 @@
ADD_TRAIT(src, TRAIT_PACIFISM, INNATE_TRAIT)
AddComponent(/datum/component/crate_carrier)

/mob/living/basic/gorilla/cargorilla/death(gibbed)
var/datum/component/potential_component = GetComponent(/datum/component/ghost_direct_control)
if(!QDELETED(potential_component))
qdel(potential_component)
return ..()

/**
* Poll ghosts for control of the gorilla. Not added in init because we only want to poll when the round starts.
* Preferably in future we can replace this with a popup on the lobby to queue to become a gorilla.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@

grant_actions_by_list(innate_actions)

/mob/living/basic/regal_rat/death(gibbed)
var/datum/component/potential_component = GetComponent(/datum/component/ghost_direct_control)
if(!QDELETED(potential_component))
qdel(potential_component)
return ..()

/mob/living/basic/regal_rat/examine(mob/user)
. = ..()
if(user == src)
Expand Down

0 comments on commit fd611ed

Please sign in to comment.