mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-12 11:13:16 +00:00
Adds a closet breakout animation, fixes spamming the breakout proc
This commit is contained in:
@@ -10,7 +10,7 @@
|
|||||||
var/welded = 0
|
var/welded = 0
|
||||||
var/wall_mounted = 0 //never solid (You can always pass over it)
|
var/wall_mounted = 0 //never solid (You can always pass over it)
|
||||||
var/health = 100
|
var/health = 100
|
||||||
var/lastbang
|
var/breakout = 0 //if someone is currently breaking out. mutex
|
||||||
var/storage_capacity = 30 //This is so that someone can't pack hundreds of items in a locker/crate
|
var/storage_capacity = 30 //This is so that someone can't pack hundreds of items in a locker/crate
|
||||||
//then open it in a populated area to crash clients.
|
//then open it in a populated area to crash clients.
|
||||||
var/open_sound = 'sound/machines/click.ogg'
|
var/open_sound = 'sound/machines/click.ogg'
|
||||||
@@ -255,12 +255,6 @@
|
|||||||
|
|
||||||
if(!src.open())
|
if(!src.open())
|
||||||
user << "<span class='notice'>It won't budge!</span>"
|
user << "<span class='notice'>It won't budge!</span>"
|
||||||
if(!lastbang)
|
|
||||||
lastbang = 1
|
|
||||||
for (var/mob/M in hearers(src, null))
|
|
||||||
M << text("<FONT size=[]>BANG, bang!</FONT>", max(0, 5 - get_dist(src, M)))
|
|
||||||
spawn(30)
|
|
||||||
lastbang = 0
|
|
||||||
|
|
||||||
/obj/structure/closet/attack_hand(mob/user as mob)
|
/obj/structure/closet/attack_hand(mob/user as mob)
|
||||||
src.add_fingerprint(user)
|
src.add_fingerprint(user)
|
||||||
@@ -310,6 +304,8 @@
|
|||||||
return 1
|
return 1
|
||||||
|
|
||||||
/obj/structure/closet/proc/req_breakout()
|
/obj/structure/closet/proc/req_breakout()
|
||||||
|
if(breakout)
|
||||||
|
return 0 //Already breaking out.
|
||||||
if(opened)
|
if(opened)
|
||||||
return 0 //Door's open... wait, why are you in it's contents then?
|
return 0 //Door's open... wait, why are you in it's contents then?
|
||||||
if(!welded)
|
if(!welded)
|
||||||
@@ -328,22 +324,30 @@
|
|||||||
escapee << "<span class='warning'>You lean on the back of \the [src] and start pushing the door open. (this will take about [breakout_time] minutes)</span>"
|
escapee << "<span class='warning'>You lean on the back of \the [src] and start pushing the door open. (this will take about [breakout_time] minutes)</span>"
|
||||||
|
|
||||||
visible_message("<span class='danger'>The [src] begins to shake violently!</span>")
|
visible_message("<span class='danger'>The [src] begins to shake violently!</span>")
|
||||||
playsound(src.loc, 'sound/effects/grillehit.ogg', 100, 1)
|
|
||||||
|
|
||||||
|
breakout = 1 //can't think of a better way to do this right now.
|
||||||
for(var/i in 1 to (6*breakout_time * 2)) //minutes * 6 * 5seconds * 2
|
for(var/i in 1 to (6*breakout_time * 2)) //minutes * 6 * 5seconds * 2
|
||||||
|
playsound(src.loc, 'sound/effects/grillehit.ogg', 100, 1)
|
||||||
|
animate_shake()
|
||||||
|
|
||||||
if(!do_after(escapee, 50)) //5 seconds
|
if(!do_after(escapee, 50)) //5 seconds
|
||||||
|
breakout = 0
|
||||||
return
|
return
|
||||||
if(!escapee || escapee.stat || escapee.loc != src)
|
if(!escapee || escapee.stat || escapee.loc != src)
|
||||||
|
breakout = 0
|
||||||
return //closet/user destroyed OR user dead/unconcious OR user no longer in closet OR closet opened
|
return //closet/user destroyed OR user dead/unconcious OR user no longer in closet OR closet opened
|
||||||
//Perform the same set of checks as above for weld and lock status to determine if there is even still a point in 'resisting'...
|
//Perform the same set of checks as above for weld and lock status to determine if there is even still a point in 'resisting'...
|
||||||
if(!req_breakout())
|
if(!req_breakout())
|
||||||
|
breakout = 0
|
||||||
return
|
return
|
||||||
playsound(src.loc, 'sound/effects/grillehit.ogg', 100, 1)
|
|
||||||
|
|
||||||
//Well then break it!
|
//Well then break it!
|
||||||
|
breakout = 0
|
||||||
escapee << "<span class='warning'>You successfully break out!</span>"
|
escapee << "<span class='warning'>You successfully break out!</span>"
|
||||||
visible_message("<span class='danger'>\the [escapee] successfully broke out of \the [src]!</span>")
|
visible_message("<span class='danger'>\the [escapee] successfully broke out of \the [src]!</span>")
|
||||||
|
playsound(src.loc, 'sound/effects/grillehit.ogg', 100, 1)
|
||||||
break_open()
|
break_open()
|
||||||
|
animate_shake()
|
||||||
|
|
||||||
/obj/structure/closet/proc/break_open()
|
/obj/structure/closet/proc/break_open()
|
||||||
welded = 0
|
welded = 0
|
||||||
@@ -353,3 +357,9 @@
|
|||||||
var/obj/structure/bigDelivery/BD = loc
|
var/obj/structure/bigDelivery/BD = loc
|
||||||
BD.unwrap()
|
BD.unwrap()
|
||||||
open()
|
open()
|
||||||
|
|
||||||
|
/obj/structure/closet/proc/animate_shake()
|
||||||
|
var/init_px = pixel_x
|
||||||
|
var/shake_dir = pick(-1, 1)
|
||||||
|
animate(src, transform=turn(matrix(), 8*shake_dir), pixel_x=init_px + 2*shake_dir, time=1)
|
||||||
|
animate(transform=null, pixel_x=init_px, time=6, easing=ELASTIC_EASING)
|
||||||
|
|||||||
Reference in New Issue
Block a user