Skip to content

Commit

Permalink
Adding a modpack for blacksmithy and forging.
Browse files Browse the repository at this point in the history
  • Loading branch information
MistakeNot4892 committed Jan 9, 2025
1 parent eb2a758 commit fdc5618
Show file tree
Hide file tree
Showing 40 changed files with 1,013 additions and 24 deletions.
5 changes: 4 additions & 1 deletion code/_helpers/visual_filters.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
// All of this ported from TG.
// And then ported to Nebula from Polaris.
/atom/movable
var/list/filter_data // For handling persistent filters
VAR_PRIVATE/list/filter_data // For handling persistent filters

// Defining this for future proofing and ease of searching for erroneous usage.
/image/proc/add_filter(filter_name, priority, list/params)
filters += filter(arglist(params))
return TRUE

/atom/movable/proc/has_filter(filter_name)
return (name in filter_data)

/atom/movable/proc/add_filter(filter_name, priority, list/params, force_update = FALSE)

// Check if we already have a filter and hence don't need to rebuild filters.
Expand Down
27 changes: 27 additions & 0 deletions code/game/objects/__objs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -415,3 +415,30 @@
if(dumped_reagents && last_loc && !QDELETED(last_loc) && last_loc.reagents?.total_volume)
last_loc.reagents.handle_update()
HANDLE_REACTIONS(last_loc.reagents)

// Used by HE pipes and forging bars/billets. Defaults are for HE pipes.
/obj/proc/animate_heat_glow(icon_temperature, scale_sub = 500, scale_div = 1500, scale_max = 2000, skip_filter = FALSE)

var/scale = max((icon_temperature - scale_sub) / scale_div, 0)
var/h_r = heat2color_r(icon_temperature)
var/h_g = heat2color_g(icon_temperature)
var/h_b = heat2color_b(icon_temperature)

var/base_color = get_color()
var/b_r = HEX_RED(base_color)
var/b_g = HEX_GREEN(base_color)
var/b_b = HEX_BLUE(base_color)

if(icon_temperature < scale_max)
h_r = b_r + (h_r - b_r)*scale
h_g = b_g + (h_g - b_g)*scale
h_b = b_b + (h_b - b_b)*scale

var/scale_color = rgb(h_r, h_g, h_b)
var/list/animate_targets = get_above_oo() + src
for (var/thing in animate_targets)
var/atom/movable/AM = thing
animate(AM, color = scale_color, time = 2 SECONDS, easing = SINE_EASING)
if(!skip_filter)
animate_filter("glow", list(color = scale_color, time = 2 SECONDS, easing = LINEAR_EASING))
set_light(min(3, scale*2.5), min(3, scale*2.5), scale_color)
9 changes: 8 additions & 1 deletion code/game/objects/effects/effect_system.dm
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,16 @@ steam.start() -- spawns the effect
/obj/effect/sparks/struck
spark_sound = "light_bic"

/obj/effect/sparks/silent
spark_sound = null

/obj/effect/sparks/Initialize()
. = ..()
// this is 2 seconds so that it doesn't appear to freeze after its last move, which ends up making it look like timers are broken
// if you change the number of or delay between moves in spread(), this may need to be changed
QDEL_IN(src, 2 SECONDS)
playsound(loc, spark_sound, 100, 1)
if(spark_sound)
playsound(loc, spark_sound, 100, 1)
set_light(lit_light_range, lit_light_power, lit_light_color)
if(isturf(loc))
var/turf/T = loc
Expand Down Expand Up @@ -140,6 +144,9 @@ steam.start() -- spawns the effect
/datum/effect/effect/system/spark_spread
var/spark_type = /obj/effect/sparks

/datum/effect/effect/system/spark_spread/silent
spark_type = /obj/effect/sparks/silent

/datum/effect/effect/system/spark_spread/non_electrical
spark_type = /obj/effect/sparks/struck

Expand Down
3 changes: 3 additions & 0 deletions code/game/objects/items/__item.dm
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,9 @@
if(drying_wetness > 0 && drying_wetness != initial(drying_wetness))
desc_comp += "\The [src] is [get_dryness_text()]."

if(check_rights(R_DEBUG, 0, user))
to_chat(user, "\The [src] has a temperature of [temperature]K.")

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

