Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding metalwork. #3818

Merged
merged 1 commit into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions code/__defines/skills.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#define SKILL_PROF 5
#define HAS_PERK SKILL_NONE + 1

#define SKILL_IMPOSSIBLE INFINITY

#define SKILL_MIN 1 // Min skill value selectable
#define SKILL_MAX 5 // Max skill value selectable
#define SKILL_DEFAULT 4 //most mobs will default to this
Expand Down
14 changes: 13 additions & 1 deletion code/game/atoms_movable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,7 @@
/atom/movable/proc/get_object_size()
return ITEM_SIZE_NORMAL

// TODO: account for reagents and matter.
/atom/movable/get_thermal_mass()
if(!simulated)
return 0
Expand All @@ -496,7 +497,18 @@
if(!held_slot || !istype(holder) || QDELETED(holder) || loc != holder)
return

// TODO: check protective gear
// TODO: put these flags on the inventory slot or something.
var/check_slots
if(held_slot in global.all_hand_slots)
check_slots = SLOT_HANDS
else if(held_slot == BP_MOUTH || held_slot == BP_HEAD)
check_slots = SLOT_FACE

if(check_slots)
for(var/obj/item/covering in holder.get_covering_equipped_items(check_slots))
if(covering.max_heat_protection_temperature >= temperature)
return

// TODO: less simplistic messages and logic
var/datum/inventory_slot/slot = held_slot && holder.get_inventory_slot_datum(held_slot)
var/check_organ = slot?.requires_organ_tag
Expand Down
46 changes: 23 additions & 23 deletions code/game/objects/items/__item.dm
Original file line number Diff line number Diff line change
Expand Up @@ -229,15 +229,16 @@
return FALSE

/obj/item/examine(mob/user, distance)
var/desc_comp = "" //For "description composite"
desc_comp += "It is a [w_class_description()] item.<BR>"

var/list/desc_comp = list()
desc_comp += "It is a [w_class_description()] item."

var/desc_damage = get_examined_damage_string()
if(length(desc_damage))
desc_comp += "[desc_damage]<BR>"
desc_comp += "[desc_damage]"

if(paint_color)
desc_comp += "\The [src] has been <font color='[paint_color]'>[paint_verb]</font>.<BR>"
desc_comp += "\The [src] has been <font color='[paint_color]'>[paint_verb]</font>."

var/added_header = FALSE
if(user?.get_preference_value(/datum/client_preference/inquisitive_examine) == PREF_ON)
Expand All @@ -255,18 +256,17 @@

if(!added_header)
added_header = TRUE
desc_comp += "*--------*<BR>"
desc_comp += "*--------*"

for(var/decl/crafting_stage/initial_stage in available_recipes)
desc_comp += SPAN_NOTICE("With [available_recipes[initial_stage]], you could start making \a [initial_stage.descriptor] out of this.")
desc_comp += "<BR>"
desc_comp += "*--------*<BR>"
desc_comp += "*--------*"

if(distance <= 1 && has_extension(src, /datum/extension/loaded_cell))

if(!added_header)
added_header = TRUE
desc_comp += "*--------*<BR>"
desc_comp += "*--------*"

var/datum/extension/loaded_cell/cell_loaded = get_extension(src, /datum/extension/loaded_cell)
var/obj/item/cell/loaded_cell = cell_loaded?.get_cell()
Expand All @@ -276,39 +276,37 @@
if(current_cell && current_cell != loaded_cell)
desc_comp += SPAN_NOTICE("\The [src] is using an external [current_cell.name] as a power supply.")
else
desc_comp += jointext(cell_loaded.get_examine_text(current_cell), "<BR>")
desc_comp += "<BR>*--------*<BR>"
desc_comp += cell_loaded.get_examine_text(current_cell)
desc_comp += "*--------*"

if(hasHUD(user, HUD_SCIENCE)) //Mob has a research scanner active.

if(!added_header)
added_header = TRUE
desc_comp += "*--------*<BR>"
desc_comp += "*--------*"

if(origin_tech)
desc_comp += SPAN_NOTICE("Testing potentials:")
desc_comp += "<BR>"
var/list/techlvls = cached_json_decode(origin_tech)
for(var/T in techlvls)
var/decl/research_field/field = SSfabrication.get_research_field_by_id(T)
desc_comp += "Tech: Level [techlvls[T]] [field.name].<BR>"
desc_comp += "Tech: Level [techlvls[T]] [field.name]."
else
desc_comp += "No tech origins detected.<BR>"
desc_comp += "No tech origins detected."

if(LAZYLEN(matter))
desc_comp += SPAN_NOTICE("Extractable materials:")
desc_comp += "<BR>"
for(var/mat in matter)
var/decl/material/M = GET_DECL(mat)
desc_comp += "[capitalize(M.solid_name)]<BR>"
desc_comp += "[capitalize(M.solid_name)]"
else
desc_comp += SPAN_DANGER("No extractable materials detected.<BR>")
desc_comp += "*--------*<BR>"
desc_comp += SPAN_DANGER("No extractable materials detected.")
desc_comp += "*--------*"

if(drying_wetness > 0 && drying_wetness != initial(drying_wetness))
desc_comp += "\The [src] is [get_dryness_text()].<BR>"
desc_comp += "\The [src] is [get_dryness_text()]."

