Explosion Performance (#13988)

This commit is contained in:
Wildkins
2022-05-17 18:11:40 +02:00
committed by GitHub
parent 078e1ab41f
commit fc2a99f1a8
12 changed files with 67 additions and 38 deletions
@@ -9,8 +9,9 @@
else if(damage)
to_chat(user, SPAN_WARNING("It is damaged."))
/obj/item/modular_computer/proc/break_apart()
visible_message(SPAN_WARNING("\The [src] breaks apart!"))
/obj/item/modular_computer/proc/break_apart(msg = TRUE)
if(msg)
visible_message(SPAN_WARNING("\The [src] breaks apart!"))
new /obj/item/stack/material/steel(get_turf(src), round(steel_sheet_cost/2))
for(var/obj/item/computer_hardware/H in get_all_components())
uninstall_component(null, H)
@@ -19,7 +20,7 @@
H.take_damage(rand(10, 30))
qdel(src)
/obj/item/modular_computer/proc/take_damage(var/amount, var/component_probability, var/damage_casing = TRUE, var/randomize = TRUE)
/obj/item/modular_computer/proc/take_damage(var/amount, var/component_probability, var/damage_casing = TRUE, var/randomize = TRUE, msg=TRUE)
if(randomize)
// 75%-125%, rand() works with integers, apparently.
amount *= (rand(75, 125) / 100.0)
@@ -34,13 +35,13 @@
H.take_damage(round(amount / 2))
if(damage >= max_damage)
break_apart()
break_apart(msg)
update_icon()
// Stronger explosions cause serious damage to internal components
// Minor explosions are mostly mitigitated by casing.
/obj/item/modular_computer/ex_act(var/severity)
take_damage(rand(125, 200) / severity, 30 / severity)
take_damage(rand(125, 200) / severity, 30 / severity, msg = FALSE)
// EMPs are similar to explosions, but don't cause physical damage to the casing. Instead they screw up the components
/obj/item/modular_computer/emp_act(var/severity)
@@ -56,4 +57,4 @@
if(PAIN)
take_damage(Proj.damage, Proj.damage / 3, 0)
if(BURN)
take_damage(Proj.damage, Proj.damage / 1.5)
take_damage(Proj.damage, Proj.damage / 1.5)
-1
View File
@@ -150,7 +150,6 @@
if(prob(50))
qdel(src)
else
visible_message("\The [src] shakes violently, and neatly collapses as its damage sensors go off.")
collapse_kit()
return
if(3.0)
+12 -2
View File
@@ -405,6 +405,11 @@ obj/structure/cable/proc/cableColor(var/colorC)
if(C.powernet)
. -= C
/obj/structure/cable/proc/auto_propagate_cut_cable(obj/O)
if(O && !QDELETED(O))
var/datum/powernet/newPN = new()// creates a new powernet...
propagate_network(O, newPN)//... and propagates it to the other side of the cable
//should be called after placing a cable which extends another cable, creating a "smooth" cable that no longer terminates in the centre of a turf.
//needed as this can, unlike other placements, disconnect cables
/obj/structure/cable/proc/denode()
@@ -443,8 +448,13 @@ obj/structure/cable/proc/cableColor(var/colorC)
loc = null
powernet.remove_cable(src) //remove the cut cable from its powernet
var/datum/powernet/newPN = new()// creates a new powernet...
propagate_network(P_list[1], newPN)//... and propagates it to the other side of the cable
var/first = TRUE
for(var/obj/O in P_list)
if(first)
first = FALSE
continue
addtimer(CALLBACK(O, .proc/auto_propagate_cut_cable, O), 0)
// prevents rebuilding the powernet X times when an explosion cuts X cables
// Disconnect machines connected to nodes
if(d1 == 0) // if we cut a node (O-X) cable
@@ -36,7 +36,6 @@
/obj/structure/reagent_dispensers/ex_act(severity)
reagents.splash_turf(get_turf(src), reagents.total_volume)
visible_message(SPAN_DANGER("\The [src] bursts open, spreading reagents all over the area!"))
qdel(src)
/obj/structure/reagent_dispensers/attackby(obj/item/O as obj, mob/user as mob)
+5 -4
View File
@@ -37,7 +37,7 @@
health += maxhealth - old_maxhealth
/obj/structure/table/proc/take_damage(amount)
/obj/structure/table/proc/take_damage(amount, msg = TRUE)
// If the table is made of a brittle material, and is *not* reinforced with a non-brittle material, damage is multiplied by TABLE_BRITTLE_MATERIAL_MULTIPLIER
if(material && material.is_brittle())
if(reinforced)
@@ -47,7 +47,8 @@
amount *= TABLE_BRITTLE_MATERIAL_MULTIPLIER
health -= amount
if(health <= 0)
visible_message(SPAN_WARNING("\The [src] breaks down!"), intent_message = THUNK_SOUND)
if(msg)
visible_message(SPAN_WARNING("\The [src] breaks down!"), intent_message = THUNK_SOUND)
return break_to_parts() // if we break and form shards, return them to the caller to do !FUN! things with
@@ -57,9 +58,9 @@
qdel(src)
return
if(2.0)
take_damage(rand(100,400))
take_damage(rand(100,400), FALSE)
if(3.0)
take_damage(rand(50,150))
take_damage(rand(50,150), FALSE)
/obj/structure/table/Initialize()