Skip to content

Commit

Permalink
Fix Weed Nodes in Walls (#3765)
Browse files Browse the repository at this point in the history
# About the pull request

This PR makes it so weed nodes cannot be placed in a turf with density
set true (such as when you build a resin wall on top of yourself) or a
dense structure (such as a window frame). Nodes still can be placed
under doors while they are open. Marked it as balance but feel free to
change it to fix if you think it isn't balance.

If theres a situation where a weed node should be able to be placed in a
turf with density let me know and I can make the check exclusively for
resin walls. I can't think of any though.

# Explain why it's good for the game

Fixes #3745
Fixes #3770 

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


![image](https://github.com/cmss13-devs/cmss13/assets/76988376/89b16684-1f35-40f6-81f0-44855f28e732)

</details>

# Changelog
:cl: Drathek
balance: Weed nodes can no longer be placed in walls or window frames
(or any turf or structure with density)
refactor: Refactored the plant weeds ability code
/:cl:
  • Loading branch information
Drulikar committed Jul 5, 2023
1 parent 0cf1aba commit d4bec12
Showing 1 changed file with 42 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,70 +4,79 @@

// Plant weeds
/datum/action/xeno_action/onclick/plant_weeds/use_ability(atom/A)
var/mob/living/carbon/xenomorph/X = owner
var/mob/living/carbon/xenomorph/xeno = owner
if(!action_cooldown_check())
return
if(!X.check_state())
if(!xeno.check_state())
return
if(X.burrow)
if(xeno.burrow)
return

var/turf/T = X.loc
var/turf/turf = xeno.loc

if(!istype(T))
to_chat(X, SPAN_WARNING("You can't do that here."))
if(!istype(turf))
to_chat(xeno, SPAN_WARNING("You can't do that here."))
return

var/is_weedable = T.is_weedable()
if(turf.density)
to_chat(xeno, SPAN_WARNING("You can't do that here."))
return

var/is_weedable = turf.is_weedable()
if(!is_weedable)
to_chat(X, SPAN_WARNING("Bad place for a garden!"))
to_chat(xeno, SPAN_WARNING("Bad place for a garden!"))
return
if(!plant_on_semiweedable && is_weedable < FULLY_WEEDABLE)
to_chat(X, SPAN_WARNING("Bad place for a garden!"))
to_chat(xeno, SPAN_WARNING("Bad place for a garden!"))
return

var/obj/effect/alien/weeds/node/N = locate() in T
if(N && N.weed_strength >= X.weed_level)
to_chat(X, SPAN_WARNING("There's a pod here already!"))
var/obj/effect/alien/weeds/node/node = locate() in turf
if(node && node.weed_strength >= xeno.weed_level)
to_chat(xeno, SPAN_WARNING("There's a pod here already!"))
return

var/obj/effect/alien/resin/trap/resin_trap = locate() in T
var/obj/effect/alien/resin/trap/resin_trap = locate() in turf
if(resin_trap)
to_chat(X, SPAN_WARNING("You can't weed on top of a trap!"))
to_chat(xeno, SPAN_WARNING("You can't weed on top of a trap!"))
return

var/list/to_convert
if(N)
to_convert = N.children.Copy()

var/obj/effect/alien/weeds/W = locate(/obj/effect/alien/weeds) in T
if (W && W.weed_strength >= WEED_LEVEL_HIVE)
to_chat(X, SPAN_WARNING("These weeds are too strong to plant a node on!"))
var/obj/effect/alien/weeds/weed = node || locate() in turf
if(weed && weed.weed_strength >= WEED_LEVEL_HIVE)
to_chat(xeno, SPAN_WARNING("These weeds are too strong to plant a node on!"))
return

var/area/AR = get_area(T)
if(isnull(AR) || !(AR.is_resin_allowed))
if(AR.flags_area & AREA_UNWEEDABLE)
to_chat(X, SPAN_XENOWARNING("This area is unsuited to host the hive!"))
for(var/obj/structure/struct in turf)
if(struct.density && !(struct.flags_atom & ON_BORDER)) // Not sure exactly if we need to test against ON_BORDER though
to_chat(xeno, SPAN_WARNING("You can't do that here."))
return
to_chat(X, SPAN_XENOWARNING("It's too early to spread the hive this far."))

var/area/area = get_area(turf)
if(isnull(area) || !(area.is_resin_allowed))
if(area.flags_area & AREA_UNWEEDABLE)
to_chat(xeno, SPAN_XENOWARNING("This area is unsuited to host the hive!"))
return
to_chat(xeno, SPAN_XENOWARNING("It's too early to spread the hive this far."))
return

if (!check_and_use_plasma_owner())
if(!check_and_use_plasma_owner())
return

X.visible_message(SPAN_XENONOTICE("\The [X] regurgitates a pulsating node and plants it on the ground!"), \
var/list/to_convert
if(node)
to_convert = node.children.Copy()

xeno.visible_message(SPAN_XENONOTICE("\The [xeno] regurgitates a pulsating node and plants it on the ground!"), \
SPAN_XENONOTICE("You regurgitate a pulsating node and plant it on the ground!"), null, 5)
var/obj/effect/alien/weeds/node/new_node = new node_type(X.loc, src, X)
var/obj/effect/alien/weeds/node/new_node = new node_type(xeno.loc, src, xeno)

if(to_convert)
for(var/weed in to_convert)
var/turf/target_turf = get_turf(weed)
for(var/cur_weed in to_convert)
var/turf/target_turf = get_turf(cur_weed)
if(target_turf && !target_turf.density)
new /obj/effect/alien/weeds(target_turf, new_node)
qdel(weed)
qdel(cur_weed)

playsound(X.loc, "alien_resin_build", 25)
playsound(xeno.loc, "alien_resin_build", 25)
apply_cooldown()
return ..()

Expand Down

0 comments on commit d4bec12

Please sign in to comment.