diff --git a/code/game/objects/items/weapons/traps.dm b/code/game/objects/items/weapons/traps.dm
index 65d8118a599..d946a711c48 100644
--- a/code/game/objects/items/weapons/traps.dm
+++ b/code/game/objects/items/weapons/traps.dm
@@ -143,6 +143,7 @@
matter = list(DEFAULT_WALL_MATERIAL = 1750)
deployed = 0
time_to_escape = 3 // Minutes
+ can_buckle = TRUE
var/breakout = FALSE
var/last_shake = 0
var/list/allowed_mobs = list(/mob/living/simple_animal/rat, /mob/living/simple_animal/chick, /mob/living/simple_animal/lizard)
@@ -152,26 +153,10 @@
health = 100
var/datum/weakref/captured = null
-/obj/item/weapon/trap/animal/process()
- update_icon()
/obj/item/weapon/trap/animal/update_icon()
icon = initial(icon)
icon_state = "[icon_base][deployed]"
- var/datum/L = captured ? captured.resolve() : null
- if (!L)
- deployed = FALSE
- captured = null
- release_time = world.time
- underlays.Cut()
- STOP_PROCESSING(SSprocessing, src)
- return
- if(isliving(L))
- var/mutable_appearance/MA = new(L)
- MA.layer = FLOAT_LAYER
- MA.plane = FLOAT_PLANE
- underlays.Cut()
- underlays += MA
/obj/item/weapon/trap/animal/examine(mob/user)
..()
@@ -179,23 +164,7 @@
var/datum/L = captured.resolve()
if (!L)
return
- if (isliving(L))
- var/mob/living/ll = L
- var/message = "\The [src] has [ll] and it is "
- if(ll.stat == DEAD)
- message += "dead"
- else if(ll == UNCONSCIOUS)
- message += "unconscious"
- else if((ll.maxHealth / ll.health) == 1)
- message += "healthy"
- else
- message += "wounded"
- message += "."
- to_chat(user, message)
- ll.examine(user)
- else if (istype(L, /obj/effect/spider/spiderling))
- var/obj/effect/spider/spiderling/S = L
- to_chat(user, "\The [src] has [S] and it is alive.")
+ to_chat(user, "\The [src] has [L].")
else
to_chat(user, "\The [src] is empty.")
@@ -215,26 +184,23 @@
if(istype(AM, f))
L.visible_message(
"[L] enters \the [src], and it snaps shut with a clatter!",
- "You enters \the [src], and it snaps shut with a clatter!",
+ "You enter \the [src], and it snaps shut with a clatter!",
"You hear a loud metallic snap!"
)
- L.forceMove(src)
captured = WEAKREF(L)
playsound(src, 'sound/weapons/beartrap_shut.ogg', 100, 1)
deployed = 1
- update_icon()
+ buckle_mob(L)
src.animate_shake()
- START_PROCESSING(SSprocessing, src)
else if(istype(AM, /obj/effect/spider/spiderling) && spider) // for spiderlings
var/obj/effect/spider/spiderling/S = AM
- S.forceMove(src)
captured = WEAKREF(S)
- STOP_PROCESSING(SSprocessing, S)
playsound(src, 'sound/weapons/beartrap_shut.ogg', 100, 1)
deployed = 1
- update_icon()
+ buckle_mob(S)
src.animate_shake()
+ update_icon()
/obj/item/weapon/trap/animal/proc/req_breakout()
if(!deployed)
@@ -255,13 +221,13 @@
return TRUE
// If we are stuck, and need to get out
-/obj/item/weapon/trap/animal/proc/mob_breakout(var/mob/living/escapee)
+/obj/item/weapon/trap/animal/user_unbuckle_mob(var/mob/living/escapee)
if (req_breakout() < 1)
return
escapee.next_move = world.time + 100
escapee.last_special = world.time + 100
- to_chat(escapee, "You to shake and bump the lock of \the [src]. (this will take about [time_to_escape] minutes).")
+ to_chat(escapee, "You begin to shake and bump the lock of \the [src]. (this will take about [time_to_escape] minutes).")
visible_message("\The [src] begins to shake violently! Something is attempting to escape it!")
var/time = 360 * time_to_escape * 2
@@ -275,8 +241,6 @@
to_chat(escapee, "You successfully break out!")
visible_message("\the [escapee] successfully broke out of \the [src]!")
playsound(loc, "sound/effects/grillehit.ogg", 100, 1)
- if(!contents.len)
- return
release()
@@ -303,6 +267,8 @@
if(!ishuman(usr))
to_chat(usr, "This mob type can't use this verb.")
return
+
+ var/datum/M = captured ? captured.resolve() : null
if(deployed)
var/open = alert("Do you want to open the cage and free what is inside?",,"No","Yes")
@@ -314,13 +280,10 @@
to_chat(usr, "You cannot use \the [src].")
return
- if(usr in contents)
+ if(usr == M)
to_chat(usr, "You cannot open lock \the [src] from the inside. You would have to forcefully open it.")
return
- if(!contents.len)
- return
-
var/turf/T_cage = get_turf(src)
var/turf/T_user= get_turf(usr)
@@ -377,22 +340,17 @@
deployed = FALSE
captured = null
release_time = world.time
- update_icon()
- STOP_PROCESSING(SSprocessing, src)
return
var/msg
if (isliving(L))
var/mob/living/ll = L
- ll.forceMove(target)
msg = "[ll] runs out of \the [src]."
- STOP_PROCESSING(SSprocessing, src)
else if (istype(L, /obj/effect/spider/spiderling))
var/obj/effect/spider/spiderling/S = L
- S.forceMove(target)
msg = "[S] jumps out of \the [src]."
- START_PROCESSING(SSprocessing, L)
-
+
+ unbuckle_mob()
captured = null
visible_message(msg)
animate_shake()
@@ -443,6 +401,20 @@
else
..()
+/obj/item/weapon/trap/animal/Move()
+ ..()
+ if(captured)
+ var/datum/M = captured.resolve()
+ if(!M)
+ captured = null
+ return
+ if(isliving(M))
+ var/mob/living/L = M
+ if(L && buckled_mob.buckled == src)
+ L.forceMove(src.loc)
+ else if(L)
+ captured = null
+
/obj/item/weapon/trap/animal/attack_hand(mob/user as mob)
if (!user) return
diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm
index 056c06c7777..0d719d3345c 100644
--- a/code/modules/mob/living/living.dm
+++ b/code/modules/mob/living/living.dm
@@ -660,9 +660,6 @@ default behaviour is:
if( src.loc && istype(src.loc, /obj/structure/closet) )
var/obj/structure/closet/C = loc
spawn() C.mob_breakout(src)
- else if(src.loc && istype(src.loc, /obj/item/weapon/trap/animal))
- var/obj/item/weapon/trap/animal/A = loc
- spawn() A.mob_breakout(src)
/mob/living/proc/escape_inventory(obj/item/weapon/holder/H)
if(H != src.loc) return
diff --git a/html/changelogs/Sindorman-traps.yml b/html/changelogs/Sindorman-traps.yml
new file mode 100644
index 00000000000..d06c86b318f
--- /dev/null
+++ b/html/changelogs/Sindorman-traps.yml
@@ -0,0 +1,42 @@
+################################
+# Example Changelog File
+#
+# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb.
+#
+# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
+# When it is, any changes listed below will disappear.
+#
+# Valid Prefixes:
+# bugfix
+# wip (For works in progress)
+# tweak
+# soundadd
+# sounddel
+# rscadd (general adding of nice things)
+# rscdel (general deleting of nice things)
+# imageadd
+# imagedel
+# maptweak
+# spellcheck (typo fixes)
+# experiment
+# balance
+# admin
+# backend
+# security
+# refactor
+#################################
+
+# Your name.
+author: PoZe
+
+# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
+delete-after: True
+
+# Any changes you've made. See valid prefix list above.
+# INDENT WITH TWO SPACES. NOT TABS. SPACES.
+# SCREW THIS UP AND IT WON'T WORK.
+# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries.
+# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog.
+changes:
+ - refactor: "Traps have been refectored code-wise to work like chairs/beds. Hence eliminating craptons of bugs."
+ - spellcheck: "Fixed spelling in messages from traps."