Skip to content

Commit

Permalink
Lathe/Design/Materials refactoring + misc changes (#5123)
Browse files Browse the repository at this point in the history
## About The Pull Request

rewrites lathes 
they are now embeddable within other interfaces, have unified controls +
queue management, and have support for using

- materials
- reagents
- even using / transforming existing items

rewrites /datum/design to be semi-singletons
adds SSresearch to hold designs
rewrites atom material system a bit

also:

- adds MIT license identifiers to some of my old TGUI work of which I am
the only one on the git history. i'd like to keep the tgui section and
my own code samples in there as MIT instead of AGPL.
- removes vorestation id restorers from maps because they're unused
nowadays
- removes partslathe as they're basically just unused
- Revamps sheetmaterials stylesheet as it really didn't need to just be
stacks.dmi

## Why It's Good For The Game

lathes sorely needed a redo
we want good materials support ontop of that.
also fixes autolathes :)

the "also" part is already covered above.

## Changelog

:cl:
refactor: lathes are completely rewritten
fix: autolathe x5 and x10 buttons
del: autolathes can no longer be hacked. all hacked recipes are instead
accessible as normal recipes.
del: partslathes - redundant
del: id restoration consoles - unused / prohibited by server rules
/:cl:

---------

Co-authored-by: silicons <[email protected]>
  • Loading branch information
silicons and silicons authored Jul 8, 2023
1 parent 2359c54 commit 749579b
Show file tree
Hide file tree
Showing 406 changed files with 8,175 additions and 8,089 deletions.
134 changes: 104 additions & 30 deletions citadel.dme

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion code/__DEFINES/_flags/atom_flags.dm
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
/// should not get harmed if this gets caught by an explosion?
#define PREVENT_CONTENTS_EXPLOSION (1<<22)
*/
#define HTML_USE_INITAL_ICON (1<<23)
#define HTML_USE_INITIAL_ICON (1<<23)

