diff --git a/code/datums/trading/weaponry.dm b/code/datums/trading/weaponry.dm index 1641071abd2..597efc4283e 100644 --- a/code/datums/trading/weaponry.dm +++ b/code/datums/trading/weaponry.dm @@ -101,7 +101,8 @@ /obj/item/weapon/gun/projectile/contender = TRADER_THIS_TYPE, /obj/item/weapon/gun/projectile/revolver/lemat = TRADER_THIS_TYPE, /obj/item/weapon/gun/projectile/shotgun/pump/rifle/vintage = TRADER_THIS_TYPE, - /obj/item/weapon/gun/energy/rifle/icelance = TRADER_THIS_TYPE + /obj/item/weapon/gun/energy/rifle/icelance = TRADER_THIS_TYPE, + /obj/item/clothing/accessory/storage/bayonet = TRADER_THIS_TYPE ) diff --git a/code/game/objects/items/weapons/material/knives.dm b/code/game/objects/items/weapons/material/knives.dm index f5bc195ead9..38b75f1e620 100644 --- a/code/game/objects/items/weapons/material/knives.dm +++ b/code/game/objects/items/weapons/material/knives.dm @@ -82,3 +82,14 @@ desc = "A huge thing used for chopping and chopping up meat. This includes clowns and clown-by-products." force_divisor = 0.25 // 15 when wielded with hardness 60 (steel) attack_verb = list("cleaved", "slashed", "stabbed", "sliced", "torn", "ripped", "diced", "cut") + +/obj/item/weapon/material/knife/bayonet + name = "bayonet" + desc = "A sharp military knife, can be attached to a rifle." + icon = 'icons/obj/weapons.dmi' + icon_state = "bayonet" + item_state = "knife" + applies_material_colour = 0 + force_divisor = 0.35 + can_embed = 0 + w_class = 3 \ No newline at end of file diff --git a/code/game/objects/random/random.dm b/code/game/objects/random/random.dm index 197045c4f1f..bf76fc401f1 100644 --- a/code/game/objects/random/random.dm +++ b/code/game/objects/random/random.dm @@ -570,7 +570,8 @@ /obj/item/weapon/material/twohanded/pike, /obj/item/weapon/material/twohanded/pike/halberd, /obj/item/weapon/material/twohanded/pike/pitchfork, - /obj/item/weapon/melee/whip + /obj/item/weapon/melee/whip, + /obj/item/clothing/accessory/storage/bayonet ) /obj/random/coin diff --git a/code/modules/clothing/under/accessories/storage.dm b/code/modules/clothing/under/accessories/storage.dm index ce314300712..5033cfcdad4 100644 --- a/code/modules/clothing/under/accessories/storage.dm +++ b/code/modules/clothing/under/accessories/storage.dm @@ -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) \ No newline at end of file diff --git a/code/modules/item_worth/worths_list.dm b/code/modules/item_worth/worths_list.dm index b6d19b14577..0ac19037800 100644 --- a/code/modules/item_worth/worths_list.dm +++ b/code/modules/item_worth/worths_list.dm @@ -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, diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index ec37b2039d1..140dd037c44 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -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, "There is a bayonet attached to \the [src] already.") + return + + user.drop_from_inventory(I) + bayonet = I + I.forceMove(src) + to_chat(user, "You attach \the [I] to the front of \the [src].") + update_icon() + if(!pin) return ..() diff --git a/code/modules/projectiles/guns/projectile.dm b/code/modules/projectiles/guns/projectile.dm index 70f6ecd6dba..2160c6e15c0 100644 --- a/code/modules/projectiles/guns/projectile.dm +++ b/code/modules/projectiles/guns/projectile.dm @@ -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) diff --git a/code/modules/projectiles/guns/projectile/automatic.dm b/code/modules/projectiles/guns/projectile/automatic.dm index 991bd804c32..e3dd1760ebb 100644 --- a/code/modules/projectiles/guns/projectile/automatic.dm +++ b/code/modules/projectiles/guns/projectile/automatic.dm @@ -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), diff --git a/code/modules/projectiles/guns/projectile/rifle.dm b/code/modules/projectiles/guns/projectile/rifle.dm index 3808acf2c11..27596574c22 100644 --- a/code/modules/projectiles/guns/projectile/rifle.dm +++ b/code/modules/projectiles/guns/projectile/rifle.dm @@ -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, "You shorten the barrel and stock of the rifle!") @@ -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 diff --git a/html/changelogs/alberyk-fixbayonets.yml b/html/changelogs/alberyk-fixbayonets.yml new file mode 100644 index 00000000000..97466cf1434 --- /dev/null +++ b/html/changelogs/alberyk-fixbayonets.yml @@ -0,0 +1,5 @@ +author: Alberyk +delete-after: True + +changes: + - rscadd: "Added bayonets." diff --git a/icons/mob/back.dmi b/icons/mob/back.dmi index 346d2a35540..4f1b2b2b04a 100644 Binary files a/icons/mob/back.dmi and b/icons/mob/back.dmi differ diff --git a/icons/mob/items/lefthand_guns.dmi b/icons/mob/items/lefthand_guns.dmi index cb0a085381e..96db534162d 100644 Binary files a/icons/mob/items/lefthand_guns.dmi and b/icons/mob/items/lefthand_guns.dmi differ diff --git a/icons/mob/items/righthand_guns.dmi b/icons/mob/items/righthand_guns.dmi index 73bfc0dcd3f..bba6888f262 100644 Binary files a/icons/mob/items/righthand_guns.dmi and b/icons/mob/items/righthand_guns.dmi differ diff --git a/icons/mob/ties.dmi b/icons/mob/ties.dmi index 3408355e1ce..5706bd405b8 100644 Binary files a/icons/mob/ties.dmi and b/icons/mob/ties.dmi differ diff --git a/icons/obj/clothing/ties.dmi b/icons/obj/clothing/ties.dmi index c457293b6d5..c90ce8ba09e 100644 Binary files a/icons/obj/clothing/ties.dmi and b/icons/obj/clothing/ties.dmi differ diff --git a/icons/obj/gun.dmi b/icons/obj/gun.dmi index 11c4901c80b..7c95c73d798 100644 Binary files a/icons/obj/gun.dmi and b/icons/obj/gun.dmi differ diff --git a/icons/obj/weapons.dmi b/icons/obj/weapons.dmi index e5b4cbf8f8f..f690ac2c1e4 100644 Binary files a/icons/obj/weapons.dmi and b/icons/obj/weapons.dmi differ