/obj/item/check_mousedrop_adjacency(var/atom/over, var/mob/user)
Expand Down
File renamed without changes.
8 changes: 8 additions & 0 deletions code/game/objects/items/crafting/barrel_rim.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Stub for forging. TODO barrel crafting.
/obj/item/barrel_rim
name = "barrel rim"
desc = "A circular brace used to hold a barrel together."
icon_state = ICON_STATE_WORLD
icon = 'icons/obj/items/barrel_rim.dmi'
material = /decl/material/solid/metal/iron
material_alteration = MAT_FLAG_ALTERATION_ALL
8 changes: 8 additions & 0 deletions code/game/objects/items/crafting/shield_fasteners.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Stub for forging. TODO shield crafting.
/obj/item/shield_fasteners
name = "shield fasteners"
desc = "A handful of shaped fasteners used to hold a buckler or shield together."
icon_state = ICON_STATE_WORLD
icon = 'icons/obj/items/shield_fasteners.dmi'
material = /decl/material/solid/metal/iron
material_alteration = MAT_FLAG_ALTERATION_ALL
82 changes: 82 additions & 0 deletions code/game/objects/items/tongs.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/obj/item/tongs

Check failure on line 1 in code/game/objects/items/tongs.dm

View workflow job for this annotation

GitHub Actions / Code

DME Validator

File is not included
name = "tongs"
desc = "Long-handled grippers well suited to fishing white-hot iron out of a forge fire."
icon = 'icons/obj/items/tongs.dmi'
material = /decl/material/solid/metal/iron
obj_flags = OBJ_FLAG_INSULATED_HANDLE
material_alteration = MAT_FLAG_ALTERATION_ALL
var/obj/item/holding_item

/obj/item/tongs/Destroy()
QDEL_NULL(holding_item)
. = ..()

/obj/item/tongs/on_update_icon()
. = ..()
if(holding_item)
// Note, not get_color(); heat color is (will be) temporarily applied over the top of base color.
add_overlay(overlay_image(icon, "[icon_state]-bar", holding_item.color, RESET_COLOR))

/obj/item/tongs/dropped(mob/user)
. = ..()
if(holding_item)
holding_item.dropInto(loc)
holding_item = null
update_icon()

/obj/item/tongs/afterattack(turf/floor/target, mob/user, proximity)
. = ..()
if(holding_item)

