mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-12 09:54:03 +00:00
* Refactors sheet crafting to better support directional construction (#74572)
## About The Pull Request
0426f7ddba/code/game/objects/items/stacks/stack.dm (L449)
Ok, but can we not?
This PR refactors sheet crafting to generalize all the cases that were
previously locked behind grille/window type checks and such. In their
stead there are bitflags that can be set to achieve certain behaviors.
All the behavior from before should be preserved, but now it can be
extended to other items. E.g. if you want a railing that can be crafted
underneath directional windows, or an item that behaves like a grille
does--it's just a matter of setting the right obj_flags for it now.
This makes it very simple and painless to add new recipes that use
directional crafting! It's all modular now.
<details><summary>Details</summary>
---
### What I've done:
-Eliminated all the type checks, instead it will now be handled by
object flags and recipe vars, making for a much more configurable
system.
-Added two new obj_flags: `BLOCKS_CONSTRUCTION_DIR` and
`IGNORE_DENSITY`.
-Additionally, I renamed the existing flag `NO_BUILD` to
`BLOCKS_CONSTRUCTION`.
-Changes the proc `valid_window_location` to `valid_build_direction`,
and makes it work for things other than windows.
-Removed a deprecated `window_checks` var from the stack_recipe datum.
-Added three more vars to the stack_recipe datum: `check_direction` and
`check_density`, `is_fulltile`
-Decoupled `on_solid_ground` from the object density check. Now you can
set those separately, allowing you to make recipes that forbid/allow
building things over other things while in space.
---
### What the new flags do:
`BLOCKS_CONSTRUCTION` works as before---prevents objects from being
built on the object. I felt that the previous name was not descriptive
enough, you should know exactly what it does just from looking at the
name.
_example: dna scanner_
`BLOCKS_CONSTRUCTION_DIR` -- setting this on an object will prevent
objects from being built on it when their directions are the same.
_example: directional windows, windoors, railings_
`IGNORE_DENSITY` -- setting this on an object will cause its density to
be ignored when performing the construction density check. This could
have other potential uses as well in the future.
_example: grilles, directional windows, tables_
These three flags cover all the bases for the types of items that are
currently craftable, so there is no more need for any type checking or
weird snowflake window checks. Simply set the appropriate flag and it'll
work as you would expect.
---
### What the recipe vars do:
`check_direction` tells the recipe to check if there's something in that
direction with the `BLOCKS_CONSTRUCTION_DIR` flag set.
`check_density` tells the recipe to run the density check when set. This
is true by default. There are very few items in the game that currently
have this set to false--namely grilles. Setting this to false will make
it so that the object can be constructed regardless of what is in that
tile (unless `one_per_turf` is also set, which will make it so that you
can't craft the same thing twice in the same turf).
`is_fulltile` is used for fulltile windows, but it doesn't necessarily
have to be--you can give this to any recipe and it will adopt the same
properties as that of the fulltile window. Basically they have a special
case where they shouldn't be able to be built over directional
constructions, where normally things would be able to be. Setting this
makes check_direction true as well.
---
### In summary:
Sheet crafting still works just as it did before. But the backend of it
has gotten a glow up and will be able to more easily support new
behaviors.
</details>
## Why It's Good For The Game
This makes the crafting system much more flexible to add recipes to, and
will prevent bad code practices of stacking more conditionals down the
line whenever someone wants to add an item that behaves like grilles or
directional windows in how they are constructed.
It had to be done. Those window checks were a mess.
## Changelog
🆑
qol: added fifty stack versions of remaining glass sheet stacks for ease
of debugging
refactor: refactored sheet crafting to better support directional
constructions that aren't windows
/🆑
---------
Co-authored-by: san7890 <the@ san7890.com>
* Refactors sheet crafting to better support directional construction
* fex
* https://github.com/Skyrat-SS13/Skyrat-tg/pull/20636
---------
Co-authored-by: Bloop <vinylspiders@gmail.com>
Co-authored-by: san7890 <the@ san7890.com>
Co-authored-by: Gandalf <9026500+Gandalf2k15@users.noreply.github.com>
105 lines
6.0 KiB
Plaintext
105 lines
6.0 KiB
Plaintext
// Flags for the obj_flags var on /obj
|
|
|
|
|
|
#define EMAGGED (1<<0)
|
|
#define IN_USE (1<<1) // If we have a user using us, this will be set on. We will check if the user has stopped using us, and thus stop updating and LAGGING EVERYTHING!
|
|
#define CAN_BE_HIT (1<<2) //can this be bludgeoned by items?
|
|
#define DANGEROUS_POSSESSION (1<<3) //Admin possession yes/no
|
|
#define UNIQUE_RENAME (1<<4) // can you customize the description/name of the thing?
|
|
#define USES_TGUI (1<<5) //put on things that use tgui on ui_interact instead of custom/old UI.
|
|
#define BLOCK_Z_OUT_DOWN (1<<6) // Should this object block z falling from loc?
|
|
#define BLOCK_Z_OUT_UP (1<<7) // Should this object block z uprise from loc?
|
|
#define BLOCK_Z_IN_DOWN (1<<8) // Should this object block z falling from above?
|
|
#define BLOCK_Z_IN_UP (1<<9) // Should this object block z uprise from below?
|
|
#define BLOCKS_CONSTRUCTION (1<<10) //! Does this object prevent things from being built on it?
|
|
#define BLOCKS_CONSTRUCTION_DIR (1<<11) //! Does this object prevent same-direction things from being built on it?
|
|
#define IGNORE_DENSITY (1<<12) //! Can we ignore density when building on this object? (for example, directional windows and grilles)
|
|
|
|
// If you add new ones, be sure to add them to /obj/Initialize as well for complete mapping support
|
|
|
|
// Flags for the item_flags var on /obj/item
|
|
|
|
#define BEING_REMOVED (1<<0)
|
|
#define IN_INVENTORY (1<<1) //is this item equipped into an inventory slot or hand of a mob? used for tooltips
|
|
#define FORCE_STRING_OVERRIDE (1<<2) // used for tooltips
|
|
///Used by security bots to determine if this item is safe for public use.
|
|
#define NEEDS_PERMIT (1<<3)
|
|
#define SLOWS_WHILE_IN_HAND (1<<4)
|
|
#define NO_MAT_REDEMPTION (1<<5) // Stops you from putting things like an RCD or other items into an ORM or protolathe for materials.
|
|
#define DROPDEL (1<<6) // When dropped, it calls qdel on itself
|
|
#define NOBLUDGEON (1<<7) // when an item has this it produces no "X has been hit by Y with Z" message in the default attackby()
|
|
#define ABSTRACT (1<<9) // for all things that are technically items but used for various different stuff <= wow thanks for the fucking insight sherlock
|
|
#define IMMUTABLE_SLOW (1<<10) // When players should not be able to change the slowdown of the item (Speed potions, etc)
|
|
#define IN_STORAGE (1<<11) //is this item in the storage item, such as backpack? used for tooltips
|
|
#define SURGICAL_TOOL (1<<12) //Tool commonly used for surgery: won't attack targets in an active surgical operation on help intent (in case of mistakes)
|
|
#define HAND_ITEM (1<<14) // If an item is just your hand (circled hand, slapper) and shouldn't block things like riding
|
|
#define EXAMINE_SKIP (1<<15) // Makes the Examine proc not read out this item.
|
|
#define XENOMORPH_HOLDABLE (1<<16) // A Xenomorph can hold this item.
|
|
#define NO_PIXEL_RANDOM_DROP (1<<17) //if dropped, it wont have a randomized pixel_x/pixel_y
|
|
///Can be equipped on digitigrade legs.
|
|
#define IGNORE_DIGITIGRADE (1<<18)
|
|
/// Has contextual screentips when HOVERING OVER OTHER objects
|
|
#define ITEM_HAS_CONTEXTUAL_SCREENTIPS (1 << 19)
|
|
/// No blood overlay is allowed to appear on this item, and it cannot gain blood DNA forensics
|
|
#define NO_BLOOD_ON_ITEM (1 << 20)
|
|
|
|
// Flags for the clothing_flags var on /obj/item/clothing
|
|
|
|
/// SUIT and HEAD items which stop lava from hurting the wearer
|
|
#define LAVAPROTECT (1<<0)
|
|
/// SUIT and HEAD items which stop pressure damage.
|
|
/// To stop you taking all pressure damage you must have both a suit and head item with this flag.
|
|
#define STOPSPRESSUREDAMAGE (1<<1)
|
|
/// blocks the effect that chemical clouds would have on a mob --glasses, mask and helmets ONLY!
|
|
#define BLOCK_GAS_SMOKE_EFFECT (1<<2)
|
|
/// mask allows internals
|
|
#define MASKINTERNALS (1<<3)
|
|
/// mask filters toxins and other harmful gases
|
|
#define GAS_FILTERING (1<<4)
|
|
/// prevents syringes, parapens and hypos if the external suit or helmet (if targeting head) has this flag.
|
|
/// Example: space suits, biosuit, bombsuits, thick suits that cover your body.
|
|
#define THICKMATERIAL (1<<5)
|
|
/// The voicebox in this clothing can be toggled.
|
|
#define VOICEBOX_TOGGLABLE (1<<6)
|
|
/// The voicebox is currently turned off.
|
|
#define VOICEBOX_DISABLED (1<<7)
|
|
/// Prevents shovies against a dense object from knocking the wearer down.
|
|
#define BLOCKS_SHOVE_KNOCKDOWN (1<<8)
|
|
/// Prevents knock-off from things like hat-throwing.
|
|
#define SNUG_FIT (1<<9)
|
|
/// Hats with negative effects when worn (i.e the tinfoil hat).
|
|
#define ANTI_TINFOIL_MANEUVER (1<<10)
|
|
/// Clothes that cause a larger notification when placed on a person.
|
|
#define DANGEROUS_OBJECT (1<<11)
|
|
/// Clothes that use large icons, for applying the proper overlays like blood
|
|
#define LARGE_WORN_ICON (1<<12)
|
|
/// Clothes that block speech (i.e the muzzle). Can be applied to any clothing piece.
|
|
#define BLOCKS_SPEECH (1<<13)
|
|
/// prevents from placing on plasmaman helmet
|
|
#define PLASMAMAN_HELMET_EXEMPT (1<<14)
|
|
/// Prevents plasmamen from igniting when wearing this
|
|
#define PLASMAMAN_PREVENT_IGNITION (1<<15)
|
|
/// Usable as casting clothes by wizards (matters for suits, glasses and headwear)
|
|
#define CASTING_CLOTHES (1<<16)
|
|
///Moths can't eat the clothing that has this flag.
|
|
#define INEDIBLE_CLOTHING (1<<17)
|
|
/// Headgear/helmet allows internals
|
|
#define HEADINTERNALS (1<<18)
|
|
|
|
/// Integrity defines for clothing (not flags but close enough)
|
|
#define CLOTHING_PRISTINE 0 // We have no damage on the clothing
|
|
#define CLOTHING_DAMAGED 1 // There's some damage on the clothing but it still has at least one functioning bodypart and can be equipped
|
|
#define CLOTHING_SHREDDED 2 // The clothing is useless and cannot be equipped unless repaired first
|
|
|
|
/// Flags for the pod_flags var on /obj/structure/closet/supplypod
|
|
#define FIRST_SOUNDS (1<<0) // If it shouldn't play sounds the first time it lands, used for reverse mode
|
|
|
|
/// Flags for the gun_flags var for firearms
|
|
#define TOY_FIREARM_OVERLAY (1<<0) // If update_overlay would add some indicator that the gun is a toy, like a plastic cap on a pistol
|
|
/// Currently used to identify valid guns to steal
|
|
#define NOT_A_REAL_GUN (1<<1)
|
|
|
|
/// Flags for sharpness in obj/item
|
|
#define SHARP_EDGED (1<<0)
|
|
#define SHARP_POINTY (1<<1)
|