mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-07-18 11:30:35 +01:00
"Fix bayonets!" (#4872)
This pr adds bayonets, knives that you can attach to some rifles. When attacking someone in melee with the rifle, you will attack your target with the bayonet instead of the rifle itself. Sprites are from tg and baystation. Also, fixes the vintage rifle having no in hand sprites
This commit is contained in:
@@ -60,7 +60,7 @@
|
||||
desc = "Worn brownish synthcotton vest with lots of pockets to unload your hands."
|
||||
icon_state = "vest_brown"
|
||||
slots = 5
|
||||
|
||||
|
||||
/obj/item/clothing/accessory/storage/white_vest
|
||||
name = "white webbing vest"
|
||||
desc = "Durable white synthcotton vest with lots of pockets to carry essentials."
|
||||
@@ -109,3 +109,18 @@
|
||||
|
||||
new /obj/item/weapon/material/hatchet/unathiknife(hold)
|
||||
new /obj/item/weapon/material/hatchet/unathiknife(hold)
|
||||
|
||||
/obj/item/clothing/accessory/storage/bayonet
|
||||
name = "bayonet sheat"
|
||||
desc = "A leather sheat designated to hold a bayonet."
|
||||
icon_state = "holster_machete"
|
||||
slots = 1
|
||||
|
||||
/obj/item/clothing/accessory/storage/bayonet/Initialize()
|
||||
. = ..()
|
||||
hold.max_storage_space = 2
|
||||
hold.can_hold = list(
|
||||
/obj/item/weapon/material/knife/bayonet
|
||||
)
|
||||
|
||||
new /obj/item/weapon/material/knife/bayonet(hold)
|
||||
@@ -383,6 +383,7 @@ var/list/worths = list(
|
||||
/obj/item/weapon/material/twohanded/pike = -100,
|
||||
/obj/item/weapon/material/twohanded/zweihander = -350,
|
||||
/obj/item/weapon/material/twohanded/fireaxe = -150,
|
||||
/obj/item/weapon/material/knife/bayonet = -100,
|
||||
/obj/item/weapon/material/sword = -120,
|
||||
/obj/item/weapon/material/scythe = -100,
|
||||
/obj/item/weapon/material/harpoon = -70,
|
||||
@@ -557,6 +558,7 @@ var/list/worths = list(
|
||||
/obj/item/clothing/head/helmet/space/emergency = 250,
|
||||
/obj/item/clothing/head/helmet/space = 450,
|
||||
//ACCESSORIES,
|
||||
/obj/item/clothing/accessory/storage/bayonet = 250,
|
||||
/obj/item/clothing/accessory/storage = 55,
|
||||
/obj/item/clothing/accessory/stethoscope = 70,
|
||||
/obj/item/clothing/accessory/medal/gold/heroism = 1000,
|
||||
|
||||
@@ -67,6 +67,10 @@
|
||||
|
||||
var/obj/item/device/firing_pin/pin = /obj/item/device/firing_pin//standard firing pin for most guns.
|
||||
|
||||
var/can_bayonet = FALSE
|
||||
var/obj/item/weapon/material/knife/bayonet/bayonet
|
||||
var/knife_x_offset = 0
|
||||
var/knife_y_offset = 0
|
||||
|
||||
var/next_fire_time = 0
|
||||
|
||||
@@ -103,6 +107,15 @@
|
||||
|
||||
queue_icon_update()
|
||||
|
||||
/obj/item/weapon/gun/update_icon()
|
||||
underlays.Cut()
|
||||
if(bayonet)
|
||||
var/image/I
|
||||
I = image('icons/obj/gun.dmi', "bayonet")
|
||||
I.pixel_x = knife_x_offset
|
||||
I.pixel_y = knife_y_offset
|
||||
underlays += I
|
||||
return ..()
|
||||
|
||||
//Checks whether a given mob can use the gun
|
||||
//Any checks that shouldn't result in handle_click_empty() being called if they fail should go here.
|
||||
@@ -180,6 +193,8 @@
|
||||
handle_suicide(user)
|
||||
else if(user.a_intent == I_HURT) //point blank shooting
|
||||
Fire(A, user, pointblank=1)
|
||||
else if(bayonet)
|
||||
bayonet.attack(A, user, def_zone)
|
||||
else
|
||||
return ..() //Pistolwhippin'
|
||||
|
||||
@@ -648,6 +663,8 @@
|
||||
obj/item/weapon/gun/Destroy()
|
||||
if (istype(pin))
|
||||
QDEL_NULL(pin)
|
||||
if(bayonet)
|
||||
QDEL_NULL(bayonet)
|
||||
return ..()
|
||||
|
||||
|
||||
@@ -675,6 +692,21 @@ obj/item/weapon/gun/Destroy()
|
||||
return
|
||||
|
||||
/obj/item/weapon/gun/attackby(var/obj/item/I as obj, var/mob/user as mob)
|
||||
|
||||
if(istype(I, /obj/item/weapon/material/knife/bayonet))
|
||||
if(!can_bayonet)
|
||||
return ..()
|
||||
|
||||
if(bayonet)
|
||||
to_chat(user, "<span class='danger'>There is a bayonet attached to \the [src] already.</span>")
|
||||
return
|
||||
|
||||
user.drop_from_inventory(I)
|
||||
bayonet = I
|
||||
I.forceMove(src)
|
||||
to_chat(user, "<span class='notice'>You attach \the [I] to the front of \the [src].</span>")
|
||||
update_icon()
|
||||
|
||||
if(!pin)
|
||||
return ..()
|
||||
|
||||
|
||||
@@ -188,6 +188,7 @@
|
||||
update_icon()
|
||||
|
||||
/obj/item/weapon/gun/projectile/attackby(var/obj/item/A as obj, mob/user as mob)
|
||||
..()
|
||||
load_ammo(A, user)
|
||||
|
||||
/obj/item/weapon/gun/projectile/attack_self(mob/user as mob)
|
||||
|
||||
@@ -134,6 +134,9 @@
|
||||
/obj/item/weapon/gun/projectile/automatic/rifle/sts35
|
||||
name = "assault rifle"
|
||||
desc = "A durable, rugged looking automatic weapon of a make popular on the frontier worlds. Uses 7.62mm rounds. It is unmarked."
|
||||
can_bayonet = TRUE
|
||||
knife_x_offset = 23
|
||||
knife_y_offset = 13
|
||||
|
||||
/obj/item/weapon/gun/projectile/automatic/rifle/sts35/update_icon()
|
||||
..()
|
||||
@@ -165,6 +168,10 @@
|
||||
auto_eject = 1
|
||||
auto_eject_sound = 'sound/weapons/smg_empty_alarm.ogg'
|
||||
|
||||
can_bayonet = TRUE
|
||||
knife_x_offset = 23
|
||||
knife_y_offset = 13
|
||||
|
||||
burst_delay = 4
|
||||
firemodes = list(
|
||||
list(mode_name="semiauto", burst=1, fire_delay=10, move_delay=null, use_launcher=null, burst_accuracy=null, dispersion=null),
|
||||
|
||||
@@ -13,6 +13,9 @@
|
||||
pump_snd = 'sound/weapons/riflebolt.ogg'
|
||||
has_wield_state = FALSE
|
||||
|
||||
can_bayonet = TRUE
|
||||
knife_x_offset = 23
|
||||
knife_y_offset = 13
|
||||
can_sawoff = TRUE
|
||||
sawnoff_workmsg = "shorten the barrel and stock"
|
||||
|
||||
@@ -26,6 +29,11 @@
|
||||
item_state = "obrez"
|
||||
slot_flags &= ~SLOT_BACK
|
||||
slot_flags |= (SLOT_BELT|SLOT_HOLSTER)
|
||||
can_bayonet = FALSE
|
||||
if(bayonet)
|
||||
qdel(bayonet)
|
||||
bayonet = null
|
||||
update_icon()
|
||||
name = "obrez"
|
||||
desc = "A shortened bolt action rifle, not really acurate. Uses 7.62mm rounds."
|
||||
to_chat(user, "<span class='warning'>You shorten the barrel and stock of the rifle!</span>")
|
||||
@@ -39,6 +47,7 @@
|
||||
recoil = 2
|
||||
accuracy = -2
|
||||
slot_flags = SLOT_BELT|SLOT_HOLSTER
|
||||
can_bayonet = FALSE
|
||||
|
||||
/obj/item/weapon/gun/projectile/contender
|
||||
name = "pocket rifle"
|
||||
@@ -94,6 +103,7 @@
|
||||
name = "\improper vintage bolt action rifle"
|
||||
desc = "An extremely old-looking rifle. Words you can't read are stamped on the gun. Doesn't look like it'll take any modern rounds."
|
||||
icon_state = "springfield"
|
||||
icon_state = "springfield"
|
||||
origin_tech = list(TECH_COMBAT = 1, TECH_MATERIAL = 3)
|
||||
fire_sound = 'sound/weapons/rifleshot.ogg'
|
||||
slot_flags = SLOT_BACK
|
||||
@@ -101,6 +111,7 @@
|
||||
handle_casings = HOLD_CASINGS
|
||||
caliber = "vintage"
|
||||
ammo_type = /obj/item/ammo_casing/vintage
|
||||
can_bayonet = TRUE
|
||||
var/open_bolt = 0
|
||||
var/obj/item/ammo_magazine/boltaction/vintage/has_clip
|
||||
|
||||
|
||||
Reference in New Issue
Block a user