Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix resin doors not closing on mob/living if they are merged with weeds #4990

Merged
merged 3 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions code/__DEFINES/traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@
#define TRAIT_IMMOBILIZED "immobilized"
/// Apply this to make a mob not dense, and remove it when you want it to no longer make them undense, other sorces of undesity will still apply. Always define a unique source when adding a new instance of this!
#define TRAIT_UNDENSE "undense"
/// Apply this to identify a mob as merged with weeds
#define TRAIT_MERGED_WITH_WEEDS "merged_with_weeds"

// SPECIES TRAITS
/// Knowledge of Yautja technology
Expand Down
2 changes: 2 additions & 0 deletions code/datums/components/weed_food.dm
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@
merged = TRUE

ADD_TRAIT(parent_mob, TRAIT_UNDENSE, XENO_WEED_TRAIT)
ADD_TRAIT(parent_mob, TRAIT_MERGED_WITH_WEEDS, XENO_WEED_TRAIT)
parent_mob.anchored = TRUE
parent_mob.mouse_opacity = MOUSE_OPACITY_TRANSPARENT
parent_mob.plane = FLOOR_PLANE
Expand Down Expand Up @@ -288,6 +289,7 @@
UnregisterSignal(absorbing_weeds, COMSIG_PARENT_QDELETING)
absorbing_weeds = null

REMOVE_TRAIT(parent_mob, TRAIT_MERGED_WITH_WEEDS, XENO_WEED_TRAIT)
parent_mob.anchored = FALSE
parent_mob.mouse_opacity = MOUSE_OPACITY_ICON
parent_mob.plane = GAME_PLANE
Expand Down
31 changes: 18 additions & 13 deletions code/modules/cm_aliens/XenoStructures.dm
Original file line number Diff line number Diff line change
Expand Up @@ -418,18 +418,23 @@
update_icon()
isSwitchingStates = 0
layer = DOOR_OPEN_LAYER
spawn(close_delay)
if(!isSwitchingStates && state == 1)
Close()
addtimer(CALLBACK(src, PROC_REF(Close)), close_delay, TIMER_UNIQUE|TIMER_OVERRIDE)

/obj/structure/mineral_door/resin/proc/close_blocked()
for(var/turf/turf in locs)
for(var/mob/living/living_mob in turf)
if(!HAS_TRAIT(living_mob, TRAIT_MERGED_WITH_WEEDS))
return TRUE
return FALSE

/obj/structure/mineral_door/resin/Close()
if(!state || !loc) return //already closed
if(!state || !loc || isSwitchingStates)
return //already closed or changing
//Can't close if someone is blocking it
for(var/turf/turf in locs)
if(locate(/mob/living) in turf)
spawn (close_delay)
Close()
return
if(close_blocked())
addtimer(CALLBACK(src, PROC_REF(Close)), close_delay, TIMER_UNIQUE|TIMER_OVERRIDE)
return

isSwitchingStates = 1
playsound(loc, "alien_resin_move", 25)
flick("[mineralType]closing",src)
Expand All @@ -440,10 +445,10 @@
update_icon()
isSwitchingStates = 0
layer = DOOR_CLOSED_LAYER
for(var/turf/turf in locs)
if(locate(/mob/living) in turf)
Open()
return

if(close_blocked())
Open()
return

/obj/structure/mineral_door/resin/Dismantle(devastated = 0)
qdel(src)
Expand Down