Skip to content

Commit

Permalink
Merge pull request #10631 from ShadowLarkens/material_container
Browse files Browse the repository at this point in the history
Material Container Component & Autolathe QoL
  • Loading branch information
Arokha committed Jun 13, 2021
2 parents 8d4f7a9 + 1e9a6e0 commit 6dc1c76
Show file tree
Hide file tree
Showing 11 changed files with 688 additions and 132 deletions.
12 changes: 12 additions & 0 deletions code/__defines/materials.dm
Expand Up @@ -61,3 +61,15 @@
#define DEFAULT_WALL_MATERIAL "steel"

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

//Material Container Flags.
///If the container shows the amount of contained materials on examine.
#define MATCONTAINER_EXAMINE (1<<0)
///If the container cannot have materials inserted through attackby().
#define MATCONTAINER_NO_INSERT (1<<1)
///if the user can insert mats into the container despite the intent.
#define MATCONTAINER_ANY_INTENT (1<<2)
///if the user won't receive a warning when attacking the container with an unallowed item.
#define MATCONTAINER_SILENT (1<<3)

#define GET_MATERIAL_REF(arguments...) _GetMaterialRef(list(##arguments))
6 changes: 6 additions & 0 deletions code/_global_vars/typecache.dm
@@ -0,0 +1,6 @@
//please store common type caches here.
//type caches should only be stored here if used in mutiple places or likely to be used in mutiple places.

//Note: typecache can only replace istype if you know for sure the thing is at least a datum.

GLOBAL_LIST_INIT(typecache_stack, typecacheof(/obj/item/stack))
22 changes: 22 additions & 0 deletions code/datums/autolathe/autolathe.dm
Expand Up @@ -38,6 +38,28 @@
name = "All"
category_item_type = /datum/category_item/autolathe

// Copypasted from materials, they should show in All
/datum/category_group/autolathe/all/New()
..()

for(var/Name in name_to_material)
var/datum/material/M = name_to_material[Name]

if(!M.stack_type) // Shouldn't happen, but might. Never know.
continue

if(istype(M, /datum/material/alienalloy))
continue

var/obj/item/stack/material/S = M.stack_type
if(initial(S.name) in items_by_name)
continue

var/datum/category_item/autolathe/materials/WorkDat = new(src, M)

items |= WorkDat
items_by_name[WorkDat.name] = WorkDat

///datum/category_group/autolathe/all/New()

/datum/category_group/autolathe/arms
Expand Down

0 comments on commit 6dc1c76

Please sign in to comment.