DEFINE_BITFIELD(atom_flags, list(
BITFIELD(ATOM_INITIALIZED),
Expand All @@ -56,6 +56,7 @@ DEFINE_BITFIELD(atom_flags, list(
BITFIELD(OPENCONTAINER),
BITFIELD(PHORONGUARD),
BITFIELD(NOPRINT),
BITFIELD(HTML_USE_INITIAL_ICON),
))

//! /atom/movable/var/movable_flags
Expand Down
11 changes: 10 additions & 1 deletion code/__DEFINES/_flags/item_flags.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#define ITEM_NOBLUDGEON (1<<2)
/// for all things that are technically items but used for various different stuff
#define ITEM_ABSTRACT (1<<3)
/// is this item in a storage component?
/// is this item in a storage datum?
#define ITEM_IN_STORAGE (1<<4)
/// we can't be caught when hitting a mob on throw
#define ITEM_THROW_UNCATCHABLE (1<<5)
Expand All @@ -17,6 +17,12 @@
#define ITEM_MULTIHAND_WIELDED (1<<7)
/// don't allow help intent attacking
#define ITEM_CAREFUL_BLUDGEON (1<<8)
/// allow easy lathe deconstruction
#define ITEM_EASY_LATHE_DECONSTRUCT (1<<9)
/// do not allow lathe deconstruction
#define ITEM_NO_LATHE_DECONSTRUCT (1<<10)
/// stack-like handling for ingredients
#define ITEM_MASS_INGREDIENT (1<<11)

DEFINE_BITFIELD(item_flags, list(
BITFIELD(ITEM_IN_INVENTORY),
Expand All @@ -28,6 +34,9 @@ DEFINE_BITFIELD(item_flags, list(
BITFIELD(ITEM_NO_TOOL_ATTACK),
BITFIELD(ITEM_MULTIHAND_WIELDED),
BITFIELD(ITEM_CAREFUL_BLUDGEON),
BITFIELD(ITEM_EASY_LATHE_DECONSTRUCT),
BITFIELD(ITEM_NO_LATHE_DECONSTRUCT),
BITFIELD(ITEM_MASS_INGREDIENT),
))

//! Flags for the clothing_flags var on /obj/item
Expand Down
5 changes: 5 additions & 0 deletions code/__DEFINES/_lists.dm
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@
// Returns the key based on the index
#define KEYBYINDEX(L, index) (((index <= length(L)) && (index > 0)) ? L[index] : null)

/// sanitize a lazy null-or-entry-or-list into always a list
#define COERCE_OPTIONS_LIST(Entry) (islist(Entry)? Entry : (isnull(Entry)? list() : list(Entry)))
/// COERCE_OPTIONS_LIST but does it to an existing variablew.
#define COERCE_OPTIONS_LIST_IN(Variable) Variable = COERCE_OPTIONS_LIST(Variable)

/// Passed into BINARY_INSERT to compare keys
#define COMPARE_KEY __BIN_LIST[__BIN_MID]
/// Passed into BINARY_INSERT to compare values
Expand Down
5 changes: 2 additions & 3 deletions code/__DEFINES/controllers/_subsystems.dm
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,15 @@ DEFINE_BITFIELD(runlevels, list(
#define INIT_ORDER_INSTRUMENTS 50
#define INIT_ORDER_EARLY_ASSETS 48
#define INIT_ORDER_CHEMISTRY 35
#define INIT_ORDER_MATERIALS 30
#define INIT_ORDER_MATERIALS 34
#define INIT_ORDER_PHOTOGRAPHY 27
#define INIT_ORDER_MAPPING 25
#define INIT_ORDER_LEGACY_ATC 24
#define INIT_ORDER_LEGACY_LORE 23
#define INIT_ORDER_LOBBY 22
#define INIT_ORDER_DECALS 20
#define INIT_ORDER_PLANTS 19
#define INIT_ORDER_ALARMS 18
#define INIT_ORDER_RESEARCH 17
#define INIT_ORDER_ATOMS 15
#define INIT_ORDER_MACHINES 10
#define INIT_ORDER_SHUTTLES 3
Expand All @@ -126,7 +126,6 @@ DEFINE_BITFIELD(runlevels, list(
#define INIT_ORDER_CIRCUIT -60
#define INIT_ORDER_AI -70
#define INIT_ORDER_PATH -98
#define INIT_ORDER_OPENSPACE -99
#define INIT_ORDER_CHAT -100 //! Should be last to ensure chat remains smooth during init.


Expand Down
41 changes: 41 additions & 0 deletions code/__DEFINES/datums/design.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
//? lathe_type bitfield

#define LATHE_TYPE_AUTOLATHE (1<<0)
#define LATHE_TYPE_PROTOLATHE (1<<1)
#define LATHE_TYPE_CIRCUIT (1<<2)
#define LATHE_TYPE_PROSTHETICS (1<<3)
#define LATHE_TYPE_MECHA (1<<4)
#define LATHE_TYPE_BIOPRINTER (1<<5)

DEFINE_BITFIELD(lathe_type, list(
BITFIELD(LATHE_TYPE_AUTOLATHE),
BITFIELD(LATHE_TYPE_PROTOLATHE),
BITFIELD(LATHE_TYPE_CIRCUIT),
BITFIELD(LATHE_TYPE_PROSTHETICS),
BITFIELD(LATHE_TYPE_MECHA),
BITFIELD(LATHE_TYPE_BIOPRINTER),
))

//? design_unlock bitfield

/// any lathe that can print us should have us always
#define DESIGN_UNLOCK_INTRINSIC (1<<0)
/// any lathe that can print us can have us uploaded
#define DESIGN_UNLOCK_UPLOAD (1<<1)

DEFINE_BITFIELD(design_unlock, list(
BITFIELD(DESIGN_UNLOCK_INTRINSIC),
BITFIELD(DESIGN_UNLOCK_UPLOAD),
))

//? design_flags bitfield

/// do not scale with efficiency
#define DESIGN_NO_SCALE (1<<0)
/// unit tests should ignore the lack of materials
#define DESIGN_IGNORE_RESOURCE_SANITY (1<<2)

DEFINE_BITFIELD(design_flags, list(
BITFIELD(DESIGN_NO_SCALE),
BITFIELD(DESIGN_IGNORE_RESOURCE_SANITY),
))
36 changes: 36 additions & 0 deletions code/__DEFINES/ingredients.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
//? types; sync to tgui when modifying.

#define INGREDIENT_DATA_TYPE "type" //! type of ingredient
#define INGREDIENT_DATA_AMOUNT "amt" //! amount to use; what this means depends on type
#define INGREDIENT_DATA_ALLOW "allow" //! what to allow; data depends on type
#define INGREDIENT_DATA_NAME "name" //! name in selection uis
#define INGREDIENT_DATA_KEY "key" //! what's passed back from use ingredients

/**
* select: material id
* amount: sheets
* allowed: null for any, otherwise list of material ids
* return: material id
*/
#define INGREDIENT_TYPE_MATERIAL "material"
/**
* select: reagent id
* amount: units
* allowed: null for any, otherwise list of reagent ids
* return: reagent id
*/
#define INGREDIENT_TYPE_REAGENT "reagent"
/**
* select: stack path
* amount: stack amount
* allowed: null for any, otherwise list of typepaths
* return: stack path
*/
#define INGREDIENT_TYPE_STACK "stack"
/**
* select: item ref
* amount: item count
* allowed: null for any, otherwise list of typepaths, associate TRUE to enforce exact, otherwise subtypes work
* return: list of item instances; all selected items are deleted if unkeyed
*/
#define INGREDIENT_TYPE_ITEM "item"
6 changes: 6 additions & 0 deletions code/__DEFINES/materials/balancing.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//? master file for balancing / efficiency tuning

//* efficiency

/// scale a lathe's efficiency to upgrade level
#define MATERIAL_EFFICIENCY_LATHE_SCALE(tier) max(0, 1.1 - tier * 0.1)
60 changes: 60 additions & 0 deletions code/__DEFINES/materials/misc.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@

// Material Defines
#define MAT_BANANIUM "bananium"
#define MAT_CARBON "carbon"
#define MAT_CHITIN "chitin"
#define MAT_COPPER "copper"
#define MAT_DIAMOND "diamond"
#define MAT_DURASTEEL "durasteel"
#define MAT_DURASTEELHULL "durasteel hull"
#define MAT_GLASS "glass"
#define MAT_GOLD "gold"
#define MAT_GRAPHITE "graphite"
#define MAT_HARDLOG "hardwood log"
#define MAT_HARDWOOD "hardwood"
#define MAT_HEMATITE "hematite"
#define MAT_IRON "iron"
#define MAT_LEAD "lead"
#define MAT_LEATHER "leather"
#define MAT_LOG "log"
#define MAT_MARBLE "marble"
#define MAT_METALHYDROGEN "mhydrogen"
#define MAT_MORPHIUM "morphium"
#define MAT_MORPHIUMHULL "morphium hull"
#define MAT_OSMIUM "osmium"
#define MAT_PHORON "phoron"
#define MAT_PLASTEEL "plasteel"
#define MAT_PLASTEELHULL "plasteel hull"
#define MAT_PLASTIC "plastic"
#define MAT_PLATINUM "platinum"
#define MAT_SIFLOG "alien log"
#define MAT_SIFWOOD "alien wood"
#define MAT_SILENCIUM "silencium"
#define MAT_SILVER "silver"
#define MAT_SNOW "snow"
#define MAT_STEEL "steel"
#define MAT_STEELHULL "steel hull"
#define MAT_SUPERMATTER "supermatter"
#define MAT_TITANIUM "titanium"
#define MAT_TITANIUMHULL "titanium hull"
#define MAT_URANIUM "uranium"
#define MAT_VALHOLLIDE "valhollide"
#define MAT_VAUDIUM "vaudium"
#define MAT_VERDANTIUM "verdantium"
#define MAT_WOOD "wood"


#define SHARD_SHARD "shard"
#define SHARD_SHRAPNEL "shrapnel"
#define SHARD_STONE_PIECE "piece"
#define SHARD_SPLINTER "splinters"
#define SHARD_NONE ""

#define MATERIAL_UNMELTABLE 0x1
#define MATERIAL_BRITTLE 0x2
#define MATERIAL_PADDING 0x4

/// Amount table damage is multiplied by if it is made of a brittle material (e.g. glass)
#define TABLE_BRITTLE_MATERIAL_MULTIPLIER 4

#define SHEET_MATERIAL_AMOUNT 2000
59 changes: 0 additions & 59 deletions code/__DEFINES/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -131,65 +131,6 @@ Will print: "/mob/living/carbon/human/death" (you can optionally embed it in a s
#define WALL_CAN_OPEN 1
#define WALL_OPENING 2


// Material Defines
#define MAT_BANANIUM "bananium"
#define MAT_CARBON "carbon"
#define MAT_CHITIN "chitin"
#define MAT_COPPER "copper"
#define MAT_DIAMOND "diamond"
#define MAT_DURASTEEL "durasteel"
#define MAT_DURASTEELHULL "durasteel hull"
#define MAT_GLASS "glass"
#define MAT_GOLD "gold"
#define MAT_GRAPHITE "graphite"
#define MAT_HARDLOG "hardwood log"
#define MAT_HARDWOOD "hardwood"
#define MAT_HEMATITE "hematite"
#define MAT_IRON "iron"
#define MAT_LEAD "lead"
#define MAT_LEATHER "leather"
#define MAT_LOG "log"
#define MAT_MARBLE "marble"
#define MAT_METALHYDROGEN "mhydrogen"
#define MAT_MORPHIUM "morphium"
#define MAT_MORPHIUMHULL "morphium hull"
#define MAT_OSMIUM "osmium"
#define MAT_PHORON "phoron"
#define MAT_PLASTEEL "plasteel"
#define MAT_PLASTEELHULL "plasteel hull"
#define MAT_PLASTIC "plastic"
#define MAT_PLATINUM "platinum"
#define MAT_SIFLOG "alien log"
#define MAT_SIFWOOD "alien wood"
#define MAT_SILENCIUM "silencium"
#define MAT_SILVER "silver"
#define MAT_SNOW "snow"
#define MAT_STEEL "steel"
#define MAT_STEELHULL "steel hull"
#define MAT_SUPERMATTER "supermatter"
#define MAT_TITANIUM "titanium"
#define MAT_TITANIUMHULL "titanium hull"
#define MAT_URANIUM "uranium"
#define MAT_VALHOLLIDE "valhollide"
#define MAT_VAUDIUM "vaudium"
#define MAT_VERDANTIUM "verdantium"
#define MAT_WOOD "wood"


#define SHARD_SHARD "shard"
#define SHARD_SHRAPNEL "shrapnel"
#define SHARD_STONE_PIECE "piece"
#define SHARD_SPLINTER "splinters"
#define SHARD_NONE ""

#define MATERIAL_UNMELTABLE 0x1
#define MATERIAL_BRITTLE 0x2
#define MATERIAL_PADDING 0x4

/// Amount table damage is multiplied by if it is made of a brittle material (e.g. glass)
#define TABLE_BRITTLE_MATERIAL_MULTIPLIER 4

#define BOMBCAP_DVSTN_RADIUS (max_explosion_range/4)
#define BOMBCAP_HEAVY_RADIUS (max_explosion_range/2)
#define BOMBCAP_LIGHT_RADIUS max_explosion_range
Expand Down
45 changes: 40 additions & 5 deletions code/__DEFINES/power/balancing.dm
Original file line number Diff line number Diff line change
@@ -1,14 +1,49 @@
//? master file for balancing / efficiency tuning

//* Machinery
/// Idle usage of a nanite chamber in watts
#define POWER_USAGE_NANITE_CHAMBER_IDLE 100
/// Active usage of a nanite chamber in watts
#define POWER_USAGE_NANITE_CHAMBER_ACTIVE 5000
//* Cells

/// the closest thing we'll get to a cvar - cellrate is kJ per cell unit. kJ to avoid float precision loss.
GLOBAL_VAR_INIT(cellrate, 0.5)
/**
* current calculations
* cellrate 0.5 = 0.5 kj/unit
* for 10k cell, 5000kj
* 1 Wh = 60J-S*60s/m = 3600J = 3.6kJ
* 10k cell --> 1388.89 Wh
* damn, future cells be pogging
*/
/// the closest thing we'll get to a cvar - affects cell use_scaled - higher = things use less energy. handheld devices usually use this.
GLOBAL_VAR_INIT(cellefficiency, 1)

//* Computers

/// Idle usage of a mid-range control computer in watts
#define POWER_USAGE_COMPUTER_MID_IDLE 50
/// Active usage of a mid-range control computer in watts
#define POWER_USAGE_COMPUTER_MID_ACTIVE 500

//* Equipment

/// cost of shield difussion in cell units
#define CELL_COST_SHIELD_DIFFUSION 120

//* Machinery

/// idle power usage of a lathe in watts
#define POWER_USAGE_LATHE_IDLE 25
/// active power usage of lathe scaling to decisecond work unit (e.g. 4x speed lathe is 4 for input) in watts
#define POWER_USAGE_LATHE_ACTIVE_SCALE(factor) (factor * 1000)
/// Idle usage of a nanite chamber in watts
#define POWER_USAGE_NANITE_CHAMBER_IDLE 100
/// Active usage of a nanite chamber in watts
#define POWER_USAGE_NANITE_CHAMBER_ACTIVE 5000

//* Misc

//#define THERMOMACHINE_CHEAT_FACTOR 1
#define RECHARGER_CHEAT_FACTOR 5
#define SYNTHETIC_NUTRITION_KJ_PER_UNIT 10
#define SYNTHETIC_NUTRITION_INDUCER_CHEAT_FACTOR 2
#define CYBORG_POWER_USAGE_MULTIPLIER 2
#define SPACE_HEATER_CHEAT_FACTOR 1.5
#define THERMOREGULATOR_CHEAT_FACTOR 5
Loading

0 comments on commit 749579b

Please sign in to comment.