Skip to content

Commit

Permalink
Added blacksmithy.
Browse files Browse the repository at this point in the history
  • Loading branch information
MistakeNot4892 committed Jan 23, 2025
1 parent 2f4aaac commit d8ccb74
Show file tree
Hide file tree
Showing 42 changed files with 1,045 additions and 46 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 @@ -391,6 +391,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.
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
Original file line number Diff line number Diff line change
Expand Up @@ -244,5 +244,5 @@
/datum/fabricator_recipe/chipboard/yew/get_resources()
resources = list(
/decl/material/solid/organic/wood/yew = ceil((SHEET_MATERIAL_AMOUNT * FABRICATOR_EXTRA_COST_FACTOR)/2),
/decl/material/solid/organic/plastic = ceil((SHEET_MATERIAL_AMOUNT * FABRICATOR_EXTRA_COST_FACTOR)/2)
/decl/material/solid/organic/plastic = ceil((SHEET_MATERIAL_AMOUNT * FABRICATOR_EXTRA_COST_FACTOR)/2)
)
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
Binary file added icons/obj/items/billet.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 @@ -24,6 +24,7 @@
#include "../../mods/content/shackles/_shackles.dme"
#include "../../mods/content/supermatter/_supermatter.dme"
#include "../../mods/content/xenobiology/_xenobiology.dme"
#include "../../mods/content/blacksmithy/_blacksmithy.dme"
#include "../../mods/content/item_sharpening/_item_sharpening.dme"

#include "../../mods/gamemodes/cult/_cult.dme"
Expand Down
Loading

0 comments on commit d8ccb74

Please sign in to comment.