Datumizes material effects, slots, and material spears (#95341)

This commit is contained in:
SmArtKar
2026-04-11 09:15:07 +10:00
committed by GitHub
parent f652747d2b
commit 93ea8085cb
47 changed files with 1441 additions and 294 deletions
+1 -1
View File
@@ -259,7 +259,7 @@ GLOBAL_LIST_INIT(spontaneous_fish_traits, populate_spontaneous_fish_traits())
/datum/fish_trait/carnivore/catch_weight_mod(obj/item/fishing_rod/rod, mob/fisherman, atom/location, obj/item/fish/fish_type)
. = ..()
if(istype(rod.get_master_material(), /datum/material/meat)) //who cares about the bait, that fishing rod is yummy!
if(IS_EDIBLE(rod)) //who cares about the bait, that fishing rod is yummy!
return
if(!rod.bait)
.[MULTIPLICATIVE_FISHING_MOD] = 0
+18 -3
View File
@@ -112,8 +112,17 @@
return
//check for materials required. For custom material items decode their required materials
var/list/materials_needed = list()
var/list/slots_chosen = null
for(var/material, amount_needed in design.materials)
if(ispath(material, /datum/material_requirement)) // Material requirement
var/datum/material_requirement/requirement = null
var/datum/material_slot/slot = null
if(ispath(material, /datum/material_requirement))
requirement = material
else if (ispath(material, /datum/material_slot))
slot = SSmaterials.material_slots[material]
requirement = slot.requirement_type
if(requirement) // Material requirement
for(var/datum/material/valid_candidate as anything in SSmaterials.get_materials_by_req(material))
if(materials.get_material_amount(valid_candidate) >= amount_needed)
material = valid_candidate
@@ -121,6 +130,9 @@
if(isnull(material))
return
materials_needed[material] = amount_needed
if (slot)
var/datum/material/proper_mat = material
LAZYSET(slots_chosen, slot.type, proper_mat.id)
if(!materials.has_materials(materials_needed))
return
@@ -129,9 +141,9 @@
flick_overlay_view(mutable_appearance(icon, "lathe_printing"), craft_time)
print_sound.start()
add_load(power_cost)
busy = addtimer(CALLBACK(src, PROC_REF(do_make_item), design, materials_needed), craft_time, TIMER_UNIQUE | TIMER_STOPPABLE | TIMER_DELETE_ME)
busy = addtimer(CALLBACK(src, PROC_REF(do_make_item), design, materials_needed, slots_chosen), craft_time, TIMER_UNIQUE | TIMER_STOPPABLE | TIMER_DELETE_ME)
/obj/machinery/power/manufacturing/lathe/proc/do_make_item(datum/design/design, list/materials_needed)
/obj/machinery/power/manufacturing/lathe/proc/do_make_item(datum/design/design, list/materials_needed, list/slots_chosen)
finalize_build()
if(surplus() < power_cost)
return
@@ -154,7 +166,10 @@
created = new stack_item(drop_location(), amount)
else
created = design.create_result(drop_location(), materials_needed)
if (length(slots_chosen))
created.set_material_slots(slots_chosen)
split_materials_uniformly(materials_needed, target_object = created)
if(isitem(created))
created.pixel_x = created.base_pixel_x + rand(-6, 6)
created.pixel_y = created.base_pixel_y + rand(-6, 6)
@@ -189,7 +189,7 @@
accepted_magazine_type = /obj/item/ammo_box/magazine/r10mm
actions_types = list(/datum/action/item_action/toggle_firemode)
obj_flags = UNIQUE_RENAME // if you did the sidequest, you get the customization
custom_materials = list(/datum/material/gold = SHEET_MATERIAL_AMOUNT * 30, /datum/material/silver = SHEET_MATERIAL_AMOUNT * 25, /datum/material/iron = SHEET_MATERIAL_AMOUNT * 11.5)
custom_materials = list(/datum/material/gold = SHEET_MATERIAL_AMOUNT * 30, /datum/material/silver = SHEET_MATERIAL_AMOUNT * 25, /datum/material/iron = SHEET_MATERIAL_AMOUNT * 11.5, /datum/material/telecrystal = SHEET_MATERIAL_AMOUNT * 4)
/obj/item/gun/ballistic/automatic/pistol/aps
name = "\improper Stechkin APS machine pistol"
@@ -3023,6 +3023,12 @@
target.set_custom_materials()
var/list/metal_dat = list((metal_ref) = metal_amount)
target.material_flags = applied_material_flags
if (target.has_material_slots())
var/list/new_slots = target.get_material_slots()
for (var/slot_type in new_slots)
new_slots[slot_type] = metal_ref
// Safe to call and doesn't do anything as no materials are currently present on the target
target.set_material_slots(new_slots)
target.set_custom_materials(metal_dat)
/datum/reagent/gravitum
+1 -1
View File
@@ -70,7 +70,7 @@ other types of metals and chemistry for reagents).
var/list/temp_list = list()
// Go through all of our materials, get the subsystem instance, and then replace the list.
for(var/mat_type, amount in materials)
if(ispath(mat_type, /datum/material_requirement))
if(ispath(mat_type, /datum/material_requirement) || ispath(mat_type, /datum/material_slot))
temp_list[mat_type] = amount
continue
@@ -626,7 +626,7 @@
desc = "A mace fit for a cleric. Useful for bypassing plate armor, but too bulky for much else."
id = "cleric_mace"
build_type = AUTOLATHE
materials = list(/datum/material_requirement/solid_material = SHEET_MATERIAL_AMOUNT * 4.5, /datum/material_requirement/rigid_material = SHEET_MATERIAL_AMOUNT * 1.5)
materials = list(/datum/material_slot/weapon_head = SHEET_MATERIAL_AMOUNT * 4.5, /datum/material_slot/handle = SHEET_MATERIAL_AMOUNT * 1.5)
build_path = /obj/item/melee/cleric_mace
category = list(RND_CATEGORY_IMPORTED)
@@ -1122,7 +1122,7 @@ GLOBAL_LIST_INIT(slime_extract_auto_activate_reactions, init_slime_auto_activate
///Definitions for slime products that don't have anywhere else to go (Floor tiles, blueprints).
/obj/item/stack/tile/bluespace
name = "bluespace floor tile"
name = "stabilized bluespace floor tile"
singular_name = "floor tile"
desc = "Through a series of micro-teleports these tiles let people move at incredible speeds."
icon_state = "tile_bluespace"