diff --git a/code/modules/projectiles/guns/ballistic.dm b/code/modules/projectiles/guns/ballistic.dm index b26be27e857..8e40755dd77 100644 --- a/code/modules/projectiles/guns/ballistic.dm +++ b/code/modules/projectiles/guns/ballistic.dm @@ -36,14 +36,14 @@ //Four bolt types: //BOLT_TYPE_STANDARD: Gun has a bolt, it stays closed while not cycling. The gun must be racked to have a bullet chambered when a mag is inserted. //Example: c20, shotguns, m90 - //BOLT_TYPE_OPEN: Gun has a bolt, it is open when ready to fire. Largely the same as standard, except the gun can never have a chambered bullet with no magazine. + //BOLT_TYPE_OPEN: Gun has a bolt, it is open when ready to fire. The gun can never have a chambered bullet with no magazine, but the bolt stays ready when a mag is removed. //Example: Some SMGs, the L6 //BOLT_TYPE_NO_BOLT: Gun has no moving bolt mechanism, it cannot be racked. Also dumps the entire contents when emptied instead of a magazine. //Example: Break action shotguns, revolvers //BOLT_TYPE_LOCKING: Gun has a bolt, it locks back when empty. It can be released to chamber a round if a magazine is in. //Example: Pistols with a slide lock, some SMGs var/bolt_type = BOLT_TYPE_STANDARD - var/bolt_locked = FALSE + var/bolt_locked = FALSE //Used for locking bolt and open bolt guns. Set a bit differently for the two but prevents firing when true for both. var/bolt_wording = "bolt" //bolt, slide, etc. var/semi_auto = TRUE //Whether the gun has to be racked each shot or not. var/obj/item/ammo_box/magazine/magazine @@ -77,13 +77,15 @@ cut_overlays() if (bolt_type == BOLT_TYPE_LOCKING) add_overlay("[icon_state]_bolt[bolt_locked ? "_locked" : ""]") + if (bolt_type == BOLT_TYPE_OPEN && bolt_locked) + add_overlay("[icon_state]_bolt") if (suppressed) add_overlay("[icon_state]_suppressor") if(!chambered && empty_indicator) add_overlay("[icon_state]_empty") if (magazine) if (special_mags) - add_overlay("[icon_state]_mag_[magazine.icon_state]") + add_overlay("[icon_state]_mag_[initial(magazine.icon_state)]") if (!magazine.ammo_count()) add_overlay("[icon_state]_mag_empty") else @@ -129,10 +131,12 @@ /obj/item/gun/ballistic/proc/rack(mob/user = null) if (bolt_type == BOLT_TYPE_NO_BOLT) //If there's no bolt, nothing to rack return - if (bolt_type == BOLT_TYPE_OPEN && chambered != null) //If it's an open bolt, there's no way to rack it once it's open - if (user) - to_chat("It's already chambered!") - return + if (bolt_type == BOLT_TYPE_OPEN) + if(!bolt_locked) //If it's an open bolt, racking again would do nothing + if (user) + to_chat(user, "\The [src] is already ready to fire!") + return + bolt_locked = FALSE if (user) to_chat(user, "You rack the [bolt_wording] of \the [src].") process_chamber(!chambered, FALSE) @@ -157,6 +161,8 @@ if (display_message) to_chat(user, "You load a new [magazine_wording] into \the [src].") playsound(src, load_empty_sound, load_sound_volume, load_sound_vary) + if (bolt_type == BOLT_TYPE_OPEN && !bolt_locked) + chamber_round() update_icon() return TRUE else @@ -176,7 +182,7 @@ insert_magazine(user, tac_load, FALSE) to_chat(user, "You perform a tactical reload on \the [src].") user.put_in_hands(old_mag) - magazine.update_icon() + old_mag.update_icon() if (!tac_load) magazine = null if (display_message) @@ -258,10 +264,18 @@ update_icon() return -/obj/item/gun/ballistic/proc/empty_checks() +/obj/item/gun/ballistic/proc/prefire_empty_checks() + if (!chambered && !get_ammo()) + if (bolt_type == BOLT_TYPE_OPEN && !bolt_locked) + bolt_locked = TRUE + playsound(src, bolt_drop_sound, bolt_drop_sound_volume) + update_icon() + + +/obj/item/gun/ballistic/proc/postfire_empty_checks() if (!chambered && !get_ammo()) if (!alarmed && empty_alarm) - playsound(src.loc, empty_alarm_sound, empty_alarm_volume, empty_alarm_vary) + playsound(src, empty_alarm_sound, empty_alarm_volume, empty_alarm_vary) alarmed = TRUE update_icon() if (bolt_type == BOLT_TYPE_LOCKING) @@ -269,8 +283,9 @@ update_icon() /obj/item/gun/ballistic/afterattack() - empty_checks() - . = ..() + prefire_empty_checks() + . = ..() //The gun actually firing + postfire_empty_checks() //ATTACK HAND IGNORING PARENT RETURN VALUE /obj/item/gun/ballistic/attack_hand(mob/user) diff --git a/code/modules/projectiles/guns/ballistic/automatic.dm b/code/modules/projectiles/guns/ballistic/automatic.dm index 55631a003f7..48b3a567019 100644 --- a/code/modules/projectiles/guns/ballistic/automatic.dm +++ b/code/modules/projectiles/guns/ballistic/automatic.dm @@ -104,6 +104,7 @@ burst_size = 2 bolt_type = BOLT_TYPE_OPEN mag_display = TRUE + rack_sound = "sound/weapons/pistollock.ogg" /obj/item/gun/ballistic/automatic/m90 name = "\improper M-90gl Carbine" @@ -234,7 +235,7 @@ /obj/item/gun/ballistic/automatic/l6_saw/examine(mob/user) ..() - to_chat(user, "ctrl + click to [cover_open ? "close" : "open"] the dust cover.") + to_chat(user, "alt + click to [cover_open ? "close" : "open"] the dust cover.") if(cover_open && magazine) to_chat(user, "It seems like you could use an empty hand to remove the magazine.")