Skip to content

Commit

Permalink
Adds Mosin Obrez (Sawn-Off Mosin Nagant) & Sawing-Off Tweaks (#10008)
Browse files Browse the repository at this point in the history
* MOSIN OBREZ (and sawing-off tweaks)

Introduces the Mosin Obrez (sawn-off Mosin)
In addition to regular sawn-off changes, adds wild spread w/ 0.5 factor.
Adds sprites for Mosin Obrez
Mosin Nagant & Obrez requires 2 hands to rack the bolt now.
Mosin can now have interactions done while the bolt is closed (mounting/removing bayonet, sawing, etc)
Mosin can only be loaded while bolt is open (like how guns work)
Sawing a gun now checks the tool for the TOOL_SAW behavior.
Sawing is now under attackby() for ballistic guns rather than being unique to each shotgun.
Sawing a gun with an attached bayonet returns the bayonet and removes the mounting lug.
Adds additional gun variables for sawn-off guns (unique name, can_sawoff variable, unique in-hand sprites)

* Medium Weight Mosin Obrez

Sets the Obrez to be MEDIUM weight instead of HEAVY to allow 1-handed firing (still requires 2 to rack the bolt).

* Energy Saw Sawing & Sawing Tweaks

Energy Saws now function as saws (already had toolspeed set smh)
Plasmacutters can be used to sawoff guns again
Unique shotgun sawing code removed to use parent proc

* Improvised Shotgun Tweaks

Can no longer delete cabling by reslinging a shotgun that's slung.
Examine text tells you if there is a sling attached now.

* adds suppressor support

Sawing guns with suppressors return the suppressor and disallow attaching a new one
Integrally suppressed guns will no longer be suppressed after hacking off the barrel, but do not give a free suppressor

* Obrez now KICKS when fired 1-handed

similar to warden's shottie, has spread 5 when fired 1-handed

* Adds innate spread to Obrez

Obrez now has spread 10, ontop of bonus_spread 25 from being sawn off.

* Removes the Russian SOUL

Changes sawn description from "Огонь!" ("Open fire!") to something in English.
  • Loading branch information
VickiMorris authored Oct 14, 2023
1 parent 602e6a1 commit 8048bde
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 25 deletions.
1 change: 1 addition & 0 deletions code/game/objects/items/melee/energy.dm
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@
w_class = WEIGHT_CLASS_NORMAL
sharpness = IS_SHARP
light_color = "#40ceff"
tool_behaviour = TOOL_SAW
toolspeed = 0.7 //faster as a saw

/obj/item/melee/transforming/energy/sword/cyborg
Expand Down
5 changes: 4 additions & 1 deletion code/modules/projectiles/gun.dm
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
var/vary_fire_sound = TRUE
var/fire_sound_volume = 50
var/dry_fire_sound = 'sound/weapons/gun_dry_fire.ogg'
var/suppressed = null //whether or not a message is displayed when fired
var/suppressed = null //whether or not a message is displayed when fired
var/can_suppress = FALSE
var/suppressed_sound = 'sound/weapons/gunshot_silenced.ogg'
var/suppressed_volume = 10
Expand All @@ -32,7 +32,10 @@
var/clumsy_check = TRUE
var/obj/item/ammo_casing/chambered = null
trigger_guard = TRIGGER_GUARD_NORMAL //trigger guard on the weapon, hulks can't fire them with their big meaty fingers
var/can_sawoff = FALSE
var/sawn_name = null //used if gun has a special sawn-off rename
var/sawn_desc = null //description change if weapon is sawn-off
var/sawn_item_state = null //used if gun has a special sawn-off in-hand sprite
var/sawn_off = FALSE
var/burst_size = 1 //how large a burst is
var/fire_delay = 0 //rate of fire for burst firing and semi auto
Expand Down
28 changes: 24 additions & 4 deletions code/modules/projectiles/guns/ballistic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,9 @@
to_chat(user, "<span class='notice'>You screw \the [S] onto \the [src].</span>")
install_suppressor(A)
return
if((A.tool_behaviour == TOOL_SAW || istype(A, /obj/item/gun/energy/plasmacutter)) && can_sawoff == TRUE)
sawoff(user)
return
return FALSE

/obj/item/gun/ballistic/process_fire(atom/target, mob/living/user, message = TRUE, params = null, zone_override = "", bonus_spread = 0)
Expand Down Expand Up @@ -407,7 +410,6 @@
#undef BRAINS_BLOWN_THROW_RANGE


//TODO: sawing off guns with TOOL_SAW
/obj/item/gun/ballistic/proc/sawoff(mob/user)
if(sawn_off)
to_chat(user, "<span class='warning'>\The [src] is already shortened!</span>")
Expand All @@ -424,13 +426,31 @@
if(sawn_off)
return
user.visible_message("[user] shortens \the [src]!", "<span class='notice'>You shorten \the [src].</span>")
name = "sawn-off [src.name]"
if (bayonet)
bayonet.forceMove(drop_location())
clear_bayonet()
if (suppressed)
if (istype(suppressed, /obj/item/suppressor))
//weight class is set later, don't need to worry about removing extra weight from the suppressor
var/obj/S = suppressed
S.forceMove(drop_location())
//If it's integrally suppressed, you're messing that up by chopping off most of it from the tip
suppressed = null
if (sawn_name)
name = sawn_name
else
name = "sawn-off [src.name]"
desc = sawn_desc
w_class = WEIGHT_CLASS_NORMAL
item_state = "gun"
if (sawn_item_state)
item_state = sawn_item_state
else
item_state = "gun"
slot_flags &= ~ITEM_SLOT_BACK //you can't sling it on your back
slot_flags |= ITEM_SLOT_BELT //but you can wear it on your belt (poorly concealed under a trenchcoat, ideally)
slot_flags |= ITEM_SLOT_BELT //but you can wear it on your belt (poorly concealed under a trenchcoat, ideally)
recoil = SAWN_OFF_RECOIL
can_bayonet = FALSE //you got rid of the mounting lug with the rest of the barrel, dumbass
can_suppress = FALSE //ditto for the threaded barrel
sawn_off = TRUE
spread_multiplier = 1.6
update_icon()
Expand Down
28 changes: 27 additions & 1 deletion code/modules/projectiles/guns/ballistic/rifle.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
add_overlay("[icon_state]_bolt[bolt_locked ? "_locked" : ""]")

/obj/item/gun/ballistic/rifle/rack(mob/user = null)
if(!is_wielded)
to_chat(user, "<span class='warning'>You require your other hand to be free to rack the [bolt_wording] of \the [src]!</span>")
return
if(bolt_locked == FALSE)
to_chat(user, "<span class='notice'>You open the bolt of \the [src].</span>")
playsound(src, rack_sound, rack_sound_volume, rack_sound_vary)
Expand All @@ -35,7 +38,7 @@
return ..()

/obj/item/gun/ballistic/rifle/attackby(obj/item/A, mob/user, params)
if (!bolt_locked)
if ((istype(A, /obj/item/ammo_casing/a762) || istype(A, /obj/item/ammo_box/a762)) && !bolt_locked)
to_chat(user, "<span class='notice'>The bolt is closed!</span>")
return
return ..()
Expand All @@ -44,6 +47,14 @@
. = ..()
. += "The bolt is [bolt_locked ? "open" : "closed"]."

/obj/item/gun/ballistic/rifle/shoot_live_shot(mob/living/user, pointblank, atom/pbtarget, message)
if(sawn_off == TRUE)
if(!is_wielded)
recoil = 5
else
recoil = SAWN_OFF_RECOIL
. = ..()

///////////////////////
// BOLT ACTION RIFLE //
///////////////////////
Expand All @@ -53,6 +64,10 @@
desc = "This piece of junk looks like something that could have been used 700 years ago. It feels slightly moist."
icon_state = "moistnugget"
item_state = "moistnugget"
can_sawoff = TRUE
sawn_name = "\improper Mosin Obrez"
sawn_desc = "A hand cannon of a rifle, try not to break your wrists."
sawn_item_state = "halfnugget"
slot_flags = ITEM_SLOT_BACK
mag_type = /obj/item/ammo_box/magazine/internal/boltaction
can_bayonet = TRUE
Expand All @@ -61,9 +76,20 @@
w_class = WEIGHT_CLASS_BULKY
weapon_weight = WEAPON_HEAVY

/obj/item/gun/ballistic/rifle/boltaction/sawoff(mob/user)
. = ..()
//Has 25 bonus spread due to sawn-off accuracy penalties
if (.)
//Wild spread only applies to innate and unwielded spread
spread = 10
wild_spread = TRUE
wild_factor = 0.5
weapon_weight = WEAPON_MEDIUM

/obj/item/gun/ballistic/rifle/boltaction/enchanted
name = "enchanted bolt action rifle"
desc = "Careful not to lose your head."
can_sawoff = FALSE
var/guns_left = 30
mag_type = /obj/item/ammo_box/magazine/internal/boltaction/enchanted

Expand Down
31 changes: 12 additions & 19 deletions code/modules/projectiles/guns/ballistic/shotgun.dm
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,9 @@
icon_state = "riotshotgun"
item_state = "shotgun"
mag_type = /obj/item/ammo_box/magazine/internal/shot/riot
can_sawoff = TRUE
sawn_desc = "Come with me if you want to live."

/obj/item/gun/ballistic/shotgun/riot/attackby(obj/item/A, mob/user, params)
..()
if(istype(A, /obj/item/circular_saw) || istype(A, /obj/item/gun/energy/plasmacutter))
sawoff(user)
if(istype(A, /obj/item/melee/transforming/energy))
var/obj/item/melee/transforming/energy/W = A
if(W.active)
sawoff(user)

// Automatic Shotguns//

/obj/item/gun/ballistic/shotgun/automatic
Expand Down Expand Up @@ -191,6 +183,7 @@
flags_1 = CONDUCT_1
slot_flags = ITEM_SLOT_BACK
mag_type = /obj/item/ammo_box/magazine/internal/shot/dual
can_sawoff = TRUE
sawn_desc = "Omar's coming!"
obj_flags = UNIQUE_RENAME
rack_sound_volume = 0
Expand Down Expand Up @@ -227,15 +220,6 @@
)
. = ..()

