From 5a5e760f3796cea875d4b08db75f4240398b6223 Mon Sep 17 00:00:00 2001
From: PollardTheDragon <144391971+PollardTheDragon@users.noreply.github.com>
Date: Sat, 26 Apr 2025 10:15:34 -0400
Subject: [PATCH] Smith Addition: Productivity Bit (#28999)
* Adds productivity bit
* Digging sand
* Proper smithing costs
---
code/datums/ores.dm | 4 ++--
code/game/objects/items.dm | 2 ++
.../turfs/simulated/floor/asteroid_floors.dm | 6 +++---
code/game/turfs/simulated/minerals.dm | 10 +++++-----
.../smithing/components/tool_bits_components.dm | 12 ++++++++++++
code/modules/smithing/smith_datums.dm | 11 +++++++++++
code/modules/smithing/smithed_items/tool_bits.dm | 16 ++++++++++++++++
7 files changed, 51 insertions(+), 10 deletions(-)
diff --git a/code/datums/ores.dm b/code/datums/ores.dm
index f2f138b5b4d..5c78677914b 100644
--- a/code/datums/ores.dm
+++ b/code/datums/ores.dm
@@ -17,8 +17,8 @@
* Returns [MINERAL_ALLOW_DIG] if the containing turf should be changed to its
* "dug" state, [MINERAL_PREVENT_DIG] if it should remain as is.
*/
-/datum/ore/proc/on_mine(turf/source, mob/user, triggered_by_explosion = FALSE)
- var/amount = rand(drop_min, drop_max)
+/datum/ore/proc/on_mine(turf/source, mob/user, triggered_by_explosion = FALSE, productivity_mult = 1)
+ var/amount = round(rand(drop_min, drop_max) * productivity_mult)
if(ispath(drop_type, /obj/item/stack/ore))
new drop_type(source, amount)
diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm
index b4f1a84afe7..7b420407f2c 100644
--- a/code/game/objects/items.dm
+++ b/code/game/objects/items.dm
@@ -182,6 +182,8 @@ GLOBAL_DATUM_INIT(welding_sparks, /mutable_appearance, mutable_appearance('icons
var/bit_failure_rate = 0
/// Efficiency modifier for tools that use energy or fuel
var/bit_efficiency_mod = 1
+ /// Productivity modifier for tools
+ var/bit_productivity_mod = 1
///////////////////////////
// MARK: item hover FX
diff --git a/code/game/turfs/simulated/floor/asteroid_floors.dm b/code/game/turfs/simulated/floor/asteroid_floors.dm
index 840996ef34e..dfb7ae22bb1 100644
--- a/code/game/turfs/simulated/floor/asteroid_floors.dm
+++ b/code/game/turfs/simulated/floor/asteroid_floors.dm
@@ -24,8 +24,8 @@
if(prob(floor_variance))
icon_state = "[environment_type][rand(0,12)]"
-/turf/simulated/floor/plating/asteroid/proc/getDug()
- new digResult(src, 5)
+/turf/simulated/floor/plating/asteroid/proc/getDug(productivity_mod = 1)
+ new digResult(src, 5 * productivity_mod)
icon_plating = "[environment_type]_dug"
icon_state = "[environment_type]_dug"
SSblackbox.record_feedback("tally", "ore_mined", 5, "[digResult]")
@@ -86,7 +86,7 @@
if(!can_dig(user))
return TRUE
to_chat(user, "You dig a hole.")
- getDug()
+ getDug(used.bit_productivity_mod)
return TRUE
else if(istype(used, /obj/item/storage/bag/ore))
diff --git a/code/game/turfs/simulated/minerals.dm b/code/game/turfs/simulated/minerals.dm
index 614ece98498..d4677444684 100644
--- a/code/game/turfs/simulated/minerals.dm
+++ b/code/game/turfs/simulated/minerals.dm
@@ -95,24 +95,24 @@
if(do_after(user, mine_time * P.toolspeed, target = src))
if(ismineralturf(src)) //sanity check against turf being deleted during digspeed delay
to_chat(user, "You finish cutting into the rock.")
- gets_drilled(user)
+ gets_drilled(user, productivity_mult = P.bit_productivity_mod)
SSblackbox.record_feedback("tally", "pick_used_mining", 1, P.name)
return FINISH_ATTACK
else
return attack_hand(user)
-/turf/simulated/mineral/proc/mine_ore(mob/user, triggered_by_explosion)
+/turf/simulated/mineral/proc/mine_ore(mob/user, triggered_by_explosion, productivity_mult = 1)
if(!ore)
return MINERAL_ALLOW_DIG
for(var/obj/effect/temp_visual/mining_overlay/M in src)
qdel(M)
- return ore.on_mine(src, user, triggered_by_explosion)
+ return ore.on_mine(src, user, triggered_by_explosion, productivity_mult)
-/turf/simulated/mineral/proc/gets_drilled(mob/user, triggered_by_explosion = FALSE)
- if(mine_ore(user, triggered_by_explosion) == MINERAL_PREVENT_DIG)
+/turf/simulated/mineral/proc/gets_drilled(mob/user, triggered_by_explosion = FALSE, productivity_mult = 1)
+ if(mine_ore(user, triggered_by_explosion, productivity_mult) == MINERAL_PREVENT_DIG)
return
ChangeTurf(turf_type, defer_change)
diff --git a/code/modules/smithing/components/tool_bits_components.dm b/code/modules/smithing/components/tool_bits_components.dm
index ee10334104c..ee909a8ca01 100644
--- a/code/modules/smithing/components/tool_bits_components.dm
+++ b/code/modules/smithing/components/tool_bits_components.dm
@@ -28,6 +28,12 @@
materials = list(MAT_TITANIUM = 8000, MAT_PLASMA = 8000)
finished_product = /obj/item/smithed_item/tool_bit/heavy
+/obj/item/smithed_item/component/bit_mount/productivity
+ name = "productivity bit mount"
+ desc = "This is the primary component of a productivity bit."
+ materials = list(MAT_METAL = 2000, MAT_PLASMA = 2000)
+ finished_product = /obj/item/smithed_item/tool_bit/productivity
+
/obj/item/smithed_item/component/bit_mount/economical
name = "economical bit mount"
desc = "This is the primary component of an economical bit."
@@ -70,6 +76,12 @@
materials = list(MAT_METAL = 8000, MAT_PLASMA = 8000)
finished_product = /obj/item/smithed_item/tool_bit/heavy
+/obj/item/smithed_item/component/bit_head/productivity
+ name = "productivity bit mount"
+ desc = "This is the secondary component of a productivity bit."
+ materials = list(MAT_GOLD = 2000, MAT_SILVER = 2000)
+ finished_product = /obj/item/smithed_item/tool_bit/productivity
+
/obj/item/smithed_item/component/bit_head/economical
name = "economical bit head"
desc = "This is the secondary component of an economical bit."
diff --git a/code/modules/smithing/smith_datums.dm b/code/modules/smithing/smith_datums.dm
index 283b41b9c9c..1129b80c746 100644
--- a/code/modules/smithing/smith_datums.dm
+++ b/code/modules/smithing/smith_datums.dm
@@ -70,6 +70,8 @@
var/tool_speed_mult = 1.0
/// Tool precision multiplier
var/tool_failure_mult = 1.0
+ /// Tool productivity mult
+ var/tool_productivity_mult = 1.0
/// How much larger does a bit with this material make it?
var/size_mod = 0
/// Projectile speed multiplier
@@ -106,6 +108,7 @@
heat_insulation_mult = MINOR_MATERIAL_BUFF
siemens_coeff_mult = MINOR_MATERIAL_DEBUFF
tool_failure_mult = MINOR_MATERIAL_DEBUFF
+ tool_productivity_mult = MINOR_MATERIAL_BUFF
power_draw_mult = MINOR_MATERIAL_DEBUFF
projectile_damage_multiplier = MINOR_MATERIAL_DEBUFF
secondary_goal_candidate = TRUE
@@ -120,6 +123,7 @@
radiation_armor_mult = MAJOR_MATERIAL_BUFF
tool_speed_mult = MINOR_MATERIAL_BUFF
tool_failure_mult = MINOR_MATERIAL_DEBUFF
+ tool_productivity_mult = MAJOR_MATERIAL_BUFF
size_mod = 1
fire_rate_multiplier = MINOR_MATERIAL_BUFF
durability_mult = MINOR_MATERIAL_DEBUFF
@@ -132,6 +136,7 @@
explosive_armor_mult = MINOR_MATERIAL_BUFF
siemens_coeff_mult = MINOR_MATERIAL_BUFF
tool_speed_mult = MINOR_MATERIAL_BUFF
+ tool_productivity_mult = MINOR_MATERIAL_DEBUFF
projectile_damage_multiplier = MINOR_MATERIAL_BUFF
durability_mult = MINOR_MATERIAL_DEBUFF
secondary_goal_candidate = TRUE
@@ -161,6 +166,7 @@
radiation_armor_mult = MAJOR_MATERIAL_DEBUFF
tool_speed_mult = MINOR_MATERIAL_BUFF
tool_failure_mult = MINOR_MATERIAL_DEBUFF
+ tool_productivity_mult = MINOR_MATERIAL_DEBUFF
size_mod = 1
projectile_speed_mult = MINOR_MATERIAL_BUFF
power_draw_mult = MINOR_MATERIAL_DEBUFF
@@ -178,6 +184,7 @@
explosive_armor_mult = MINOR_MATERIAL_BUFF
siemens_coeff_mult = MAJOR_MATERIAL_BUFF
tool_failure_mult = MINOR_MATERIAL_DEBUFF
+ tool_productivity_mult = MAJOR_MATERIAL_BUFF
durability_mult = MAJOR_MATERIAL_BUFF
/datum/smith_material/bluespace
@@ -189,6 +196,7 @@
siemens_coeff_mult = MINOR_MATERIAL_BUFF
radiation_armor_mult = MINOR_MATERIAL_DEBUFF
tool_speed_mult = MAJOR_MATERIAL_BUFF
+ tool_productivity_mult = MAJOR_MATERIAL_BUFF
power_draw_mult = MAJOR_MATERIAL_BUFF
projectile_damage_multiplier = MAJOR_MATERIAL_BUFF
@@ -236,6 +244,7 @@
heat_insulation_mult = MINOR_MATERIAL_DEBUFF
radiation_armor_mult = MINOR_MATERIAL_BUFF
tool_speed_mult = MINOR_MATERIAL_BUFF
+ tool_productivity_mult = MINOR_MATERIAL_BUFF
size_mod = -1
projectile_speed_mult = MINOR_MATERIAL_BUFF
power_draw_mult = MINOR_MATERIAL_BUFF
@@ -252,6 +261,7 @@
siemens_coeff_mult = MINOR_MATERIAL_BUFF
radiation_armor_mult = MINOR_MATERIAL_BUFF
tool_speed_mult = MINOR_MATERIAL_BUFF
+ tool_productivity_mult = MINOR_MATERIAL_BUFF
size_mod = -1
power_draw_mult = MINOR_MATERIAL_DEBUFF
projectile_damage_multiplier = MINOR_MATERIAL_DEBUFF
@@ -267,6 +277,7 @@
heat_insulation_mult = MINOR_MATERIAL_DEBUFF
siemens_coeff_mult = MINOR_MATERIAL_DEBUFF
tool_failure_mult = MINOR_MATERIAL_DEBUFF
+ tool_productivity_mult = MAJOR_MATERIAL_BUFF
size_mod = -1
projectile_damage_multiplier = MINOR_MATERIAL_BUFF
power_draw_mult = MINOR_MATERIAL_BUFF
diff --git a/code/modules/smithing/smithed_items/tool_bits.dm b/code/modules/smithing/smithed_items/tool_bits.dm
index ee3d5369345..67ba785eb03 100644
--- a/code/modules/smithing/smithed_items/tool_bits.dm
+++ b/code/modules/smithing/smithed_items/tool_bits.dm
@@ -6,6 +6,10 @@
var/base_speed_mod = 0
/// Base Efficiency modifier
var/base_efficiency_mod = 0
+ /// Base productivity modifier
+ var/base_productivity_mod = 0
+ /// Productivity mod
+ var/productivity_mod = 1.0
/// Speed modifier
var/speed_mod = 1.0
/// Efficiency modifier
@@ -34,6 +38,7 @@
speed_mod = 1 + (base_speed_mod * quality.stat_mult * material.tool_speed_mult)
failure_rate = initial(failure_rate) * quality.stat_mult * material.tool_failure_mult
efficiency_mod = 1 + (base_efficiency_mod * quality.stat_mult * material.power_draw_mult)
+ productivity_mod = 1 + (base_productivity_mod * quality.stat_mult * material.tool_productivity_mult)
/obj/item/smithed_item/tool_bit/on_attached(obj/item/target)
if(!istype(target))
@@ -43,12 +48,14 @@
attached_tool.toolspeed = attached_tool.toolspeed * speed_mod
attached_tool.bit_failure_rate += failure_rate
attached_tool.bit_efficiency_mod = attached_tool.bit_efficiency_mod * efficiency_mod
+ attached_tool.bit_productivity_mod = attached_tool.bit_productivity_mod * productivity_mod
/obj/item/smithed_item/tool_bit/on_detached()
attached_tool.toolspeed = attached_tool.toolspeed / speed_mod
attached_tool.w_class -= size_mod
attached_tool.bit_failure_rate -= failure_rate
attached_tool.bit_efficiency_mod = attached_tool.bit_efficiency_mod / efficiency_mod
+ attached_tool.bit_productivity_mod = attached_tool.bit_productivity_mod / productivity_mod
attached_tool.attached_bits -= src
attached_tool = null
@@ -98,6 +105,7 @@
desc = "A tool bit that's fairly balanced in all aspects."
base_speed_mod = -0.1
failure_rate = 2
+ base_productivity_mod = 0.5
base_efficiency_mod = -0.1
secondary_goal_candidate = TRUE
@@ -110,6 +118,13 @@
size_mod = 1
durability = 120
+/obj/item/smithed_item/tool_bit/productivity
+ name = "productivity bit"
+ desc = "A tool bit that minimizes waste."
+ base_speed_mod = -0.1
+ base_productivity_mod = 2
+ durability = 50
+
/obj/item/smithed_item/tool_bit/economical
name = "economical bit"
desc = "An advanced tool bit that maximises efficiency."
@@ -121,6 +136,7 @@
name = "advanced bit"
desc = "An advanced tool bit that's fairly balanced in all aspects."
base_speed_mod = -0.25
+ base_productivity_mod = 1
failure_rate = 2
base_efficiency_mod = -0.3