mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-25 06:00:16 +01:00
Refactor girders and wall construction (#94364)
## About The Pull Request This PR refactors wall construction on girders, wooden barricades and metal foam to use a centralized element, which listens to item interaction signals and attempts to make any available wall recipe. This change is an atomized prerequisite to my blueprinting system, since that system requires a sane way to dynamically change the speed at which walls are built. This PR will later be expanded to refactor girder construction steps in general. I also added `proc/valid_typesof(base_type)` as a side effect of my previous attempts at refactoring this stuff. There's now what amounts to a code comment easter egg in the same file, because DM is wacko and you're going to get cursed now too. :) ## Why It's Good For The Game The old system had ~20 bespoke yet highly similar wall construction steps. Some of the wall recipes were also concatenated from a string on the used stack type. To put it bluntly, the code was fucking horrible. Same thing goes for the rest of the girder construction steps, they were all bespoke. ## Changelog 🆑 refactor: Refactored girders and wall construction. Report any bugs. tweak: Some niche wall types might have their wall delay changed by like 2 seconds. This doesn't affect normal walls, reinforced walls, falsewalls or any other important wall types. /🆑
This commit is contained in:
@@ -324,6 +324,7 @@
|
||||
/obj/structure/foamedmetal/Initialize(mapload)
|
||||
. = ..()
|
||||
air_update_turf(TRUE, TRUE)
|
||||
AddElement(/datum/element/uses_girder_wall_recipes)
|
||||
|
||||
/obj/structure/foamedmetal/Destroy()
|
||||
air_update_turf(TRUE, FALSE)
|
||||
@@ -349,37 +350,6 @@
|
||||
to_chat(user, span_warning("You hit [src] but bounce off it!"))
|
||||
playsound(src.loc, 'sound/items/weapons/tap.ogg', 100, TRUE)
|
||||
|
||||
/obj/structure/foamedmetal/attackby(obj/item/W, mob/user, list/modifiers, list/attack_modifiers)
|
||||
///A speed modifier for how fast the wall is build
|
||||
var/platingmodifier = 1
|
||||
if(HAS_TRAIT(user, TRAIT_QUICK_BUILD))
|
||||
platingmodifier = 0.7
|
||||
if(next_beep <= world.time)
|
||||
next_beep = world.time + 1 SECONDS
|
||||
playsound(src, 'sound/machines/clockcult/integration_cog_install.ogg', 50, TRUE)
|
||||
add_fingerprint(user)
|
||||
|
||||
if(!istype(W, /obj/item/stack/sheet))
|
||||
return ..()
|
||||
|
||||
var/obj/item/stack/sheet/sheet_for_plating = W
|
||||
if(istype(sheet_for_plating, /obj/item/stack/sheet/iron))
|
||||
if(sheet_for_plating.get_amount() < 2)
|
||||
to_chat(user, span_warning("You need two sheets of iron to finish a wall on [src]!"))
|
||||
return
|
||||
to_chat(user, span_notice("You start adding plating to the foam structure..."))
|
||||
if (do_after(user, 40 * platingmodifier, target = src))
|
||||
if(!sheet_for_plating.use(2))
|
||||
return
|
||||
to_chat(user, span_notice("You add the plating."))
|
||||
var/turf/T = get_turf(src)
|
||||
T.place_on_top(/turf/closed/wall/metal_foam_base)
|
||||
transfer_fingerprints_to(T)
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
add_hiddenprint(user)
|
||||
|
||||
/// A metal foam variant which produces slightly sturdier walls.
|
||||
/obj/effect/particle_effect/fluid/foam/metal/iron
|
||||
name = "iron foam"
|
||||
|
||||
Reference in New Issue
Block a user