Explosions update: More items throwable, general refactoring (#34153)

* Explosions update: More items throwable, general refactoring

* Explosions update: More items throwable, general refactoring

* more stuff affected

* comments

* re enabling. whoops

* multi-z block effects

* closer to old behaviour now

* so this behaves right

* stops this being an infinite loop

* distance scaling now works right

* makes this less specific

* makes this less specific

* cleans this line up

* more stuff, and code cleanup along the way

* this line is egregious too

* fixes here

* cables

* replacing all instances of 2** with 1<< as they're the same (minus the ability to use fractional exponents but nothing changed uses it here anyways)

* optimised down throw_at function. TODO: TEST THIS

* optimised down throw_at function. TODO: TEST THIS

* optimised down throw_at function. TODO: TEST THIS

* changing these back because... it's faster? what...

* works fine, this is just to be on the safe side

* cleanup

* cleanup

* clearer var names

* postpone air cycle option in comments

* we can add it i guess

* this is redundant

* oh this is needed

* this is redundant

---------

Co-authored-by: SECBATON GRIFFON <sage>
This commit is contained in:
SECBATON GRIFFON
2023-04-25 04:01:34 +01:00
committed by GitHub
parent ad1c0cd4f1
commit 17e24861d7
42 changed files with 393 additions and 575 deletions

View File

@@ -109,6 +109,7 @@
return 1
/obj/structure/closet/proc/dump_contents()
. = list()
if(usr)
var/mob/living/L = usr
var/obj/machinery/power/supermatter/SM = locate() in contents
@@ -124,12 +125,14 @@
for(var/obj/O in src)
if(O != src.electronics) //Don't dump your electronics
O.forceMove(src.loc)
. += O
for(var/mob/M in src)
M.forceMove(src.loc)
if(M.client)
M.client.eye = M.client.mob
M.client.perspective = MOB_PERSPECTIVE
. += M
/obj/structure/closet/proc/take_contents()
for(var/atom/movable/AM in src.loc)
@@ -331,42 +334,22 @@
qdel(src)
return new_closet
// this should probably use dump_contents()
// this should probably use dump_contents() // it does now
/obj/structure/closet/ex_act(severity)
. = list()
var/obj/item/weapon/circuitboard/airlock/E
switch(severity)
if(1)
broken = 1
if(has_electronics)//If it's got electronics, generate them/pull them out
E = dump_electronics()
E.forceMove(src)
for(var/atom/movable/A in src)//pulls everything else out of the locker and hits it with an explosion
A.forceMove(src.loc)
A.ex_act(severity++)
dump_contents()
qdel(src)
if(2)
if(prob(50))
broken = 1
if(has_electronics)
E = dump_electronics()
E.forceMove(src)
for (var/atom/movable/A as mob|obj in src)
A.forceMove(src.loc)
A.ex_act(severity++)
dump_contents()
qdel(src)
if(3)
if(prob(5))
broken = 1
if(has_electronics)
E = dump_electronics()
E.forceMove(src)
for(var/atom/movable/A as mob|obj in src)
A.forceMove(src.loc)
A.ex_act(severity++)
dump_contents()
qdel(src)
var/probdivide = severity == 3 ? 20 : severity
if (prob(100/probdivide)) //1 = 100, 2 = 50, 3 = 5
broken = 1
if(has_electronics)//If it's got electronics, generate them/pull them out
E = dump_electronics()
. += E
E.forceMove(src)
for(var/atom/movable/A in src)//pulls everything else out of the locker and hits it with an explosion
A.forceMove(src.loc)
A.ex_act(severity++)
. += dump_contents()
qdel(src)
/obj/structure/closet/shuttle_act()
for(var/atom/movable/AM in contents)

View File

@@ -47,26 +47,23 @@
//However, the door will be blown off its hinges, permanently breaking the fridge
//And of course, if the bomb is IN the fridge, you're fucked
/obj/structure/closet/secure_closet/freezer/ex_act(var/severity)
. = list()
//Bomb in here? (using same search as space transits searching for nuke disk)
var/list/bombs = search_contents_for(/obj/item/device/transfer_valve)
if(!isemptylist(bombs)) // You're fucked.
..(severity)
if(severity == 1)
. = ..(severity)
else if(severity == 1)
//If it's not open, we need to override the normal open proc and set everything ourselves
//Otherwise, you can cheese this by simply welding it shut, or if the lock is engaged
if(!opened)
opened = 1
setDensity(FALSE)
dump_contents()
. += dump_contents()
//Now, set our special variables
exploded = 1
update_icon()
return
/obj/structure/closet/secure_closet/freezer/can_close()
if(exploded) //Door blew off, can't close it anymore
return 0

View File

@@ -696,6 +696,7 @@
/obj/structure/closet/crate/ex_act(severity)
. = list()
switch(severity)
if(1)
qdel(src)
@@ -703,20 +704,20 @@
broken = TRUE
if(has_electronics)
if (prob(50))
dump_electronics()
. += dump_electronics()
else
qdel(electronics)
for(var/atom/movable/thing in contents)
if(prob(50))
qdel(thing)
dump_contents()
. += dump_contents()
qdel(src)
if(3)
if(prob(50))
broken = TRUE
if(has_electronics)
dump_electronics()
dump_contents()
. += dump_electronics()
. += dump_contents()
qdel(src)
/obj/structure/closet/crate/secure/weapon/experimental