Files
Bubberstation/code/game/objects/items/gun_maintenance.dm
GhomandGitHub 6eb2d1674a Implementing materials checks for techweb designs. (#96257)
## About The Pull Request
In similar fashion to what was done with crafting recipes last year,
this year it's time for techweb designs and printed items to be audited.
This is mostly just about consistency, we've a lot of items that can be
printed by protolathes, autolathes, circuit printers and techfab etc.
However they almost all (except most stacks, mainly) have custom
materials that do not match in one way or another with the materials
used by the design, which is what this PR is for.

"But items printed from lathes etc. already get the mats used to make
them." Yes, they do, however that isn't the case for items of the same
type that were spawned in some other way (cargo shuttle, space/maints
loot, mapped, admins), this create a subtle discrepancy. It isn't a huge
deal (in spite of the size of this PR, ton of designs), but given that I
have done something similar with crafting recipes before, I may as well
give it a second arc of some sort and bring things to completion. And
fix a few possible oversights.

TL;DR consistency and stuff

## Why It's Good For The Game
Consistency, unit test checks to make it harder not to be consistent in
the future. Still has a few TODOs like:

- [x] Fixed newly printed, fully charged RCDs costing less than the RCD
cartridges required to fully charge one. EDIT: I had to tweak the newly
added RDD as well because it suffered from the same fundamental issue.
- [x] Fixed plates being made of iron and yet shattering like ceramic
ones. A new subtype for metallic ones has been made.

## Changelog

🆑
refactor: Refactored a few things with techweb designs (the ones for
autolathes, protolathes, circuit printers, mechfabs etc.) to make sure
that the materials of items that can be made from these designs more
closely match the materials used to make them.
fix: Lizard fries no longer need a plate to be made, like all other
treats that used to require plates in a distant past.
balance: Tweaked the materials cost of RCD, RDD and RCD cartridges.
image: Oven trays now have a more metallic hue.
balance: Plates printed printed from lathes won't shatter like ceramic
ones, in virtue of them being made out of iron instead.
/🆑
2026-07-06 00:13:02 -07:00

81 lines
2.9 KiB
Plaintext

/obj/item/gun_maintenance_supplies
name = "gun maintenance kit"
desc = "A toolbox containing gun maintenance supplies and spare parts. Can be applied to firearms to maintain them."
icon = 'icons/obj/storage/toolbox.dmi'
icon_state = "maint_kit"
inhand_icon_state = "ammobox"
lefthand_file = 'icons/mob/inhands/equipment/toolbox_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/toolbox_righthand.dmi'
force = 12
throwforce = 12
throw_speed = 2
throw_range = 7
demolition_mod = 1.25
w_class = WEIGHT_CLASS_BULKY
drop_sound = 'sound/items/handling/ammobox_drop.ogg'
pickup_sound = 'sound/items/handling/ammobox_pickup.ogg'
custom_materials = list(/datum/material/iron = SHEET_MATERIAL_AMOUNT * 6)
/// How many times we can use this maintenance kit to maintain a gun
var/uses = 3
/// THe maximum uses, used for our examine text.
var/max_uses = 3
/obj/item/gun_maintenance_supplies/examine(mob/user)
. = ..()
. += span_info("This kit has [uses] uses out of [max_uses] left.")
/obj/item/gun_maintenance_supplies/interact_with_atom(atom/interacting_with, mob/living/user, list/modifiers)
. = ..()
if(. & ITEM_INTERACT_ANY_BLOCKER)
return ITEM_INTERACT_BLOCKING
if(!isgun(interacting_with))
balloon_alert(user, "not a gun!")
return ITEM_INTERACT_BLOCKING
var/obj/item/gun/gun_to_fix = interacting_with
var/gun_is_damaged = gun_to_fix.get_integrity() < gun_to_fix.max_integrity
var/use_charge = FALSE
if(gun_is_damaged)
gun_to_fix.repair_damage(gun_to_fix.max_integrity)
use_charge = TRUE
if(istype(gun_to_fix, /obj/item/gun/ballistic))
var/obj/item/gun/ballistic/ballistic_gun_to_fix = gun_to_fix
if(ballistic_gun_to_fix.misfire_probability > initial(ballistic_gun_to_fix.misfire_probability))
ballistic_gun_to_fix.misfire_probability = initial(ballistic_gun_to_fix.misfire_probability)
if(istype(ballistic_gun_to_fix, /obj/item/gun/ballistic/rifle/boltaction))
var/obj/item/gun/ballistic/rifle/boltaction/rifle_to_fix = ballistic_gun_to_fix
if(rifle_to_fix.jammed)
rifle_to_fix.jammed = FALSE
rifle_to_fix.unjam_chance = initial(rifle_to_fix.unjam_chance)
rifle_to_fix.jamming_chance = initial(rifle_to_fix.jamming_chance)
use_charge = TRUE
if(!use_charge)
balloon_alert(user, "no need for repair!")
return ITEM_INTERACT_BLOCKING
balloon_alert(user, "maintenance complete")
use_the_kit()
return ITEM_INTERACT_SUCCESS
/obj/item/gun_maintenance_supplies/proc/use_the_kit()
uses --
if(!uses)
qdel(src)
/obj/item/gun_maintenance_supplies/makeshift
name = "makeshift gun maintenance kit"
desc = "A toolbox containing enough supplies to juryrig repairs on firearms. Can be applied to firearms to maintain them. \
The tools are a little basic, and the materials low-quality, but it gets the job done."
icon_state = "maint_kit_makeshift"
inhand_icon_state = "toolbox_blue"
uses = 1
max_uses = 1
custom_materials = list(/datum/material/iron = SHEET_MATERIAL_AMOUNT * 6, /datum/material/plastic = SMALL_MATERIAL_AMOUNT)