Skip to content

Commit 02460f6

Browse files
authored
Modular Weapon Implementation & Bugfixes (#233)
* implements modular bolt actions * yea * crafting accessibility * forgor * fixes gun part quality * further does fixes * fixes 1 of several runtimes related to modgun scopes bottom text * scope fix part 2 * sights and bayonets for other modguns bottom text * slight bayonet touchup * fixes boltgun inhands again This fucking modgun code girl... this will kill me * fixes bolt action inhands and bayonet sprites (sort of) * fixes inhand change delay * oops * fixes blacklisting of deprecated boltguns * oldification for modguns enables proper oldify mechanics 4 modguns * finishes deprecating old boltguns * oops * non-modgun weapon mods also have visuals on modguns * fixes maxupgrade stuff on gun upgrades * guh * unblacklists the frames bottom text
1 parent afbd3f6 commit 02460f6

File tree

31 files changed

+126
-39
lines changed

31 files changed

+126
-39
lines changed

code/__DEFINES/items.dm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#define PARTMOD_FOLDING_STOCK 1
4141
#define PARTMOD_SLIDE 2
4242
#define PARTMOD_FRAME_SPRITE 4 // Defines whether grips or frames determine the inhands, TODO: remove this when V3 comes
43+
#define PARTMOD_BAYONET 8
4344

4445
//Weapon upgrade defines
4546

code/datums/autolathe/guns.dm

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@
163163

164164
/datum/design/autolathe/gun/boltgun_fs
165165
name = "FS BR .20 \"Kadmin\""
166-
build_path = /obj/item/gun/projectile/boltgun/fs
166+
build_path = /obj/item/gun/projectile/automatic/modular/bolt/fs
167167

168168
/datum/design/autolathe/gun/boltgun_fs/ui_icon()
169169
var/obj/build_type = build_path
@@ -184,15 +184,16 @@
184184

185185
/datum/design/autolathe/gun/boltgun
186186
name = "Excelsior .30 \"Kardashev-Mosin\""
187-
build_path = /obj/item/gun/projectile/boltgun
187+
build_path = /obj/item/gun/projectile/automatic/modular/bolt/excel
188+
minimum_quality = 2
188189

189190
/datum/design/autolathe/gun/boltgun/ui_icon()
190191
var/obj/build_type = build_path
191192
return icon(build_type::icon, "[build_type::icon_state]_closed")
192193

193194
/datum/design/autolathe/gun/boltgun_serbian
194195
name = "SA BR .30 \"Novakovic\""
195-
build_path = /obj/item/gun/projectile/boltgun/serbian
196+
build_path = /obj/item/gun/projectile/automatic/modular/bolt/serbian/finished
196197

197198
/datum/design/autolathe/gun/boltgun_serbian/ui_icon()
198199
var/obj/build_type = build_path
@@ -224,7 +225,7 @@
224225

225226
/datum/design/autolathe/gun/heavysniper
226227
name = "SA AMR .60 \"Hristov\""
227-
build_path = /obj/item/gun/projectile/heavysniper
228+
build_path = /obj/item/gun/projectile/automatic/modular/bolt/sniper/finished
228229
minimum_quality = 2
229230

230231
/datum/design/autolathe/gun/heavysniper/ui_icon()

code/datums/craft/craft_designs.dm

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,27 @@ Based on /datum/design of \code\datums\autolathe\autolathe_datums.dm
204204
build_path = /obj/item/part/gun/modular/mechanism/autorifle/marksman
205205
minimum_quality = 2
206206

207+
//bolt-action mechanisms
208+
209+
/datum/design/makeshift/mechanism/boltaction/junk
210+
name = "handmade manual-action mechanism"
211+
category = "bolt-action mechanisms"
212+
build_path = /obj/item/part/gun/modular/mechanism/boltgun/junk
213+
minimum_quality = 0
214+
215+
/datum/design/makeshift/mechanism/boltaction
216+
name = "manual-action mechanism"
217+
category = "bolt-action mechanisms"
218+
build_path = /obj/item/part/gun/modular/mechanism/boltgun
219+
minimum_quality = 2
220+
221+
/datum/design/makeshift/mechanism/boltaction/heavy
222+
name = "heavy manual-action mechanism"
223+
category = "bolt-action mechanisms"
224+
build_path = /obj/item/part/gun/modular/mechanism/boltgun/heavy
225+
minimum_quality = 3
226+
227+
207228
// .35
208229

209230
/datum/design/makeshift/mags_pistol
@@ -376,3 +397,28 @@ Based on /datum/design of \code\datums\autolathe\autolathe_datums.dm
376397
minimum_quality = 0
377398
// I dunno, it kinda meant to be affordable and a comodity since all amor you make with it is medicore.
378399
// Probably could be changed to +1 but the average vaga would need to upgrade the lath at least with t2
400+
401+
/datum/design/makeshift/bayonet_cheap
402+
name = "cheap integrated bayonet"
403+
build_path = /obj/item/part/gun/modular/bayonet/steel
404+
quality = -1
405+
406+
/datum/design/makeshift/bayonet
407+
name = "integrated bayonet"
408+
build_path = /obj/item/part/gun/modular/bayonet
409+
minimum_quality = 0
410+
411+
/datum/design/makeshift/scope
412+
name = "small scope"
413+
build_path = /obj/item/part/gun/modular/sights/scopesmall
414+
minimum_quality = 1 //scopes have high skill input bc. they're challenging to make
415+
416+
/datum/design/makeshift/scope/big
417+
name = "large scope"
418+
build_path = /obj/item/part/gun/modular/sights/scopebig
419+
minimum_quality = 2
420+
421+
/datum/design/makeshift/scope/custom
422+
name = "adjustable sniper scope"
423+
build_path = /obj/item/part/gun/modular/sights/customizable/scopeheavy
424+
minimum_quality = 3

code/datums/craft/gun_parts.dm

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ semi accepts weird caliber - +1 points
8080
// Bonuses from forging/type or maluses from printing
8181
var/cheap = FALSE // Set this to true for cheap variants
8282

83-
/obj/item/part/gun/modular/New(location)
83+
/obj/item/part/gun/modular/New(location, quality = 0)
8484
..()
8585
I = AddComponent(/datum/component/item_upgrade)
8686
if(interactions)
@@ -94,6 +94,9 @@ semi accepts weird caliber - +1 points
9494
I.removal_time = WORKTIME_SLOW
9595
I.removal_difficulty = FAILCHANCE_NORMAL
9696

97+
if(quality)
98+
set_quality(quality)
99+
97100
/obj/item/part/gun/modular/set_quality(quality = 0)
98101
old_quality = CLAMP(quality, -2, max_quality) // Some parts, such as One Star will permit +3 parts
99102
price_tag = initial(price_tag) * (2 ** old_quality) // From a quarter of the price for junk, to quadruple the price for antag-grade parts.
@@ -306,7 +309,7 @@ semi accepts weird caliber - +1 points
306309
part_itemstring = TRUE
307310

308311
/obj/item/part/gun/modular/grip/New(location, quality = 0)
309-
..(quality)
312+
..(quality = quality)
310313
I.weapon_upgrades[GUN_UPGRADE_DEFINE_GRIP] = type_of_grip
311314
I.weapon_upgrades[GUN_UPGRADE_OFFSET] = -15 // Without a grip the gun shoots funny, players are legally allowed to not use a grip
312315
I.gun_loc_tag = PART_GRIP
@@ -391,7 +394,7 @@ semi accepts weird caliber - +1 points
391394

392395

393396
/obj/item/part/gun/modular/mechanism/New(location, quality = 0)
394-
..(quality)
397+
..(quality = quality)
395398
I.weapon_upgrades[GUN_UPGRADE_FIREMODES] = bonus_firemodes
396399
I.weapon_upgrades[GUN_UPGRADE_DEFINE_MAG_WELL] = mag_well
397400
I.weapon_upgrades[GUN_UPGRADE_DEFINE_OK_CALIBERS] = accepted_calibers
@@ -659,7 +662,7 @@ semi accepts weird caliber - +1 points
659662
var/basemove
660663

661664
/obj/item/part/gun/modular/barrel/New(location, quality = 0)
662-
..(quality)
665+
..(quality = quality)
663666
I.weapon_upgrades[GUN_UPGRADE_DEFINE_CALIBER] = caliber
664667
if(!isnull(speed))
665668
I.weapon_upgrades[GUN_UPGRADE_STEPDELAY_MULT] = speed

code/datums/craft/recipes/guns.dm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
/datum/craft_recipe/gun/handmaderifle
2727
name = "HM BR \"Riose\""
28-
result = /obj/item/gun/projectile/boltgun/handmade
28+
result = /obj/item/gun/projectile/automatic/modular/bolt/handmade/finished
2929
steps = list(
3030
list(CRAFT_MATERIAL, 13, MATERIAL_STEEL),
3131
list(CRAFT_MATERIAL, 5, MATERIAL_WOOD),

code/game/machinery/autolathe/autolathe.dm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
ERR_NOODDITY = "Catalyst not found.",
6868
ERR_DISTANT = "User too far to operate machine.",
6969
ERR_STOPPED = "User stopped operating machine.",
70-
ERR_SKILL_ISSUE = "User cannot produce this design."
70+
ERR_SKILL_ISSUE = "User is not skilled enough to produce this design."
7171
)
7272

7373
var/tmp/datum/wires/autolathe/wires

code/game/machinery/crafting_station.dm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ var/global/list/crafting_designs
1717
var/warmed_up = FALSE
1818
var/mob/living/Crafter
1919
var/list/designs = list()
20-
categories = list("firearm frames", "firearm grips", "firearm barrels", "pistol mechanisms", "revolver mechanisms", "pump-action mechanisms", "SMG mechanisms", "self-loading mechanisms", ".35 caliber", ".40 caliber", ".20 caliber", ".25 caliber", ".30 caliber", "shotgun shells", "special munitions", "miscellaneous")
20+
categories = list("firearm frames", "firearm grips", "firearm barrels", "pistol mechanisms", "revolver mechanisms", "pump-action mechanisms", "SMG mechanisms", "self-loading mechanisms", "bolt-action mechanisms", ".35 caliber", ".40 caliber", ".20 caliber", ".25 caliber", ".30 caliber", "shotgun shells", "special munitions", "miscellaneous")
2121

2222
/obj/machinery/autolathe/crafting_station/Initialize()
2323
. = ..()
@@ -80,7 +80,7 @@ var/global/list/crafting_designs
8080
icon_state = "[icon_state]_square"
8181
if(".35 caliber", ".40 caliber", ".20 caliber", ".25 caliber", ".30 caliber", "shotgun shells", "special munitions")
8282
icon_state = "[icon_state]_points"
83-
if("firearm barrels", "pistol mechanisms", "revolver mechanisms", "pump-action mechanisms", "SMG mechanisms", "self-loading mechanisms")
83+
if("firearm barrels", "pistol mechanisms", "revolver mechanisms", "pump-action mechanisms", "SMG mechanisms", "self-loading mechanisms", "bolt-action mechanisms")
8484
icon_state = "[icon_state]_cut"
8585
else if(warmed_up)
8686
flick("craft_done", src)

code/game/machinery/vending.dm

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1641,7 +1641,7 @@
16411641
/obj/item/storage/deferred/crate/uniform_light = 2,
16421642
/obj/item/gun/projectile/kovacs = 2,
16431643
/obj/item/ammo_magazine/lrifle = 6,
1644-
/obj/item/gun/projectile/boltgun/serbian = 10,
1644+
/obj/item/gun/projectile/automatic/modular/bolt/serbian/finished = 10,
16451645
/obj/item/ammo_magazine/sllrifle = 20,
16461646
/obj/item/ammo_magazine/ammobox/lrifle_small = 30,
16471647
/obj/item/storage/ration_pack = 10,
@@ -1661,7 +1661,7 @@
16611661
/obj/item/gun/projectile/kovacs = 3000,
16621662
/obj/item/ammo_magazine/ammobox/lrifle_small = 400,
16631663
/obj/item/ammo_magazine/srifle = 300,
1664-
/obj/item/gun/projectile/boltgun/serbian = 1000,
1664+
/obj/item/gun/projectile/automatic/modular/bolt/serbian/finished = 1000,
16651665
/obj/item/ammo_magazine/sllrifle = 100,
16661666
/obj/item/storage/ration_pack = 800,
16671667
/obj/item/clothing/mask/balaclava = 100,
@@ -1694,7 +1694,7 @@
16941694
/obj/item/gun/projectile/automatic/modular/ak/frozen_star = 4,
16951695
/obj/item/gun/projectile/automatic/z8 = 4,
16961696
/obj/item/gun/projectile/shotgun/pump/regulator = 4,
1697-
/obj/item/gun/projectile/boltgun/fs/civilian = 4,
1697+
/obj/item/gun/projectile/automatic/modular/bolt/fs/civilian = 4,
16981698
/obj/item/storage/deferred/crate/clown_crime = 2,
16991699
/obj/item/storage/deferred/crate/clown_crime/wolf = 2,
17001700
/obj/item/storage/deferred/crate/clown_crime/hoxton = 2,
@@ -1723,7 +1723,7 @@
17231723
/obj/item/gun/projectile/automatic/modular/ak/frozen_star = 3200,
17241724
/obj/item/gun/projectile/automatic/z8 = 3500,
17251725
/obj/item/gun/projectile/shotgun/pump/regulator = 2400,
1726-
/obj/item/gun/projectile/boltgun/fs/civilian = 2000,
1726+
/obj/item/gun/projectile/automatic/modular/bolt/fs/civilian = 2000,
17271727
/obj/item/storage/deferred/crate/clown_crime = 1800,
17281728
/obj/item/storage/deferred/crate/clown_crime/wolf = 1800,
17291729
/obj/item/storage/deferred/crate/clown_crime/hoxton = 1800,

code/game/objects/effects/spawners/ghostroles.dm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
head = /obj/item/clothing/head/armor/steelpot
5757
shoes = /obj/item/clothing/shoes/color/black
5858
suit = /obj/item/clothing/suit/armor/flak/green
59-
suit_store = /obj/item/gun/projectile/boltgun/serbian
59+
suit_store = /obj/item/gun/projectile/automatic/modular/bolt/serbian/finished
6060
back = /obj/item/storage/backpack/satchel
6161
r_pocket = /obj/item/ammo_magazine/sllrifle
6262
id_slot = slot_wear_id

code/game/objects/items.dm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,9 @@
142142
var/list/item_upgrades = list()
143143
var/max_upgrades = 3
144144

145+
///if set, this item should add the associated sprite id to a modgun's sprite when used as an upgrade
146+
var/modular_overlay
147+
145148
var/can_use_lying = 0
146149

147150
var/chameleon_type

0 commit comments

Comments
 (0)