diff --git a/code/modules/projectiles/guns/projectile.dm b/code/modules/projectiles/guns/projectile.dm index a2dbcafaf26c6..2321283af05ce 100644 --- a/code/modules/projectiles/guns/projectile.dm +++ b/code/modules/projectiles/guns/projectile.dm @@ -21,6 +21,10 @@ var/list/loaded = list() //stored ammo var/starts_loaded = 1 //whether the gun starts loaded or not, can be overridden for guns crafted in-game var/load_sound = 'sound/weapons/guns/interaction/bullet_insert.ogg' + var/recentload = 0 // artificially limits how fast a gun can be loaded + + //For CYCLE_CASING guns + var/chamber_offset = 0 //how many empty chambers in the cylinder until you hit a round //For MAGAZINE guns var/magazine_type = null //the type of magazine that the gun comes preloaded with @@ -133,7 +137,25 @@ if(istype(A, /obj/item/ammo_magazine)) . = TRUE var/obj/item/ammo_magazine/AM = A - if(!(load_method & AM.mag_type) || ((istext(caliber) && caliber != AM.caliber) && (islist(caliber) && !is_type_in_list(AM.caliber, caliber)))) + if (((istext(caliber) && caliber != AM.caliber) || (islist(caliber) && !is_type_in_list(AM.caliber, caliber)))) + return //incompatible + else if (load_method == SINGLE_CASING && AM.mag_type == SPEEDLOADER && world.time >= recentload) + if (length(AM.stored_ammo)) + var/C = AM.stored_ammo[1] + if (length(loaded) >= max_shells) + to_chat(user, SPAN_WARNING("[src] is full!")) + return + if (!user.unEquip(C, src)) + return + loaded.Insert(1, C) //add to the head of the list + AM.stored_ammo -= C + user.visible_message("[user] inserts \a [C] into [src].", SPAN_NOTICE("You insert \a [C] into [src].")) + playsound(loc, load_sound, 50, 1) + recentload = world.time + 0.5 SECONDS + AM.update_icon() + update_icon() + return + else if (!(load_method & AM.mag_type)) return //incompatible switch(AM.mag_type) @@ -313,6 +335,8 @@ to_chat(user, "It has \a [ammo_magazine] loaded.") if(user.skill_check(SKILL_WEAPONS, SKILL_TRAINED)) to_chat(user, "Has [getAmmo()] round\s remaining.") + if (user.skill_check(SKILL_WEAPONS, SKILL_EXPERIENCED)) + to_chat(user, "[src.DrawChamber()]") /obj/item/gun/projectile/proc/getAmmo() var/bullets = 0 @@ -324,6 +348,26 @@ bullets += 1 return bullets +/obj/item/gun/projectile/proc/DrawChamber() + if (handle_casings == CYCLE_CASINGS) + var/chambers = list() + var/empty_chambers = 0 + while (chamber_offset > empty_chambers) + chambers += "🌣" + empty_chambers ++ + for (var/obj/item/ammo_casing/casing in loaded) + if (casing.BB) + chambers += "◉" + else + chambers += "◎" + while (max_shells > length(chambers)) + chambers += "🌣" + empty_chambers ++ + var/chamberlist = "" + for (var/chamber in chambers) + chamberlist += chamber + return chamberlist + /* Unneeded -- so far. //in case the weapon has firemodes and can't unload using attack_hand() /obj/item/gun/projectile/verb/unload_gun() diff --git a/code/modules/projectiles/guns/projectile/revolver.dm b/code/modules/projectiles/guns/projectile/revolver.dm index 5478d9c9ec582..ae258f68a84b6 100644 --- a/code/modules/projectiles/guns/projectile/revolver.dm +++ b/code/modules/projectiles/guns/projectile/revolver.dm @@ -10,7 +10,6 @@ max_shells = 6 fire_delay = 12 //Revolvers are naturally slower-firing ammo_type = /obj/item/ammo_casing/pistol/magnum - var/chamber_offset = 0 //how many empty chambers in the cylinder until you hit a round mag_insert_sound = 'sound/weapons/guns/interaction/rev_magin.ogg' mag_remove_sound = 'sound/weapons/guns/interaction/rev_magout.ogg' accuracy = 2 diff --git a/code/modules/projectiles/guns/projectile/shotgun.dm b/code/modules/projectiles/guns/projectile/shotgun.dm index cadc5eb993b14..e248e1c1bf88f 100644 --- a/code/modules/projectiles/guns/projectile/shotgun.dm +++ b/code/modules/projectiles/guns/projectile/shotgun.dm @@ -128,12 +128,31 @@ return ..() +/obj/item/gun/projectile/shotgun/pump/DrawChamber() + var/chamberlist = "" + if (chambered) + if (chambered.BB) + chamberlist += "◉|" + else + chamberlist += "◎|" + else + chamberlist += "🌣|" + if (length(loaded) > 0) + var/obj/item/ammo_casing/casinglist = loaded + if (casinglist[1].BB) + chamberlist += "◉" + else + chamberlist += "◎" + else + chamberlist += "🌣" + return chamberlist + /obj/item/gun/projectile/shotgun/pump/empty starts_loaded = FALSE /obj/item/gun/projectile/shotgun/pump/sawn name = "riot shotgun" - desc = "A mass-produced shotgun by Mars Security Industries. The rugged ZX-870 'Bulldog' is common throughout most frontier worlds. This one has had it's stock cut off..." + desc = "A mass-produced shotgun by Mars Security Industries. The rugged ZX-870 'Bulldog' is common throughout most frontier worlds. This one has had its stock cut off..." icon = 'icons/obj/guns/shotguns.dmi' icon_state = "rshotgun" item_state = "rshotgun" diff --git a/code/modules/projectiles/guns/projectile/sniper.dm b/code/modules/projectiles/guns/projectile/sniper.dm index 3e90b7f30af30..9790f9dce90f3 100644 --- a/code/modules/projectiles/guns/projectile/sniper.dm +++ b/code/modules/projectiles/guns/projectile/sniper.dm @@ -56,6 +56,10 @@ to_chat(user, SPAN_NOTICE("You work the bolt open.")) else to_chat(user, SPAN_NOTICE("You work the bolt closed.")) + if (length(loaded)) + chambered = loaded[1] + else + chambered = null playsound(src.loc, 'sound/weapons/guns/interaction/rifle_boltforward.ogg', 50, 1) bolt_open = 0 add_fingerprint(user) @@ -77,6 +81,22 @@ return ..() +/obj/item/gun/projectile/heavysniper/getAmmo() + var/bullets = 0 + if (loaded) + bullets += length(loaded) + if (ammo_magazine && ammo_magazine.stored_ammo) + bullets += length(ammo_magazine.stored_ammo) + return bullets + +/obj/item/gun/projectile/heavysniper/DrawChamber() + if (chambered) + if (chambered.BB) + return "◉" + else + return "◎" + else + return "🌣" /obj/item/gun/projectile/heavysniper/boltaction name = "bolt action rifle" diff --git a/code/modules/projectiles/projectile/bullets.dm b/code/modules/projectiles/projectile/bullets.dm index 11fd9e687f849..afe2c3e6d3915 100644 --- a/code/modules/projectiles/projectile/bullets.dm +++ b/code/modules/projectiles/projectile/bullets.dm @@ -209,13 +209,12 @@ damage = 45 armor_penetration = 25 penetrating = 1 - distance_falloff = 1.5 + distance_falloff = 1 /obj/item/projectile/bullet/rifle/military fire_sound = 'sound/weapons/gunshot/gunshot2.ogg' damage = 40 armor_penetration = 35 - distance_falloff = 1 /obj/item/projectile/bullet/rifle/shell fire_sound = 'sound/weapons/gunshot/sniper.ogg'