mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-13 00:55:20 +01:00
[MIRROR] De-hardcodes spawnDebris in windows, fixes a bunch of issues with windows. [MDB IGNORE] (#19357)
* De-hardcodes spawnDebris in windows, fixes a bunch of issues with windows. (#73274) ## About The Pull Request spawnDebris was being overridden by almost every type of window, I've set up some new vars for it to pull shard and its debris decal from so spawnDebris only needed to be set up once (+ once more for paper windows which are unique). Fixes an issue with reinforced plasma glass windows dropping regular glass when broken. Fixes an oversight where tram windows were dropping only 1 rod instead of 2 and dropping glass sheets instead of shards. Cleans up tram window code a bunch. ## Why It's Good For The Game Fixes several issues, cleans up code and cuts down on a lot of repeat code. ## Changelog 🆑 fix: Reinforced plasma windows will now drop plasma glass instead of regular glass when broken. fix: Tram windows drop the correct number of rods and a shard when broken instead of a sheet. code: Removed a ton of duplicate vars in tram window code and re-organize the file slightly. refactor: spawnDebris has been un-hardcoded and all (but one) override of it has been removed. /🆑 * De-hardcodes spawnDebris in windows, fixes a bunch of issues with windows. --------- Co-authored-by: NamelessFairy <40036527+NamelessFairy@users.noreply.github.com>
This commit is contained in:
@@ -33,6 +33,8 @@
|
||||
var/hit_sound = 'sound/effects/glasshit.ogg'
|
||||
/// If some inconsiderate jerk has had their blood spilled on this window, thus making it cleanable
|
||||
var/bloodied = FALSE
|
||||
///Datum that the shard and debris type is pulled from for when the glass is broken.
|
||||
var/datum/material/glass_material_datum = /datum/material/glass
|
||||
|
||||
/datum/armor/structure_window
|
||||
melee = 50
|
||||
@@ -330,19 +332,27 @@
|
||||
if(!disassembled)
|
||||
playsound(src, break_sound, 70, TRUE)
|
||||
if(!(flags_1 & NODECONSTRUCT_1))
|
||||
for(var/obj/item/shard/debris in spawnDebris(drop_location()))
|
||||
for(var/obj/item/shard/debris in spawn_debris(drop_location()))
|
||||
transfer_fingerprints_to(debris) // transfer fingerprints to shards only
|
||||
qdel(src)
|
||||
update_nearby_icons()
|
||||
|
||||
/obj/structure/window/proc/spawnDebris(location)
|
||||
. = list()
|
||||
. += new /obj/item/shard(location)
|
||||
. += new /obj/effect/decal/cleanable/glass(location)
|
||||
|
||||
///Spawns shard and debris decal based on the glass_material_datum, spawns rods if window is reinforned and number of shards/rods is determined by the window being fulltile or not.
|
||||
/obj/structure/window/proc/spawn_debris(location)
|
||||
var/datum/material/glass_material_ref = GET_MATERIAL_REF(glass_material_datum)
|
||||
var/obj/item/shard_type = glass_material_ref.shard_type
|
||||
var/obj/effect/decal/debris_type = glass_material_ref.debris_type
|
||||
var/list/dropped_debris = list()
|
||||
if(!isnull(shard_type))
|
||||
dropped_debris += new shard_type(location)
|
||||
if (fulltile)
|
||||
dropped_debris += new shard_type(location)
|
||||
if(!isnull(debris_type))
|
||||
dropped_debris += new debris_type(location)
|
||||
if (reinf)
|
||||
. += new /obj/item/stack/rods(location, (fulltile ? 2 : 1))
|
||||
if (fulltile)
|
||||
. += new /obj/item/shard(location)
|
||||
dropped_debris += new /obj/item/stack/rods(location, (fulltile ? 2 : 1))
|
||||
return dropped_debris
|
||||
|
||||
/obj/structure/window/proc/AfterRotation(mob/user, degrees)
|
||||
air_update_turf(TRUE, FALSE)
|
||||
@@ -580,6 +590,7 @@
|
||||
explosion_block = 1
|
||||
glass_type = /obj/item/stack/sheet/plasmaglass
|
||||
rad_insulation = RAD_MEDIUM_INSULATION
|
||||
glass_material_datum = /datum/material/alloy/plasmaglass
|
||||
|
||||
/datum/armor/window_plasma
|
||||
melee = 80
|
||||
@@ -592,15 +603,6 @@
|
||||
. = ..()
|
||||
RemoveElement(/datum/element/atmos_sensitive)
|
||||
|
||||
/obj/structure/window/plasma/spawnDebris(location)
|
||||
. = list()
|
||||
. += new /obj/item/shard/plasma(location)
|
||||
. += new /obj/effect/decal/cleanable/glass/plasma(location)
|
||||
if (reinf)
|
||||
. += new /obj/item/stack/rods(location, (fulltile ? 2 : 1))
|
||||
if (fulltile)
|
||||
. += new /obj/item/shard/plasma(location)
|
||||
|
||||
/obj/structure/window/plasma/spawner/east
|
||||
dir = EAST
|
||||
|
||||
@@ -625,6 +627,7 @@
|
||||
explosion_block = 2
|
||||
glass_type = /obj/item/stack/sheet/plasmarglass
|
||||
rad_insulation = RAD_HEAVY_INSULATION
|
||||
glass_material_datum = /datum/material/alloy/plasmaglass
|
||||
|
||||
/datum/armor/reinforced_plasma
|
||||
melee = 80
|
||||
@@ -764,6 +767,7 @@
|
||||
glass_amount = 2
|
||||
receive_ricochet_chance_mod = 1.2
|
||||
rad_insulation = RAD_MEDIUM_INSULATION
|
||||
glass_material_datum = /datum/material/alloy/titaniumglass
|
||||
|
||||
/datum/armor/reinforced_shuttle
|
||||
melee = 90
|
||||
@@ -771,15 +775,6 @@
|
||||
fire = 80
|
||||
acid = 100
|
||||
|
||||
/obj/structure/window/reinforced/shuttle/spawnDebris(location)
|
||||
. = list()
|
||||
. += new /obj/item/shard/titanium(location)
|
||||
. += new /obj/effect/decal/cleanable/glass/titanium(location)
|
||||
if (reinf)
|
||||
. += new /obj/item/stack/rods(location, (fulltile ? 2 : 1))
|
||||
if (fulltile)
|
||||
. += new /obj/item/shard/titanium(location)
|
||||
|
||||
/obj/structure/window/reinforced/shuttle/narsie_act()
|
||||
add_atom_colour("#3C3434", FIXED_COLOUR_PRIORITY)
|
||||
|
||||
@@ -810,6 +805,7 @@
|
||||
glass_type = /obj/item/stack/sheet/plastitaniumglass
|
||||
glass_amount = 2
|
||||
rad_insulation = RAD_EXTREME_INSULATION
|
||||
glass_material_datum = /datum/material/alloy/plastitaniumglass
|
||||
|
||||
/datum/armor/plasma_plastitanium
|
||||
melee = 95
|
||||
@@ -817,15 +813,6 @@
|
||||
fire = 80
|
||||
acid = 100
|
||||
|
||||
/obj/structure/window/reinforced/plasma/plastitanium/spawnDebris(location)
|
||||
. = list()
|
||||
. += new /obj/item/shard/plastitanium(location)
|
||||
. += new /obj/effect/decal/cleanable/glass/plastitanium(location)
|
||||
if (reinf)
|
||||
. += new /obj/item/stack/rods(location, (fulltile ? 2 : 1))
|
||||
if (fulltile)
|
||||
. += new /obj/item/shard/plastitanium(location)
|
||||
|
||||
/obj/structure/window/reinforced/plasma/plastitanium/unanchored
|
||||
anchored = FALSE
|
||||
state = WINDOW_OUT_OF_FRAME
|
||||
@@ -866,7 +853,7 @@
|
||||
if(atom_integrity < max_integrity)
|
||||
. += span_info("It looks a bit damaged, you may be able to fix it with some <b>paper</b>.")
|
||||
|
||||
/obj/structure/window/paperframe/spawnDebris(location)
|
||||
/obj/structure/window/paperframe/spawn_debris(location)
|
||||
. = list(new /obj/item/stack/sheet/mineral/wood(location))
|
||||
for (var/i in 1 to rand(1,4))
|
||||
. += new /obj/item/paper/natural(location)
|
||||
|
||||
Reference in New Issue
Block a user