/obj/item/gun/ballistic/shotgun/doublebarrel/attackby(obj/item/A, mob/user, params)
..()
if(istype(A, /obj/item/melee/transforming/energy))
var/obj/item/melee/transforming/energy/W = A
if(W.active)
sawoff(user)
if(istype(A, /obj/item/circular_saw) || istype(A, /obj/item/gun/energy/plasmacutter))
sawoff(user)

// IMPROVISED SHOTGUN //

/obj/item/gun/ballistic/shotgun/doublebarrel/improvised
Expand All @@ -255,6 +239,9 @@
/obj/item/gun/ballistic/shotgun/doublebarrel/improvised/attackby(obj/item/A, mob/user, params)
..()
if(istype(A, /obj/item/stack/cable_coil) && !sawn_off)
if(slung)
to_chat(user, "<span class='warning'>There is already a sling on [src]!</span>")
return
var/obj/item/stack/cable_coil/C = A
if(C.use(10))
slot_flags = ITEM_SLOT_BACK
Expand All @@ -273,9 +260,14 @@
. = ..()
if(. && slung) //sawing off the gun removes the sling
new /obj/item/stack/cable_coil(get_turf(src), 10)
slung = 0
slung = FALSE
update_icon()

/obj/item/gun/ballistic/shotgun/doublebarrel/improvised/examine(mob/user)
. = ..()
if (slung)
. += "It has a shoulder sling fashioned from spare wiring attached."

/obj/item/gun/ballistic/shotgun/doublebarrel/improvised/sawn
name = "sawn-off improvised shotgun"
desc = "A single-shot shotgun. Better not miss."
Expand All @@ -295,6 +287,7 @@
mag_type = /obj/item/ammo_box/magazine/internal/shot/bounty
w_class = WEIGHT_CLASS_BULKY
weapon_weight = WEAPON_MEDIUM
can_sawoff = FALSE
force = 10 //it has a hook on it
attack_verb = list("slashed", "hooked", "stabbed")
hitsound = 'sound/weapons/bladeslice.ogg'
Expand Down
Binary file modified icons/mob/inhands/weapons/guns_lefthand.dmi
Binary file not shown.
Binary file modified icons/mob/inhands/weapons/guns_righthand.dmi
Binary file not shown.
Binary file modified icons/obj/guns/projectile.dmi
Binary file not shown.

0 comments on commit 8048bde

Please sign in to comment.