forked from Fluffy-Frontier/FluffySTG
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactors gun repair and maintenance. Gun maintenance kits; available…
… in cargo or the security equipment vendor (#89205) Misfire chance, gun jamming (currently only on boltaction rifles) and integrity repairs are now handled by gun maintenance kits. Using a kit on a gun resets any misfire chance or jamming, and restores the weapon's integrity back to full. You can find gun maintenance kits in security equipment vendors, or order a crate of them from cargo. You can also make a maint version to retain the improvised nature of the previous cleaning functionaltiy. Firstly, clearing misfires was always a little confusing for most players, as it required a bolt of cloth to fix. That's really on me for making that as confusing as possible. We ended up with multiple firearm degradation mechanics, so consolidating their restoration makes it easier for future code maintenance. I disliked that the kits existed but were mostly only for the sake of an extremely niche interaction. And that interaction was, at best, kind of niche. Expanding out their use to gun maintenance generally is honestly better design. :cl: refactor: Gun maintenance is now consolidated into a single item, the gun maintenance kit, rather than multiple different item interactions. It is handled on the maintenance kit itself, and not in gun code. qol: You can order maintenance kits from cargo, and get some out of the security equipment vendor. Helpful if someone spilled acid onto your disabler. You can also make a makeshift one from maintenance trash. /:cl:
- Loading branch information
1 parent
f0b5266
commit 6aab9b6
Showing
11 changed files
with
113 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,78 @@ | ||
/obj/item/gun_maintenance_supplies | ||
name = "gun maintenance supplies" | ||
desc = "plastic box containing gun maintenance supplies and spare parts. Use them on a rifle to clean it." | ||
icon = 'icons/obj/storage/box.dmi' | ||
icon_state = "plasticbox" | ||
w_class = WEIGHT_CLASS_SMALL | ||
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' | ||
/// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters