From 417d6fe8cfe35c664ed04e78726a1fb18b7fa473 Mon Sep 17 00:00:00 2001
From: Luc <89928798+lewcc@users.noreply.github.com>
Date: Mon, 29 Apr 2024 20:50:35 -0400
Subject: [PATCH] Makes kudzu much more likely to entangle you (#25167)
* lets kudzu entangle you
* Increase buckle time
* Apply suggestions from code review
Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
---------
Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
---
code/game/objects/structures.dm | 2 ++
code/modules/events/spacevine.dm | 13 +++++++++----
code/modules/mob/living/carbon/carbon_procs.dm | 11 +++++++++--
3 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/code/game/objects/structures.dm b/code/game/objects/structures.dm
index abdf1443cc0..587724cdf1e 100644
--- a/code/game/objects/structures.dm
+++ b/code/game/objects/structures.dm
@@ -8,6 +8,8 @@
var/creates_cover = FALSE
var/mob/living/climber
var/broken = FALSE
+ /// How long this takes to unbuckle yourself from.
+ var/unbuckle_time = 0 SECONDS
/obj/structure/New()
..()
diff --git a/code/modules/events/spacevine.dm b/code/modules/events/spacevine.dm
index c6860510fd8..8b6d4f1cad3 100644
--- a/code/modules/events/spacevine.dm
+++ b/code/modules/events/spacevine.dm
@@ -396,6 +396,7 @@
mouse_opacity = MOUSE_OPACITY_OPAQUE //Clicking anywhere on the turf is good enough
pass_flags = PASSTABLE | PASSGRILLE
max_integrity = 50
+ unbuckle_time = 5 SECONDS
var/energy = 0
var/obj/structure/spacevine_controller/master = null
var/list/mutations = list()
@@ -511,10 +512,14 @@
wither()
/obj/structure/spacevine/Crossed(mob/crosser, oldloc)
- if(isliving(crosser))
- for(var/SM_type in mutations)
- var/datum/spacevine_mutation/SM = mutations[SM_type]
- SM.on_cross(src, crosser)
+ if(!isliving(crosser))
+ return
+ for(var/SM_type in mutations)
+ var/datum/spacevine_mutation/SM = mutations[SM_type]
+ SM.on_cross(src, crosser)
+
+ if(prob(30 * energy))
+ entangle(crosser)
/obj/structure/spacevine/attack_hand(mob/user)
for(var/SM_type in mutations)
diff --git a/code/modules/mob/living/carbon/carbon_procs.dm b/code/modules/mob/living/carbon/carbon_procs.dm
index fd665b3a777..cc9372e68da 100644
--- a/code/modules/mob/living/carbon/carbon_procs.dm
+++ b/code/modules/mob/living/carbon/carbon_procs.dm
@@ -805,7 +805,14 @@ GLOBAL_LIST_INIT(ventcrawl_machinery, list(/obj/machinery/atmospherics/unary/ven
/mob/living/carbon/resist_buckle()
INVOKE_ASYNC(src, PROC_REF(resist_muzzle))
var/obj/item/I = get_restraining_item()
- if(!I) // If there is nothing to restrain him then he is not restrained
+ var/time = 0
+ if(istype(I))
+ time = I.breakouttime
+ else if(isstructure(buckled))
+ var/obj/structure/struct = buckled
+ time = struct.unbuckle_time
+
+ if(time == 0)
buckled.user_unbuckle_mob(src, src)
return
@@ -813,7 +820,7 @@ GLOBAL_LIST_INIT(ventcrawl_machinery, list(/obj/machinery/atmospherics/unary/ven
to_chat(src, "You are already trying to unbuckle!")
return
apply_status_effect(STATUS_EFFECT_UNBUCKLE)
- var/time = I.breakouttime
+
visible_message("[src] attempts to unbuckle [p_themselves()]!",
"You attempt to unbuckle yourself... (This will take around [time / 10] seconds and you need to stay still.)")
if(!do_after(src, time, FALSE, src, extra_checks = list(CALLBACK(src, PROC_REF(buckle_check)))))