mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-27 07:08:00 +01:00
[MODULAR] Fixes a couple of race conditions with inflatables (#19902)
* Fixes a race condition with inflatables * Fixes the runtime in the issue report
This commit is contained in:
@@ -22,6 +22,8 @@
|
||||
var/hit_sound = 'sound/effects/Glasshit.ogg'
|
||||
/// How quickly we deflate when manually deflated.
|
||||
var/manual_deflation_time = 3 SECONDS
|
||||
/// Whether or not the inflatable has been deflated
|
||||
var/has_been_deflated = FALSE
|
||||
|
||||
/obj/structure/inflatable/Initialize(mapload)
|
||||
. = ..()
|
||||
@@ -62,12 +64,19 @@
|
||||
|
||||
// Deflates the airbag and drops a deflated airbag item. If violent, drops a broken item instantly.
|
||||
/obj/structure/inflatable/proc/deflate(violent)
|
||||
if(has_been_deflated) // We do not ever want to deflate more than once.
|
||||
return
|
||||
|
||||
has_been_deflated = TRUE
|
||||
|
||||
playsound(src, 'sound/machines/hiss.ogg', 75, 1)
|
||||
if(!violent)
|
||||
balloon_alert_to_viewers("slowly deflates!")
|
||||
addtimer(CALLBACK(src, PROC_REF(slow_deflate_finish)), manual_deflation_time)
|
||||
return
|
||||
balloon_alert_to_viewers("rapidly deflates!")
|
||||
|
||||
var/turf/inflatable_loc = get_turf(src)
|
||||
inflatable_loc.balloon_alert_to_viewers("[src] rapidly deflates!") // just so we don't balloon alert from the qdeleted inflatable object
|
||||
if(torn_type)
|
||||
new torn_type(get_turf(src))
|
||||
qdel(src)
|
||||
|
||||
Reference in New Issue
Block a user