Reorganise smithing files into a modules folder (#28782)

* reorganise smithing into a module

* move casts

* rename and move some files

* move defines

* update dme

* move hopper defines

* move ORM/hopper point defines

* remove redefine

* rename smith defines, move smith datums

* implement 28806 and 28877

* remove old files
This commit is contained in:
datlo
2025-04-04 07:59:01 +00:00
committed by GitHub
parent 5563f3ff19
commit d46e2f8fde
24 changed files with 2324 additions and 2358 deletions
@@ -0,0 +1,163 @@
/obj/item/smithed_item/insert
name = "debug insert"
icon_state = "insert"
desc = "Debug insert. If you see this, notify the development team."
/// Brute armor
var/brute_armor = 0
/// Burn armor
var/burn_armor = 0
/// Laser armor
var/laser_armor = 0
/// Explosive armor
var/explosive_armor = 0
/// Movement speed
var/movement_speed_mod = 0
/// Heat insulation
var/heat_insulation = 0
/// Electrical insulation
var/siemens_coeff = 0.0
/// Radiation armor
var/radiation_armor = 0
/// The suit the insert is attached to
var/obj/item/clothing/suit/attached_suit
/obj/item/smithed_item/insert/set_stats()
brute_armor = initial(brute_armor) * quality.stat_mult * material.brute_armor_mult
burn_armor = initial(burn_armor) * quality.stat_mult * material.burn_armor_mult
laser_armor = initial(laser_armor) * quality.stat_mult * material.laser_armor_mult
explosive_armor = initial(explosive_armor) * quality.stat_mult * material.explosive_armor_mult
movement_speed_mod = initial(movement_speed_mod) * quality.stat_mult * material.movement_speed_mod
heat_insulation = initial(heat_insulation) * quality.stat_mult * material.heat_insulation_mult
siemens_coeff = initial(siemens_coeff) * quality.stat_mult * material.siemens_coeff_mult
radiation_armor = initial(radiation_armor) * quality.stat_mult * material.radiation_armor_mult
armor = new /datum/armor(brute_armor, brute_armor, laser_armor, laser_armor, explosive_armor, radiation_armor, burn_armor, 0, 0)
/obj/item/smithed_item/insert/on_attached(obj/item/clothing/suit/target)
if(!istype(target))
return
attached_suit = target
attached_suit.armor = attached_suit.armor.attachArmor(armor)
attached_suit.insert_slowdown -= movement_speed_mod
attached_suit.slowdown = initial(attached_suit.slowdown) + attached_suit.insert_slowdown
if(attached_suit.mobility_meshed)
attached_suit.slowdown = 0
attached_suit.siemens_coefficient -= siemens_coeff
attached_suit.min_cold_protection_temperature -= heat_insulation
attached_suit.max_heat_protection_temperature += heat_insulation
/obj/item/smithed_item/insert/on_detached(mob/user)
attached_suit.armor = attached_suit.armor.detachArmor(armor)
attached_suit.insert_slowdown += movement_speed_mod
attached_suit.slowdown = initial(attached_suit.slowdown) + attached_suit.insert_slowdown
if(attached_suit.mobility_meshed)
attached_suit.slowdown = 0
attached_suit.siemens_coefficient += siemens_coeff
attached_suit.min_cold_protection_temperature += heat_insulation
attached_suit.max_heat_protection_temperature -= heat_insulation
attached_suit.inserts -= src
attached_suit = null
/obj/item/smithed_item/insert/ballistic
name = "ballistic plate"
desc = "A reinforced plate designed to stop small-caliber bullets and kinetic impacts."
brute_armor = 10
explosive_armor = 10
heat_insulation = -10
/obj/item/smithed_item/insert/thermal
name = "thermal plate"
desc = "A fragile plate designed to reduce heat exposure."
brute_armor = -10
burn_armor = 10
heat_insulation = 10
/obj/item/smithed_item/insert/fireproofing
name = "fireproofing plate"
desc = "A heavy plate of asbestos designed to fireproof a user. A firefighter's godsend."
burn_armor = 10
movement_speed_mod = -0.2
heat_insulation = 20
/obj/item/smithed_item/insert/reflective
name = "reflective plate"
desc = "A shiny plate that assists in laser deflection."
burn_armor = -10
laser_armor = 10
siemens_coeff = -0.2
/obj/item/smithed_item/insert/rad_hazard
name = "radiation hazard plate"
desc = "A dense plate that can reduce a wearer's radiation exposure."
heat_insulation = -10
radiation_armor = 20
/obj/item/smithed_item/insert/rubberized
name = "rubberized plate"
desc = "A flexible plate that is resistant to electrical shocks."
brute_armor = -10
siemens_coeff = 0.2
/obj/item/smithed_item/insert/advanced
name = "advanced armor mesh"
desc = "An alloy mesh that can protect the wearer from most sources of damage."
brute_armor = 10
burn_armor = 10
laser_armor = 10
explosive_armor = 10
radiation_armor = 10
movement_speed_mod = -0.2
/obj/item/smithed_item/insert/engineering
name = "engineering mesh"
desc = "An alloy mesh designed to assist in most work around electrical engines."
brute_armor = -10
burn_armor = 10
radiation_armor = 10
heat_insulation = 10
explosive_armor = 10
siemens_coeff = 0.4
movement_speed_mod = -0.2
/obj/item/smithed_item/insert/heavy
name = "heavy duty plate"
desc = "An advanced plate often used in SWAT gear. Heavy, yet durable."
brute_armor = 20
burn_armor = 10
laser_armor = 10
explosive_armor = 10
heat_insulation = 10
siemens_coeff = -0.4
movement_speed_mod = -0.4
/obj/item/smithed_item/insert/mobility
name = "mobility mesh"
desc = "An advanced alloy mesh that is both lightweight and invigorating to the wearer."
brute_armor = -5
burn_armor = -5
laser_armor = -5
heat_insulation = 10
/// Attached suit slowdown when the mobility mesh was applied
var/initial_slowdown = 0
/obj/item/smithed_item/insert/mobility/on_attached(obj/item/clothing/suit/target)
. = ..()
attached_suit.mobility_meshed = TRUE
attached_suit.slowdown = 0
/obj/item/smithed_item/insert/mobility/on_detached(mob/user)
attached_suit.mobility_meshed = FALSE
. = ..()
/obj/item/smithed_item/insert/admin
name = "adminium mesh"
desc = "A special mesh plate reserved exclusively for high-ranking central command personnel."
brute_armor = 50
burn_armor = 50
laser_armor = 50
radiation_armor = 50
heat_insulation = 50
movement_speed_mod = 1
siemens_coeff = 1
quality = /datum/smith_quality/masterwork
material = /datum/smith_material/platinum
+137
View File
@@ -0,0 +1,137 @@
/obj/item/smithed_item/lens
name = "Debug lens"
icon_state = "lens"
desc = "Debug lens. If you see this, notify the development team."
/// Base laser speed multiplier
var/base_laser_speed_mult = 0
/// Base power draw multiplier
var/base_power_mult = 0
/// Base damage multiplier
var/base_damage_mult = 0
/// Base fire rate multiplier
var/base_fire_rate_mult = 0
/// Laser speed multiplier after construction
var/laser_speed_mult = 1
/// Power draw multiplier after construction
var/power_mult = 1
/// Damage multiplier after construction
var/damage_mult = 1
/// Fire rate multiplier after construction
var/fire_rate_mult = 1
/// lens durability
var/durability = 40
/// Max durability
var/max_durability = 40
/// The weapon the lens is attached to
var/obj/item/gun/energy/attached_gun
/obj/item/smithed_item/lens/set_stats()
durability = initial(durability) * material.durability_mult
max_durability = durability
power_mult = 1 + (base_power_mult * quality.stat_mult * material.power_draw_mult)
damage_mult = 1 + (base_damage_mult * quality.stat_mult * material.projectile_damage_multiplier)
laser_speed_mult = 1 + (base_laser_speed_mult * quality.stat_mult * material.projectile_speed_mult)
fire_rate_mult = 1 + (base_fire_rate_mult * quality.stat_mult * material.fire_rate_multiplier)
/obj/item/smithed_item/lens/on_attached(obj/item/gun/energy/target)
if(!istype(target))
return
attached_gun = target
attached_gun.fire_delay = attached_gun.fire_delay / fire_rate_mult
for(var/obj/item/ammo_casing/energy/casing in attached_gun.ammo_type)
casing.e_cost = casing.e_cost * power_mult
casing.lens_damage_multiplier = casing.lens_damage_multiplier * damage_mult
casing.lens_speed_multiplier = casing.lens_speed_multiplier / laser_speed_mult
/obj/item/smithed_item/lens/on_detached()
attached_gun.fire_delay = attached_gun.fire_delay * fire_rate_mult
for(var/obj/item/ammo_casing/energy/casing in attached_gun.ammo_type)
casing.e_cost = casing.e_cost / power_mult
casing.lens_damage_multiplier = casing.lens_damage_multiplier / damage_mult
casing.lens_speed_multiplier = casing.lens_speed_multiplier * laser_speed_mult
attached_gun.current_lens = null
attached_gun = null
/obj/item/smithed_item/lens/examine(mob/user)
. = ..()
var/healthpercent = (durability/max_durability) * 100
switch(healthpercent)
if(80 to 100)
. += "It looks pristine."
if(60 to 79)
. += "It looks slightly used."
if(40 to 59)
. += "It's seen better days."
if(20 to 39)
. += "It's been heavily used."
if(0 to 19)
. += "<span class='warning'>It's falling apart!</span>"
/obj/item/smithed_item/lens/proc/damage_lens()
durability--
if(durability <= 0)
break_lens()
/obj/item/smithed_item/lens/proc/break_lens()
on_detached()
qdel(src)
/obj/item/smithed_item/lens/accelerator
name = "accelerator lens"
desc = "A lens that accelerates energy beams to a higher velocity, using some of its own energy to propel it."
base_laser_speed_mult = 0.1
base_damage_mult = -0.1
/obj/item/smithed_item/lens/speed
name = "speed lens"
desc = "A lens that cools the capacitors more efficiently, allowing for greater fire rate."
base_fire_rate_mult = 0.15
base_damage_mult = -0.1
durability = 30
/obj/item/smithed_item/lens/amplifier
name = "amplifier lens"
desc = "A lens that increases the frequency of emitted beams, increasing their potency."
base_power_mult = 0.2
base_damage_mult = 0.1
/obj/item/smithed_item/lens/efficiency
name = "efficiency lens"
desc = "A lens that optimizes the number of shots an energy weapon can take before running dry."
base_power_mult = -0.2
base_damage_mult = -0.1
durability = 80
/obj/item/smithed_item/lens/rapid
name = "rapid lens"
desc = "An advanced lens that bypasses the heat capacitor entirely, allowing for unprecedented fire rates of low-power emissions."
base_fire_rate_mult = 0.5
base_laser_speed_mult = -0.1
base_damage_mult = -0.2
durability = 60
/obj/item/smithed_item/lens/densifier
name = "densifier lens"
desc = "An advanced lens that keeps energy emissions in the barrel as long as possible, maximising impact at the cost of everything else."
base_fire_rate_mult = -0.4
base_laser_speed_mult = -0.4
base_damage_mult = 0.4
durability = 30
/obj/item/smithed_item/lens/velocity
name = "velocity lens"
desc = "An advanced lens that forces energy emissions from the barrel as fast as possible, accelerating them to ludicrous speed."
base_laser_speed_mult = 0.5
base_damage_mult = -0.2
durability = 30
/obj/item/smithed_item/lens/admin
name = "adminium lens"
desc = "A hyper-advanced lens restricted to high-ranking central command officials."
laser_speed_mult = 5
damage_mult = 5
fire_rate_mult = 5
power_mult = -0.5
durability = 3000
quality = /datum/smith_quality/masterwork
material = /datum/smith_material/platinum
@@ -0,0 +1,131 @@
/obj/item/smithed_item/tool_bit
name = "Debug tool bit"
icon_state = "bit"
desc = "Debug tool bit. If you see this, notify the development team."
/// Base Speed modifier
var/base_speed_mod = 0
/// Base Efficiency modifier
var/base_efficiency_mod = 0
/// Speed modifier
var/speed_mod = 1.0
/// Efficiency modifier
var/efficiency_mod = 1.0
/// Failure rate
var/failure_rate = 0
/// Size modifier
var/size_mod = 0
/// Durability
var/durability = 90
/// Max durability
var/max_durability = 90
/// The tool the bit is attached to
var/obj/item/attached_tool
/obj/item/smithed_item/tool_bit/interact_with_atom(atom/target, mob/living/user, list/modifiers)
. = ..()
if(istype(target, /obj/item))
SEND_SIGNAL(target, COMSIG_BIT_ATTACH, src, user)
return ITEM_INTERACT_COMPLETE
/obj/item/smithed_item/tool_bit/set_stats()
durability = initial(durability) * material.durability_mult
max_durability = durability
size_mod = initial(size_mod) + material.size_mod
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)
/obj/item/smithed_item/tool_bit/on_attached(obj/item/target)
if(!istype(target))
return
attached_tool = target
attached_tool.w_class += size_mod
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
/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.attached_bits -= src
attached_tool = null
/obj/item/smithed_item/tool_bit/examine(mob/user)
. = ..()
var/healthpercent = (durability/max_durability) * 100
switch(healthpercent)
if(80 to 100)
. += "It looks pristine."
if(60 to 79)
. += "It looks slightly used."
if(40 to 59)
. += "It's seen better days."
if(20 to 39)
. += "It's been heavily used."
if(0 to 19)
. += "<span class='warning'>It's falling apart!</span>"
/obj/item/smithed_item/tool_bit/proc/damage_bit()
durability--
if(istype(attached_tool, /obj/item/rcd))
durability--
if(durability == 0)
break_bit()
/obj/item/smithed_item/tool_bit/proc/break_bit()
on_detached()
qdel(src)
/obj/item/smithed_item/tool_bit/speed
name = "speed bit"
desc = "A tool bit optimized for speed, at the cost of efficiency."
base_speed_mod = -0.2
failure_rate = 5
base_efficiency_mod = 0.1
/obj/item/smithed_item/tool_bit/efficiency
name = "efficient bit"
desc = "A tool bit optimized for efficiency, at the cost of speed."
base_speed_mod = 0.2
base_efficiency_mod = -0.25
/obj/item/smithed_item/tool_bit/balanced
name = "balanced bit"
desc = "A tool bit that's fairly balanced in all aspects."
base_speed_mod = -0.1
failure_rate = 2
base_efficiency_mod = -0.1
/obj/item/smithed_item/tool_bit/heavy
name = "heavy duty bit"
desc = "A large, advanced tool bit that maximises speed."
base_speed_mod = -0.4
failure_rate = 10
base_efficiency_mod = 0.25
size_mod = 1
durability = 120
/obj/item/smithed_item/tool_bit/economical
name = "economical bit"
desc = "An advanced tool bit that maximises efficiency."
base_speed_mod = 0.4
base_efficiency_mod = -0.45
durability = 60
/obj/item/smithed_item/tool_bit/advanced
name = "advanced bit"
desc = "An advanced tool bit that's fairly balanced in all aspects."
base_speed_mod = -0.25
failure_rate = 2
base_efficiency_mod = -0.3
/obj/item/smithed_item/tool_bit/admin
name = "adminium bit"
desc = "A hyper-advanced bit restricted to central command officials."
speed_mod = -1
efficiency_mod = 1
durability = 300
quality = /datum/smith_quality/masterwork
material = /datum/smith_material/platinum