diff --git a/code/datums/materials/_material.dm b/code/datums/materials/_material.dm index 7151181c409..d1b760cd576 100644 --- a/code/datums/materials/_material.dm +++ b/code/datums/materials/_material.dm @@ -49,6 +49,8 @@ Simple datum which is instanced once per type and is used for every object of sa var/cached_texture_filter_icon ///What type of shard the material will shatter to var/obj/item/shard_type + ///What type of debris the tile will leave behind when shattered. + var/obj/effect/decal/debris_type /** Handles initializing the material. * diff --git a/code/datums/materials/alloys.dm b/code/datums/materials/alloys.dm index ebaccb3cfa2..2fdaad45089 100644 --- a/code/datums/materials/alloys.dm +++ b/code/datums/materials/alloys.dm @@ -90,6 +90,7 @@ armor_modifiers = list(MELEE = 0.8, BULLET = 0.8, LASER = 1.2, ENERGY = 1.2, BOMB = 0.3, BIO = 1.2, FIRE = 2, ACID = 2) sheet_type = /obj/item/stack/sheet/plasmaglass shard_type = /obj/item/shard/plasma + debris_type = /obj/effect/decal/cleanable/glass/plasma value_per_unit = 0.075 categories = list(MAT_CATEGORY_RIGID=TRUE, MAT_CATEGORY_BASE_RECIPES=TRUE, MAT_CATEGORY_ITEM_MATERIAL=TRUE) composition = list(/datum/material/glass=1, /datum/material/plasma=0.5) @@ -109,6 +110,7 @@ armor_modifiers = list(MELEE = 1.2, BULLET = 1.2, LASER = 0.8, ENERGY = 0.8, BOMB = 0.5, BIO = 1.2, FIRE = 0.8, ACID = 2) sheet_type = /obj/item/stack/sheet/titaniumglass shard_type = /obj/item/shard/titanium + debris_type = /obj/effect/decal/cleanable/glass/titanium value_per_unit = 0.04 categories = list(MAT_CATEGORY_RIGID=TRUE, MAT_CATEGORY_BASE_RECIPES=TRUE, MAT_CATEGORY_ITEM_MATERIAL=TRUE) composition = list(/datum/material/glass=1, /datum/material/titanium=0.5) @@ -129,6 +131,7 @@ armor_modifiers = list(MELEE = 1.2, BULLET = 1.2, LASER = 1.2, ENERGY = 1.2, BOMB = 0.5, BIO = 1.2, FIRE = 2, ACID = 2) sheet_type = /obj/item/stack/sheet/plastitaniumglass shard_type = /obj/item/shard/plastitanium + debris_type = /obj/effect/decal/cleanable/glass/plastitanium value_per_unit = 0.125 categories = list(MAT_CATEGORY_RIGID=TRUE, MAT_CATEGORY_BASE_RECIPES=TRUE, MAT_CATEGORY_ITEM_MATERIAL=TRUE) composition = list(/datum/material/glass=1, /datum/material/alloy/plastitanium=0.5) diff --git a/code/datums/materials/basemats.dm b/code/datums/materials/basemats.dm index 7cdb5fc054b..60d159085a8 100644 --- a/code/datums/materials/basemats.dm +++ b/code/datums/materials/basemats.dm @@ -24,6 +24,7 @@ integrity_modifier = 0.1 sheet_type = /obj/item/stack/sheet/glass shard_type = /obj/item/shard + debris_type = /obj/effect/decal/cleanable/glass value_per_unit = 0.0025 beauty_modifier = 0.05 armor_modifiers = list(MELEE = 0.2, BULLET = 0.2, ENERGY = 1, BIO = 0.2, FIRE = 1, ACID = 0.2) diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index e9a82669b1b..07789f2be0e 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -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 paper.") -/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) diff --git a/code/modules/industrial_lift/tram/tram_windows.dm b/code/modules/industrial_lift/tram/tram_windows.dm index 503e874a27a..a837a94e4f5 100644 --- a/code/modules/industrial_lift/tram/tram_windows.dm +++ b/code/modules/industrial_lift/tram/tram_windows.dm @@ -1,24 +1,3 @@ -/obj/structure/window/reinforced/tram/front - name = "tram wall" - icon = 'icons/obj/smooth_structures/tram_window.dmi' - desc = "A lightweight titanium composite structure with a windscreen installed." - icon = 'icons/obj/smooth_structures/tram_window.dmi' - icon_state = "tram_window-0" - base_icon_state = "tram_window" - max_integrity = 100 - wtype = "shuttle" - reinf = TRUE - fulltile = TRUE - flags_1 = PREVENT_CLICK_UNDER_1 - reinf = TRUE - heat_resistance = 1600 - armor_type = /datum/armor/window_tram - explosion_block = 3 - glass_type = /obj/item/stack/sheet/titaniumglass - glass_amount = 2 - receive_ricochet_chance_mod = 1.2 - rad_insulation = RAD_MEDIUM_INSULATION - /obj/structure/window/reinforced/tram name = "tram window" desc = "A window made out of a titanium-silicate alloy. It looks tough to break. Is that a challenge?" @@ -31,6 +10,19 @@ explosion_block = 0 glass_type = /obj/item/stack/sheet/titaniumglass rad_insulation = RAD_MEDIUM_INSULATION + glass_material_datum = /datum/material/alloy/titaniumglass + +/obj/structure/window/reinforced/tram/front + name = "tram wall" + desc = "A lightweight titanium composite structure with a windscreen installed." + icon_state = "tram_window-0" + base_icon_state = "tram_window" + wtype = "shuttle" + fulltile = TRUE + flags_1 = PREVENT_CLICK_UNDER_1 + explosion_block = 3 + glass_amount = 2 + receive_ricochet_chance_mod = 1.2 /obj/structure/window/reinforced/tram/left/directional/north icon_state = "tram_left" @@ -63,11 +55,6 @@ fire = 99 acid = 100 -/obj/structure/window/reinforced/tram/spawnDebris(location) - . = list() - . += new /obj/item/stack/sheet/titaniumglass(location) - . += new /obj/item/stack/rods(location) - MAPPING_DIRECTIONAL_HELPERS(/obj/structure/window/reinforced/tram/left, 0) MAPPING_DIRECTIONAL_HELPERS(/obj/structure/window/reinforced/tram/mid, 0) MAPPING_DIRECTIONAL_HELPERS(/obj/structure/window/reinforced/tram/right, 0)