/*
/obj/item/attackby(obj/item/used_item, mob/user)
// Pick up items with tongs.
if(istype(used_item, /obj/item/tongs))
var/obj/item/tongs/tongs = used_item
if(!tongs.holding_item)
tongs.collect_item(src)
return TRUE
return ..()
/obj/item/stack/attackby(obj/item/used_item, mob/user)
// Pick up items with tongs.
if(istype(used_item, /obj/item/tongs))
var/obj/item/tongs/tongs = used_item
if(!tongs.holding_item)
var/obj/item/grabbing
if(get_amount() == 1)
grabbing = src
else
grabbing = split(1)
tongs.collect_item(grabbing)
return ..(()
/obj/item/tongs/adjust_mob_overlay(mob/living/user_mob, bodytype, image/overlay, slot, bodypart, use_fallback_if_icon_missing)
if(overlay && holding_item)
var/check_state = "[overlay.icon_state]-bar"
if(check_state_in_icon(check_state, overlay.icon))
overlay.overlays += overlay_image(overlay.icon, check_state, holding_item.get_color(), RESET_COLOR)
. = ..()
/obj/item/tongs/proc/collect_item(obj/item/grabbing)
if(ismob(grabbing.loc))
var/mob/holding = grabbing.loc
if(!holding.try_unequip(grabbing))
return FALSE
else if(isatom(grabbing.loc))
var/atom/holder = grabbing.loc
if(holder.storage)
storage.remove_from_storage(null, grabbing, get_turf(user))
else
return FALSE
grabbing.forceMove(src)
holding_item = grabbing
update_icon()
return TRUE
/obj/item/tongs/Exited(atom/movable/AM, atom/new_loc)
. = ..()
if(AM == holding_item)
holding_item = null
update_icon()
2 changes: 1 addition & 1 deletion code/game/objects/items/weapons/material/knives.dm
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@

//random stuff
/obj/item/knife/hook
name = "meat hook"
name = "hook"
desc = "A sharp, metal hook what sticks into things."
icon = 'icons/obj/items/weapon/knives/hook.dmi'
_sharp = FALSE
Expand Down
9 changes: 7 additions & 2 deletions code/game/objects/structures/_structure_materials.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
var/decl/material/reinf_material
var/material_alteration
var/dismantled
var/name_prefix

/obj/structure/get_material()
RETURN_TYPE(/decl/material)
Expand Down Expand Up @@ -37,10 +38,14 @@

/obj/structure/proc/update_material_name(var/override_name)
var/base_name = override_name || initial(name)
var/new_name
if(istype(material) && (material_alteration & MAT_FLAG_ALTERATION_NAME))
SetName("[material.adjective_name] [base_name]")
new_name = "[material.adjective_name] [base_name]"
else
SetName(base_name)
new_name = base_name
if(name_prefix)
new_name = "[name_prefix] [new_name]"
SetName(new_name)

/obj/structure/proc/update_material_desc(var/override_desc)
var/base_desc = override_desc || initial(desc)
Expand Down
3 changes: 3 additions & 0 deletions code/game/objects/structures/fires.dm
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,9 @@
else
to_chat(user, "\The [src] is empty.")

if(check_rights(R_DEBUG, 0, user))
to_chat(user, "\The [src] has a temperature of [temperature]K, an effective burn temperature of [get_effective_burn_temperature()]K and a fuel value of [fuel].")

/obj/structure/fire_source/attack_hand(var/mob/user)

var/list/removable_atoms = get_removable_atoms()
Expand Down
19 changes: 1 addition & 18 deletions code/modules/atmospherics/he_pipes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -93,24 +93,7 @@
//fancy radiation glowing
if(pipe_air.temperature && (icon_temperature > 500 || pipe_air.temperature > 500)) //start glowing at 500K
if(abs(pipe_air.temperature - icon_temperature) > 10)
icon_temperature = pipe_air.temperature
var/scale = max((icon_temperature - 500) / 1500, 0)

var/h_r = heat2color_r(icon_temperature)
var/h_g = heat2color_g(icon_temperature)
var/h_b = heat2color_b(icon_temperature)

if(icon_temperature < 2000) //scale up overlay until 2000K
h_r = 64 + (h_r - 64)*scale
h_g = 64 + (h_g - 64)*scale
h_b = 64 + (h_b - 64)*scale
var/scale_color = rgb(h_r, h_g, h_b)
var/list/animate_targets = get_above_oo() + src
for (var/thing in animate_targets)
var/atom/movable/AM = thing
animate(AM, color = scale_color, time = 2 SECONDS, easing = SINE_EASING)
animate_filter("glow", list(color = scale_color, time = 2 SECONDS, easing = LINEAR_EASING))
set_light(min(3, scale*2.5), min(3, scale*2.5), scale_color)
animate_heat_glow(pipe_air.temperature)
else
set_light(0, 0)

Expand Down
6 changes: 6 additions & 0 deletions code/modules/crafting/stack_recipes/recipes_soft.dm
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@
result_type = /obj/item/stack/material/brick
test_result_type = /obj/item/stack/material/brick/clay

/decl/stack_recipe/soft/bar
name = "bar"
name_plural = "bars"
result_type = /obj/item/stack/material/bar
test_result_type = /obj/item/stack/material/bar/wax

/decl/stack_recipe/soft/stack/spawn_result(mob/user, location, amount, decl/material/mat, decl/material/reinf_mat, paint_color, spent_type, spent_amount = 1)
var/obj/item/stack/S = ..()
if(istype(S))
Expand Down
3 changes: 3 additions & 0 deletions code/modules/materials/_materials.dm
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,8 @@ INITIALIZE_IMMEDIATE(/obj/effect/gas_overlay)
/// Assoc weighted list of gemstone material types to weighting.
var/list/gemstone_types

var/forgable = FALSE // Can this material be forged in bar/billet form?

// Placeholders for light tiles and rglass.
/decl/material/proc/reinforce(var/mob/user, var/obj/item/stack/material/used_stack, var/obj/item/stack/material/target_stack, var/use_sheets = 1)
if(!used_stack.can_use(use_sheets))
Expand Down Expand Up @@ -444,6 +446,7 @@ INITIALIZE_IMMEDIATE(/obj/effect/gas_overlay)
burn_product = null
vapor_products = null
compost_value = 0
forgable = FALSE
else if(isnull(temperature_damage_threshold))
var/new_temperature_damage_threshold = max(melting_point, boiling_point, heating_point)
// Don't let the threshold be lower than the ignition point.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
icon_reinf = 'icons/turf/walls/reinforced_metal.dmi'
exoplanet_rarity_gas = MAT_RARITY_NOWHERE
tensile_strength = 0.8 // metal wire is probably better than plastic?
forgable = TRUE

/decl/material/solid/metal/uranium
name = "uranium"
Expand Down
4 changes: 4 additions & 0 deletions code/modules/materials/material_sheets_mapping.dm
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,15 @@ STACK_SUBTYPES(titanium, "titanium", solid/metal/tita
STACK_SUBTYPES(cotton, "cotton", solid/organic/cloth, thread, null)
STACK_SUBTYPES(dried_gut, "dried gut", solid/organic/leather/gut, thread, null)

STACK_SUBTYPES(iron, "iron", solid/metal/iron, bar, null)
STACK_SUBTYPES(copper, "copper", solid/metal/copper, bar, null)

STACK_SUBTYPES(chipboard_oak, "oak chipboard", solid/organic/wood/chipboard, sheet, null)
STACK_SUBTYPES(chipboard_maple, "maple chipboard", solid/organic/wood/chipboard/maple, sheet, null)
STACK_SUBTYPES(chipboard_mahogany, "mahogany chipboard", solid/organic/wood/chipboard/mahogany, sheet, null)
STACK_SUBTYPES(chipboard_ebony, "ebony chipboard", solid/organic/wood/chipboard/ebony, sheet, null)
STACK_SUBTYPES(chipboard_walnut, "walnut chipboard", solid/organic/wood/chipboard/walnut, sheet, null)
STACK_SUBTYPES(chipboard_yew, "yew chipboard", solid/organic/wood/chipboard/yew, sheet, null)


#undef STACK_SUBTYPES
16 changes: 16 additions & 0 deletions code/modules/materials/material_stack_nail.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/obj/item/stack/material/nail
name = "nails"
singular_name = "nail"
plural_name = "nails"
icon_state = "nail"
plural_icon_state = "nail-mult"
max_icon_state = "nail-max"
stack_merge_type = /obj/item/stack/material/nail
crafting_stack_type = /obj/item/stack/material/nail
icon = 'icons/obj/items/stacks/nails.dmi'
is_spawnable_type = TRUE
matter_multiplier = 0.05 // 20 per standard sheet
material = /decl/material/solid/metal/iron

/obj/item/stack/material/nail/twelve
amount = 12
Binary file added icons/obj/items/barrel_rim.dmi
Binary file not shown.
Binary file added icons/obj/items/billet.dmi
Binary file not shown.
Binary file added icons/obj/items/shield_fasteners.dmi
Binary file not shown.
Binary file added icons/obj/items/stacks/nails.dmi
Binary file not shown.
Binary file added icons/obj/items/tongs.dmi
Binary file not shown.
Binary file added icons/obj/structures/anvil.dmi
Binary file not shown.
Binary file added icons/obj/structures/anvil_crude.dmi
Binary file not shown.
Binary file added icons/obj/structures/anvil_crude_alt.dmi
Binary file not shown.
Binary file added icons/obj/structures/anvil_improvised.dmi
Binary file not shown.
Binary file added icons/obj/structures/forging/forge.dmi
Binary file not shown.
1 change: 1 addition & 0 deletions maps/modpack_testing/modpack_testing.dm
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "../../mods/content/shackles/_shackles.dme"
#include "../../mods/content/xenobiology/_xenobiology.dme"
#include "../../mods/content/item_sharpening/_item_sharpening.dme"
#include "../../mods/content/blacksmithy/_blacksmithy.dme"

#include "../../mods/gamemodes/cult/_cult.dme"
#include "../../mods/gamemodes/heist/_heist.dme"
Expand Down
1 change: 1 addition & 0 deletions maps/shaded_hills/shaded_hills.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "../../mods/content/scaling_descriptors.dm"
#include "../../mods/species/drakes/_drakes.dme" // include before _fantasy.dme so overrides work
#include "../../mods/content/item_sharpening/_item_sharpening.dme"
#include "../../mods/content/blacksmithy/_blacksmithy.dme"
#include "../../mods/content/fantasy/_fantasy.dme"

#include "areas/_areas.dm"
Expand Down
3 changes: 3 additions & 0 deletions mods/content/blacksmithy/_blacksmithy.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/decl/modpack/blacksmithy
name = "Blacksmithy"

14 changes: 14 additions & 0 deletions mods/content/blacksmithy/_blacksmithy.dme
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#ifndef MODPACK_BLACKSMITHY
#define MODPACK_BLACKSMITHY
// BEGIN_INCLUDE
#include "_blacksmithy.dm"
#include "anvil.dm"
#include "bars.dm"
#include "billet.dm"
#include "boulder.dm"
#include "forge_fire.dm"
#include "forging_action.dm"
#include "forging_step.dm"
#include "tongs.dm"
// END_INCLUDE
#endif
Loading

0 comments on commit fdc5618

Please sign in to comment.