Skip to content

Commit

Permalink
Merge pull request #4648 from NebulaSS13/staging
Browse files Browse the repository at this point in the history
Updating dev from staging.
  • Loading branch information
MistakeNot4892 authored Dec 17, 2024
2 parents 1611b60 + 30d996e commit ca72a10
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 16 deletions.
6 changes: 1 addition & 5 deletions code/game/objects/items/__item.dm
Original file line number Diff line number Diff line change
Expand Up @@ -319,11 +319,7 @@
var/list/available_recipes = list()
for(var/decl/crafting_stage/initial_stage in SSfabrication.find_crafting_recipes(type))
if(initial_stage.can_begin_with(src) && ispath(initial_stage.completion_trigger_type))
var/atom/movable/prop = initial_stage.completion_trigger_type
if(initial_stage.stack_consume_amount > 1)
available_recipes[initial_stage] = "[initial_stage.stack_consume_amount] [initial(prop.name)]\s"
else
available_recipes[initial_stage] = "\a [initial(prop.name)]"
available_recipes[initial_stage] = initial_stage.generate_completion_string()

if(length(available_recipes))

Expand Down
40 changes: 29 additions & 11 deletions code/modules/crafting/slapcrafting/_crafting_holder.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,32 +13,41 @@
var/list/next_products = list()
for(var/decl/crafting_stage/next_stage in current_crafting_stage.next_stages)
if(ispath(next_stage.completion_trigger_type))
var/atom/next_tool = next_stage.completion_trigger_type
var/tool_string = initial(next_tool.name)
if(next_stage.stack_consume_amount > 1)
tool_string = "[next_stage.stack_consume_amount] [tool_string]\s"
else
tool_string = "\a [tool_string]"
var/tool_string = next_stage.generate_completion_string()
if(ispath(next_stage.product))
var/atom/next_product = next_stage.product
next_products[tool_string] = "\a [initial(next_product.name)]"
else
next_steps += tool_string

if(length(next_products))
for(var/thing in next_products)
to_chat(user, SPAN_NOTICE("With <b>[thing]</b>, you could finish building <b>[next_products[thing]]</b>."))
if(length(next_steps))
to_chat(user, SPAN_NOTICE("You could continue to work on this with <b>[english_list(next_steps, and_text = " or ")]</b>."))

/obj/item/crafting_holder/Initialize(var/ml, var/decl/crafting_stage/initial_stage, var/obj/item/target, var/obj/item/tool, var/mob/user)

. = ..(ml)
if(!initial_stage)
return INITIALIZE_HINT_QDEL

name = "[target.name] assembly"
var/mob/M = target.loc
if(istype(M))

// Move our component into the new holder.
if(ismob(target.loc))
var/mob/M = target.loc
M.drop_from_inventory(target)
target.forceMove(src)
target.forceMove(src)
else if(ismovable(target.loc))
var/atom/movable/holder = target.loc
if(holder.storage)
holder.storage.remove_from_storage(user, target, src)
else
target.forceMove(src)
else
target.forceMove(src)

current_crafting_stage = initial_stage
update_icon()
update_strings()
Expand Down Expand Up @@ -78,9 +87,18 @@
if(ismob(product) && label_name)
var/mob/M = product
M.SetName(label_name)
if(ismob(src.loc))
var/mob/M = src.loc

if(ismob(loc))
var/mob/M = loc
M.drop_from_inventory(src)
else if(ismovable(loc))
var/atom/movable/holder = loc
if(holder.storage)
holder.storage.remove_from_storage(user, src, get_turf(src))
else
forceMove(get_turf(src))
else
forceMove(get_turf(src))
qdel_self()
else
current_crafting_stage = next_stage
Expand Down
30 changes: 30 additions & 0 deletions code/modules/crafting/slapcrafting/_crafting_stage.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,28 @@
stages += GET_DECL(nid)
next_stages = stages

/decl/crafting_stage/proc/generate_completion_string()
var/list/names = assemble_name_strings()
if(ispath(completion_trigger_type, /obj/item/stack) || stack_consume_amount)
names.Insert(1, max(stack_consume_amount, 1))
return jointext(names, " ")

/decl/crafting_stage/proc/assemble_name_strings()
SHOULD_CALL_PARENT(TRUE)
var/list/names = list()
var/obj/item/prop = completion_trigger_type
if(ispath(prop, /obj/item/stack))
var/obj/item/stack/stack = prop
if(stack_consume_amount == 1)
names += stack::singular_name
else
names += stack::plural_name
else if(stack_consume_amount > 1)
names += "[prop::name]\s"
else
names += prop::name
return names

/decl/crafting_stage/proc/is_available()
return global.using_map.map_tech_level >= available_to_map_tech_level

Expand Down Expand Up @@ -89,6 +111,14 @@
consume_completion_trigger = FALSE
var/stack_material = /decl/material/solid/metal/steel

/decl/crafting_stage/material/assemble_name_strings()
var/list/names = ..()
if(stack_material)
var/decl/material/mat = GET_DECL(stack_material)
if(mat)
names.Insert(1, mat.solid_name)
return names

/decl/crafting_stage/material/consume_crafting_resource(var/mob/user, var/obj/item/thing, var/obj/item/target)
var/obj/item/stack/material/M = thing
. = istype(M) && (!stack_material || M.material.type == stack_material) && ..()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
reagent_overlay = "soup_chunks"
nutriment_factor = 10
allergen_flags = ALLERGEN_MEAT
affect_blood_on_ingest = 0
affect_blood_on_inhale = 0

/decl/material/solid/organic/meat/egg
name = "egg yolk"
Expand Down
1 change: 1 addition & 0 deletions code/modules/reagents/chems/chems_drinks.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
nutriment_factor = 0
hydration_factor = 6
affect_blood_on_ingest = FALSE
affect_blood_on_inhale = FALSE

var/adj_dizzy = 0 // Per tick
var/adj_drowsy = 0
Expand Down
2 changes: 2 additions & 0 deletions code/modules/reagents/chems/chems_nutriment.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
fishing_bait_value = 0.65
compost_value = 1
nutriment_factor = 10
affect_blood_on_ingest = 0
affect_blood_on_inhale = 0

// Technically a room-temperature solid, but saves
// repathing it to /solid all over the codebase.
Expand Down

0 comments on commit ca72a10

Please sign in to comment.