mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-30 16:47:13 +01:00
[MIRROR] Shatter glass by slapping the floor (#408)
* Shatter glass by slapping the floor (#52916) * Shatter glass by slapping the floor Co-authored-by: NightRed <nightred@gmail.com>
This commit is contained in:
@@ -10,7 +10,8 @@
|
||||
*/
|
||||
GLOBAL_LIST_INIT(glass_recipes, list ( \
|
||||
new/datum/stack_recipe("directional window", /obj/structure/window/unanchored, time = 0, on_floor = TRUE, window_checks = TRUE), \
|
||||
new/datum/stack_recipe("fulltile window", /obj/structure/window/fulltile/unanchored, 2, time = 0, on_floor = TRUE, window_checks = TRUE) \
|
||||
new/datum/stack_recipe("fulltile window", /obj/structure/window/fulltile/unanchored, 2, time = 0, on_floor = TRUE, window_checks = TRUE), \
|
||||
new/datum/stack_recipe("glass shard", /obj/item/shard, time = 0, on_floor = TRUE) \
|
||||
))
|
||||
|
||||
/obj/item/stack/sheet/glass
|
||||
@@ -57,7 +58,8 @@ GLOBAL_LIST_INIT(glass_recipes, list ( \
|
||||
to_chat(user, "<span class='notice'>You attach wire to the [name].</span>")
|
||||
var/obj/item/stack/light_w/new_tile = new(user.loc)
|
||||
new_tile.add_fingerprint(user)
|
||||
else if(istype(W, /obj/item/stack/rods))
|
||||
return
|
||||
if(istype(W, /obj/item/stack/rods))
|
||||
var/obj/item/stack/rods/V = W
|
||||
if (V.get_amount() >= 1 && get_amount() >= 1)
|
||||
var/obj/item/stack/sheet/rglass/RG = new (get_turf(user))
|
||||
@@ -69,15 +71,13 @@ GLOBAL_LIST_INIT(glass_recipes, list ( \
|
||||
user.put_in_hands(RG)
|
||||
else
|
||||
to_chat(user, "<span class='warning'>You need one rod and one sheet of glass to make reinforced glass!</span>")
|
||||
return
|
||||
else
|
||||
return ..()
|
||||
|
||||
|
||||
return
|
||||
return ..()
|
||||
|
||||
GLOBAL_LIST_INIT(pglass_recipes, list ( \
|
||||
new/datum/stack_recipe("directional window", /obj/structure/window/plasma/unanchored, time = 0, on_floor = TRUE, window_checks = TRUE), \
|
||||
new/datum/stack_recipe("fulltile window", /obj/structure/window/plasma/fulltile/unanchored, 2, time = 0, on_floor = TRUE, window_checks = TRUE) \
|
||||
new/datum/stack_recipe("fulltile window", /obj/structure/window/plasma/fulltile/unanchored, 2, time = 0, on_floor = TRUE, window_checks = TRUE), \
|
||||
new/datum/stack_recipe("plasma glass shard", /obj/item/shard/plasma, time = 0, on_floor = TRUE) \
|
||||
))
|
||||
|
||||
/obj/item/stack/sheet/plasmaglass
|
||||
@@ -119,8 +119,6 @@ GLOBAL_LIST_INIT(pglass_recipes, list ( \
|
||||
else
|
||||
return ..()
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Reinforced glass sheets
|
||||
*/
|
||||
@@ -128,7 +126,8 @@ GLOBAL_LIST_INIT(reinforced_glass_recipes, list ( \
|
||||
new/datum/stack_recipe("windoor frame", /obj/structure/windoor_assembly, 5, time = 0, on_floor = TRUE, window_checks = TRUE), \
|
||||
null, \
|
||||
new/datum/stack_recipe("directional reinforced window", /obj/structure/window/reinforced/unanchored, time = 0, on_floor = TRUE, window_checks = TRUE), \
|
||||
new/datum/stack_recipe("fulltile reinforced window", /obj/structure/window/reinforced/fulltile/unanchored, 2, time = 0, on_floor = TRUE, window_checks = TRUE) \
|
||||
new/datum/stack_recipe("fulltile reinforced window", /obj/structure/window/reinforced/fulltile/unanchored, 2, time = 0, on_floor = TRUE, window_checks = TRUE), \
|
||||
new/datum/stack_recipe("glass shard", /obj/item/shard, time = 0, on_floor = TRUE) \
|
||||
))
|
||||
|
||||
|
||||
@@ -175,7 +174,8 @@ GLOBAL_LIST_INIT(reinforced_glass_recipes, list ( \
|
||||
|
||||
GLOBAL_LIST_INIT(prglass_recipes, list ( \
|
||||
new/datum/stack_recipe("directional reinforced window", /obj/structure/window/plasma/reinforced/unanchored, time = 0, on_floor = TRUE, window_checks = TRUE), \
|
||||
new/datum/stack_recipe("fulltile reinforced window", /obj/structure/window/plasma/reinforced/fulltile/unanchored, 2, time = 0, on_floor = TRUE, window_checks = TRUE) \
|
||||
new/datum/stack_recipe("fulltile reinforced window", /obj/structure/window/plasma/reinforced/fulltile/unanchored, 2, time = 0, on_floor = TRUE, window_checks = TRUE), \
|
||||
new/datum/stack_recipe("plasma glass shard", /obj/item/shard/plasma, time = 0, on_floor = TRUE) \
|
||||
))
|
||||
|
||||
/obj/item/stack/sheet/plasmarglass
|
||||
@@ -198,7 +198,8 @@ GLOBAL_LIST_INIT(prglass_recipes, list ( \
|
||||
. += GLOB.prglass_recipes
|
||||
|
||||
GLOBAL_LIST_INIT(titaniumglass_recipes, list(
|
||||
new/datum/stack_recipe("shuttle window", /obj/structure/window/shuttle/unanchored, 2, time = 0, on_floor = TRUE, window_checks = TRUE)
|
||||
new/datum/stack_recipe("shuttle window", /obj/structure/window/shuttle/unanchored, 2, time = 0, on_floor = TRUE, window_checks = TRUE), \
|
||||
new/datum/stack_recipe("glass shard", /obj/item/shard, time = 0, on_floor = TRUE) \
|
||||
))
|
||||
|
||||
/obj/item/stack/sheet/titaniumglass
|
||||
@@ -217,7 +218,8 @@ GLOBAL_LIST_INIT(titaniumglass_recipes, list(
|
||||
. += GLOB.titaniumglass_recipes
|
||||
|
||||
GLOBAL_LIST_INIT(plastitaniumglass_recipes, list(
|
||||
new/datum/stack_recipe("plastitanium window", /obj/structure/window/plasma/reinforced/plastitanium/unanchored, 2, time = 0, on_floor = TRUE, window_checks = TRUE)
|
||||
new/datum/stack_recipe("plastitanium window", /obj/structure/window/plasma/reinforced/plastitanium/unanchored, 2, time = 0, on_floor = TRUE, window_checks = TRUE), \
|
||||
new/datum/stack_recipe("plasma glass shard", /obj/item/shard/plasma, time = 0, on_floor = TRUE) \
|
||||
))
|
||||
|
||||
/obj/item/stack/sheet/plastitaniumglass
|
||||
|
||||
@@ -20,3 +20,28 @@
|
||||
. = ..()
|
||||
pixel_x = rand(-4, 4)
|
||||
pixel_y = rand(-4, 4)
|
||||
|
||||
/**
|
||||
* Facilitates sheets being smacked on the floor
|
||||
*
|
||||
* This is used for crafting by hitting the floor with items.
|
||||
* The inital use case is glass sheets breaking in to shards when the floor is hit.
|
||||
* Args:
|
||||
* * user: The user that did the action
|
||||
* * params: paramas passed in from attackby
|
||||
*/
|
||||
/obj/item/stack/sheet/proc/on_attack_floor(mob/user, params)
|
||||
var/list/shards = list()
|
||||
for(var/datum/material/mat in custom_materials)
|
||||
if(mat.shard_type)
|
||||
var/obj/item/new_shard = new mat.shard_type(user.loc)
|
||||
new_shard.add_fingerprint(user)
|
||||
shards += "[new_shard.name]"
|
||||
if(!shards.len)
|
||||
return FALSE
|
||||
user.do_attack_animation(src, ATTACK_EFFECT_BOOP)
|
||||
playsound(src, "shatter", 70, TRUE)
|
||||
use(1)
|
||||
user.visible_message("<span class='notice'>[user] shatters the sheet of [name] on the floor, leaving [english_list(shards)].</span>", \
|
||||
"<span class='notice'>You shatter the sheet of [name] on the floor, leaving [english_list(shards)].</span>")
|
||||
return TRUE
|
||||
|
||||
Reference in New Issue
Block a user