return ..(user, distance, "", desc_comp)
return ..(user, distance, "", jointext(desc_comp, "<br/>"))

/obj/item/check_mousedrop_adjacency(var/atom/over, var/mob/user)
. = (loc == user && istype(over, /obj/screen/inventory)) || ..()
Expand Down Expand Up @@ -392,14 +390,16 @@
matter = null
material = null
qdel(src)
return . || TRUE

/obj/item/attack_self(mob/user)
if(user.a_intent == I_HURT && istype(material))
var/list/results = squash_item(skip_qdel = TRUE)
if(length(results) && user.try_unequip(src, user.loc))
if(results && user.try_unequip(src, user.loc))
user.visible_message(SPAN_DANGER("\The [user] squashes \the [src] into a lump."))
for(var/obj/item/thing in results)
user.put_in_hands(thing)
if(islist(results))
for(var/obj/item/thing in results)
user.put_in_hands(thing)
matter = null
material = null
qdel(src)
Expand Down
16 changes: 16 additions & 0 deletions code/game/objects/objs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -375,3 +375,19 @@
if(composting_mat.compost_value)
return TRUE
return FALSE

// Used to determine if something can be used as the basis of a mold.
/obj/proc/get_mould_difficulty()
return SKILL_IMPOSSIBLE // length(matter) <= 1

// Used to determine what a mold made from this item produces.
/obj/proc/get_mould_product_type()
return type

// Used to pass an associative list of data to the mold to pass to the product.
/obj/proc/get_mould_metadata()
return

// Called when passing the metadata back to the item.
/obj/proc/take_mould_metadata(list/metadata)
return
3 changes: 2 additions & 1 deletion code/game/objects/structures/fires.dm
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@
user.put_in_hands(removing)
if(lit == FIRE_LIT)
visible_message(SPAN_DANGER("\The [user] fishes \the [removing] out of \the [src]!"))
user.fire_act(return_air(), last_fuel_burn_temperature, 500)
// Uncomment this when there's a way to take stuff out of a kiln or oven without setting yourself on fire.
//user.fire_act(return_air(), last_fuel_burn_temperature, 500)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could honestly just try calling removing.try_burn_wearer(user)? but maybe that'll happen anyways. honestly i kind of think holding a hot object is punishing enough for removing one from a lit kiln as it is

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's called anyway when the item is equipped.

else
visible_message(SPAN_NOTICE("\The [user] removes \the [removing] from \the [src]."))
update_icon()
Expand Down
72 changes: 72 additions & 0 deletions code/modules/crafting/metalwork/metalwork_items.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/obj/item/chems/crucible
name = "crucible"
desc = "A heavy, thick-walled vessel used for melting down ore."
icon = 'icons/obj/metalworking/crucible.dmi'
icon_state = ICON_STATE_WORLD
material = /decl/material/solid/stone/pottery
atom_flags = ATOM_FLAG_OPEN_CONTAINER
w_class = ITEM_SIZE_NO_CONTAINER
material_alteration = MAT_FLAG_ALTERATION_COLOR | MAT_FLAG_ALTERATION_NAME
// TODO: storage datum when storage PR is merged.
// max_w_class = ITEM_SIZE_LARGE
// max_storage_space = BASE_STORAGE_CAPACITY(ITEM_SIZE_LARGE)
var/max_held = 10

/obj/item/chems/crucible/attackby(obj/item/W, mob/user)

if(istype(W, /obj/item/chems/mould))
if(W.material?.hardness <= MAT_VALUE_MALLEABLE)
to_chat(user, SPAN_WARNING("\The [W] is currently too soft to be used as a mould."))
return TRUE
if(standard_pour_into(user, W))
return TRUE

if(istype(W, /obj/item/debris) || istype(W, /obj/item/stack/material))

if(length(contents) >= max_held)
to_chat(user, SPAN_WARNING("\The [src] is full."))
return TRUE

var/obj/item/transferring
if(istype(W, /obj/item/stack))
var/obj/item/stack/input = W
if(input.get_amount() <= 5 && user.try_unequip(input))
transferring = input
else
transferring = input.split(5)
else if(user.try_unequip(W))
transferring = W

if(transferring)
transferring.forceMove(src)
visible_message(SPAN_NOTICE("\The [user] drops \the [transferring] into \the [src]."))
return TRUE

return ..()

/obj/item/chems/crucible/attack_hand(mob/user)
if(length(contents))
var/obj/item/stack = pick(contents)
stack.dropInto(get_turf(src))
user.put_in_hands(stack)
return TRUE
return ..()
// End placeholder interaction. Remove when storage PR is in.

/obj/item/chems/crucible/on_reagent_change()
. = ..()
queue_icon_update()

/obj/item/chems/crucible/on_update_icon()
. = ..()
var/decl/material/primary_reagent = reagents?.get_primary_reagent_decl()
if(primary_reagent)
var/image/I = image(icon, "[icon_state]-filled")
I.color = primary_reagent.color
I.alpha = 255 * primary_reagent.opacity
I.appearance_flags |= RESET_COLOR
add_overlay(I)

/obj/item/chems/crucible/initialize_reagents()
create_reagents(15 * REAGENT_UNITS_PER_MATERIAL_SHEET)
return ..()
Loading
Loading