diff --git a/code/__HELPERS/maths.dm b/code/__HELPERS/maths.dm index b174147d583..6be724fbd99 100644 --- a/code/__HELPERS/maths.dm +++ b/code/__HELPERS/maths.dm @@ -111,4 +111,30 @@ var/const/Sqrt2 = 1.41421356 /proc/Wrap(val, min, max) var/d = max - min var/t = Floor((val - min) / d) - return val - (t * d) \ No newline at end of file + return val - (t * d) + +//converts a uniform distributed random number into a normal distributed one +//since this method produces two random numbers, one is saved for subsequent calls +//(making the cost negligble for every second call) +//This will return +/- decimals, situated about mean with standard deviation stddev +//68% chance that the number is within 1stddev +//95% chance that the number is within 2stddev +//98% chance that the number is within 3stddev...etc +var/gaussian_next +#define ACCURACY 10000 +/proc/gaussian(mean, stddev) + var/R1;var/R2;var/working + if(gaussian_next != null) + R1 = gaussian_next + gaussian_next = null + else + do + R1 = rand(-ACCURACY,ACCURACY)/ACCURACY + R2 = rand(-ACCURACY,ACCURACY)/ACCURACY + working = R1*R1 + R2*R2 + while(working >= 1 || working==0) + working = sqrt(-2 * log(working) / working) + R1 *= working + gaussian_next = R2 * working + return (mean + stddev * R1) +#undef ACCURACY \ No newline at end of file diff --git a/code/game/mecha/equipment/weapons/weapons.dm b/code/game/mecha/equipment/weapons/weapons.dm index 120eb234870..69adf858b14 100644 --- a/code/game/mecha/equipment/weapons/weapons.dm +++ b/code/game/mecha/equipment/weapons/weapons.dm @@ -197,7 +197,7 @@ name = "LBX AC 10 \"Scattershot\"" icon_state = "mecha_scatter" equip_cooldown = 20 - projectile = /obj/item/projectile/bullet/midbullet + projectile = /obj/item/projectile/bullet/midbullet10 fire_sound = 'sound/weapons/Gunshot.ogg' projectiles = 40 projectile_energy_cost = 25 diff --git a/code/modules/admin/verbs/striketeam_syndicate.dm b/code/modules/admin/verbs/striketeam_syndicate.dm index e71fe284608..5cff60f1e93 100644 --- a/code/modules/admin/verbs/striketeam_syndicate.dm +++ b/code/modules/admin/verbs/striketeam_syndicate.dm @@ -162,7 +162,7 @@ var/global/sent_syndicate_strike_team = 0 equip_to_slot_or_del(new /obj/item/weapon/melee/energy/sword(src), slot_l_store) equip_to_slot_or_del(new /obj/item/weapon/grenade/empgrenade(src), slot_r_store) equip_to_slot_or_del(new /obj/item/weapon/tank/emergency_oxygen(src), slot_s_store) - equip_to_slot_or_del(new /obj/item/weapon/gun/projectile/automatic/silenced(src), slot_belt) + equip_to_slot_or_del(new /obj/item/weapon/gun/projectile/automatic/m2411(src), slot_belt) equip_to_slot_or_del(new /obj/item/weapon/gun/energy/pulse_rifle(src), slot_r_hand) //Will change to something different at a later time -- Superxpdude diff --git a/code/modules/mob/living/simple_animal/hostile/syndicate.dm b/code/modules/mob/living/simple_animal/hostile/syndicate.dm index 520c5016f09..aa62cfa6a30 100644 --- a/code/modules/mob/living/simple_animal/hostile/syndicate.dm +++ b/code/modules/mob/living/simple_animal/hostile/syndicate.dm @@ -108,7 +108,7 @@ icon_living = "syndicateranged" casingtype = /obj/item/ammo_casing/a12mm projectilesound = 'sound/weapons/Gunshot_smg.ogg' - projectiletype = /obj/item/projectile/bullet/midbullet2 + projectiletype = /obj/item/projectile/bullet/midbullet12 weapon1 = /obj/item/weapon/gun/projectile/automatic/c20r diff --git a/code/modules/projectiles/ammunition.dm b/code/modules/projectiles/ammunition.dm index 8d08a7abab1..eddf50c510d 100644 --- a/code/modules/projectiles/ammunition.dm +++ b/code/modules/projectiles/ammunition.dm @@ -10,6 +10,9 @@ var/caliber = "" //Which kind of guns it can be loaded into var/projectile_type = ""//The bullet type to create when New() is called var/obj/item/projectile/BB = null //The loaded bullet + var/buck = 0 + var/deviation = 0 + /obj/item/ammo_casing/New() ..() @@ -30,8 +33,8 @@ //Boxes of ammo /obj/item/ammo_box - name = "ammo box (.357)" - desc = "A box of ammo" + name = "ammo box (generic)" + desc = "A box of ammo?" icon_state = "357" icon = 'icons/obj/ammo.dmi' flags = FPRINT | TABLEPASS | CONDUCT @@ -43,11 +46,11 @@ throw_speed = 4 throw_range = 10 var/list/stored_ammo = list() - var/ammo_type = "/obj/item/ammo_casing" + var/obj/item/ammo_casing/ammo_type var/max_ammo = 7 var/multiple_sprites = 0 var/caliber = "" - + var/multiload = 1 /obj/item/ammo_box/New() for(var/i = 1, i <= max_ammo, i++) stored_ammo += new ammo_type(src) @@ -77,10 +80,11 @@ if(istype(A, /obj/item/ammo_box)) var/obj/item/ammo_box/AM = A for(var/obj/item/ammo_casing/AC in AM.stored_ammo) - if(give_round(AC)) + var/didload = give_round(AC) + if(didload) AM.stored_ammo -= AC num_loaded++ - else + if(!multiload || !didload) break if(istype(A, /obj/item/ammo_casing)) var/obj/item/ammo_casing/AC = A diff --git a/code/modules/projectiles/ammunition/boxes.dm b/code/modules/projectiles/ammunition/boxes.dm index 89ac19ed71b..f10cb786e25 100644 --- a/code/modules/projectiles/ammunition/boxes.dm +++ b/code/modules/projectiles/ammunition/boxes.dm @@ -37,7 +37,7 @@ icon_state = "9mm" origin_tech = "combat=2" ammo_type = "/obj/item/ammo_casing/c9mm" - max_ammo = 30 + max_ammo = 36 @@ -46,7 +46,7 @@ icon_state = "9mm" origin_tech = "combat=2" ammo_type = "/obj/item/ammo_casing/c45" - max_ammo = 30 + max_ammo = 32 @@ -55,4 +55,26 @@ icon_state = "9mm" origin_tech = "combat=2" ammo_type = "/obj/item/ammo_casing/a12mm" - max_ammo = 30 + max_ammo = 40 + +/obj/item/ammo_box/shotgun + name = "Ammunition Box (slug)" + icon_state = "9mm" + origin_tech = "combat=2" + ammo_type = /obj/item/ammo_casing/shotgun + max_ammo = 8 + m_amt = 100000 + +/obj/item/ammo_box/shotgun/buck + name = "Ammunition Box (buckshot)" + ammo_type = /obj/item/ammo_casing/shotgun/buck + +/obj/item/ammo_box/shotgun/stun + name = "Ammunition Box (stun shells)" + ammo_type = /obj/item/ammo_casing/shotgun/stunshell + m_amt = 20000 + +/obj/item/ammo_box/shotgun/beanbag + name = "Ammunition Box (beanbag shells)" + ammo_type = /obj/item/ammo_casing/shotgun/beanbag + m_amt = 4000 \ No newline at end of file diff --git a/code/modules/projectiles/ammunition/bullets.dm b/code/modules/projectiles/ammunition/bullets.dm index 87083bf1920..61ea69a79ad 100644 --- a/code/modules/projectiles/ammunition/bullets.dm +++ b/code/modules/projectiles/ammunition/bullets.dm @@ -29,45 +29,54 @@ /obj/item/ammo_casing/c38 desc = "A .38 bullet casing." caliber = "38" - projectile_type = "/obj/item/projectile/bullet/weakbullet" + projectile_type = "/obj/item/projectile/bullet/rubberbullet" /obj/item/ammo_casing/c9mm desc = "A 9mm bullet casing." caliber = "9mm" - projectile_type = "/obj/item/projectile/bullet/midbullet2" + projectile_type = "/obj/item/projectile/bullet/midbullet9" /obj/item/ammo_casing/c45 desc = "A .45 bullet casing." caliber = ".45" - projectile_type = "/obj/item/projectile/bullet/midbullet" + projectile_type = "/obj/item/projectile/bullet/midbullet45" /obj/item/ammo_casing/c10mm desc = "A 10mm bullet casing." caliber = "10mm" - projectile_type = "obj/item/projectile/bullet/midbullet2" + projectile_type = "obj/item/projectile/bullet/midbullet10" /obj/item/ammo_casing/a12mm desc = "A 12mm bullet casing." caliber = "12mm" - projectile_type = "/obj/item/projectile/bullet/midbullet2" + projectile_type = "/obj/item/projectile/bullet/midbullet12" /obj/item/ammo_casing/shotgun name = "shotgun shell" desc = "A 12 gauge shell." - icon_state = "gshell" + icon_state = "slshell" caliber = "shotgun" - projectile_type = "/obj/item/projectile/bullet" + projectile_type = "/obj/item/projectile/bullet/slug" m_amt = 12500 +/obj/item/ammo_casing/shotgun/buck + name = "buckshot shell" + desc = "A 12 gauge buckshot shell." + icon_state = "gshell" + projectile_type = /obj/item/projectile/bullet/buck + buck = 4 + deviation = 1 /obj/item/ammo_casing/shotgun/birdshot - name = "shotgun shell" + name = "birdshot shell" desc = "A shotgun shell full of birdshot." icon_state = "blshell" - projectile_type = "/obj/item/projectile/bullet/midbullet" + projectile_type = "/obj/item/projectile/bullet/rubberbullet" + buck = 4 + deviation = 1 m_amt = 6000 @@ -75,14 +84,14 @@ name = "beanbag shell" desc = "A weak beanbag shell." icon_state = "bshell" - projectile_type = "/obj/item/projectile/bullet/weakbullet" + projectile_type = "/obj/item/projectile/bullet/rubberbullet" m_amt = 500 /obj/item/ammo_casing/shotgun/fakebeanbag name = "beanbag shell" desc = "A weak beanbag shell." icon_state = "bshell" - projectile_type = "/obj/item/projectile/bullet/weakbullet/booze" + projectile_type = "/obj/item/projectile/bullet/rubberbullet/booze" m_amt = 12500 /obj/item/ammo_casing/shotgun/stunshell diff --git a/code/modules/projectiles/ammunition/magazines.dm b/code/modules/projectiles/ammunition/magazines.dm index 919c48b0bda..728cf66a00f 100644 --- a/code/modules/projectiles/ammunition/magazines.dm +++ b/code/modules/projectiles/ammunition/magazines.dm @@ -6,6 +6,7 @@ caliber = "357" max_ammo = 7 + /obj/item/ammo_box/magazine/internal/cylinder/ammo_count(var/countempties = 1) if (!countempties) var/boolets = 0 @@ -23,7 +24,7 @@ ammo_type = "/obj/item/ammo_casing/a357" caliber = "357" max_ammo = 6 - + multiload = 0 /obj/item/ammo_box/magazine/internal/cylinder/rus357/New() stored_ammo += new ammo_type(src) @@ -40,21 +41,21 @@ ammo_type = "/obj/item/ammo_casing/shotgun/beanbag" caliber = "shotgun" max_ammo = 4 - + multiload = 0 /obj/item/ammo_box/magazine/internal/shotcom name = "combat shotgun internal magazine" desc = "Oh god, this shouldn't be here" - ammo_type = "/obj/item/ammo_casing/shotgun" + ammo_type = "/obj/item/ammo_casing/shotgun/buck" caliber = "shotgun" max_ammo = 8 - + multiload = 0 /obj/item/ammo_box/magazine/internal/cylinder/dualshot name = "double-barrel shotgun internal magazine" desc = "This doesn't even exist" ammo_type = "/obj/item/ammo_casing/shotgun/beanbag" caliber = "shotgun" max_ammo = 2 - + multiload = 0 ///////////EXTERNAL MAGAZINES//////////////// /obj/item/ammo_box/magazine/m9mm name = "magazine (9mm)" @@ -97,16 +98,13 @@ ..() icon_state = "[initial(icon_state)]-[round(ammo_count(),2)]" -/obj/item/ammo_box/magazine/sm45 +/obj/item/ammo_box/magazine/m45 name = "magazine (.45)" - icon_state = "9x19p" + icon_state = "45" ammo_type = "/obj/item/ammo_casing/c45" caliber = ".45" - max_ammo = 12 - -/obj/item/ammo_box/magazine/sm45/update_icon() - ..() - icon_state = "[initial(icon_state)]-[ammo_count() ? "8" : "0"]" + max_ammo = 8 + multiple_sprites = 1 /obj/item/ammo_box/magazine/uzim45 name = "Uzi magazine (.45)" diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index 75f0388981c..7df0bfee5a0 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -20,6 +20,7 @@ var/silenced = 0 var/recoil = 0 var/clumsy_check = 1 + var/obj/item/ammo_casing/chambered = null // The round (not bullet) that is in the chamber. THIS MISPLACED ITEM BROUGHT TO YOU BY HACKY BUCKSHOT. var/tmp/list/mob/living/target //List of who yer targeting. var/tmp/lock_time = -100 var/tmp/mouthshoot = 0 ///To stop people from suiciding twice... >.> @@ -48,6 +49,11 @@ for(var/obj/O in contents) O.emp_act(severity) + proc/prepare_shot(var/obj/item/projectile/proj) //Transfer properties from the gun to the bullet + proj.shot_from = src + proj.silenced = silenced + return + /obj/item/weapon/gun/afterattack(atom/A as mob|obj|turf|area, mob/living/user as mob|obj, flag, params) if(flag) return //we're placing gun on a table or in backpack if(istype(target, /obj/machinery/recharger) && istype(src, /obj/item/weapon/gun/energy)) return//Shouldnt flag take care of this? @@ -125,6 +131,12 @@ "You fire [src][reflex ? "by reflex":""]!", \ "You hear a [istype(in_chamber, /obj/item/projectile/beam) ? "laser blast" : "gunshot"]!") + if (istype(in_chamber, /obj/item/projectile/bullet/blank)) // A hacky way of making blank shotgun shells work again. Honk. + in_chamber.delete() + in_chamber = null + return + + in_chamber.original = target in_chamber.loc = get_turf(user) in_chamber.starting = get_turf(user) @@ -144,6 +156,31 @@ in_chamber.xo += rand(-1,1) + if(chambered) // Beep boop buckshot + var/target_x = targloc.x + var/target_y = targloc.y + var/target_z = targloc.z + if(in_chamber) + in_chamber.process() + while(chambered.buck > 0) + var/dx = round(gaussian(0,chambered.deviation),1) + var/dy = round(gaussian(0,chambered.deviation),1) + targloc = locate(target_x+dx, target_y+dy, target_z) + if(!targloc || targloc == curloc) + break + in_chamber = new chambered.projectile_type() + prepare_shot(in_chamber) + in_chamber.original = target + in_chamber.loc = get_turf(user) + in_chamber.starting = get_turf(user) + in_chamber.current = curloc + in_chamber.yo = targloc.y - curloc.y + in_chamber.xo = targloc.x - curloc.x + if(in_chamber) + in_chamber.process() + chambered.buck-- + + if(params) var/list/mouse_control = params2list(params) if(mouse_control["icon-x"]) diff --git a/code/modules/projectiles/guns/projectile.dm b/code/modules/projectiles/guns/projectile.dm index bf0f08676c6..e0ae69404bd 100644 --- a/code/modules/projectiles/guns/projectile.dm +++ b/code/modules/projectiles/guns/projectile.dm @@ -10,10 +10,9 @@ w_class = 3.0 m_amt = 1000 recoil = 1 - var/ammo_type = "/obj/item/ammo_casing/c10mm" var/mag_type = "/obj/item/ammo_box/magazine/m10mm" //Removes the need for max_ammo and caliber info var/obj/item/ammo_box/magazine/magazine - var/obj/item/ammo_casing/chambered = null // The round (not bullet) that is in the chamber. +// var/obj/item/ammo_casing/chambered = null // The round (not bullet) that is in the chamber. @@ -59,7 +58,7 @@ user.remove_from_mob(AM) magazine = AM magazine.loc = src - user << "You load a new magazine into \the [src]!" + user << "You load a new magazine into \the [src]." chamber_round() A.update_icon() update_icon() diff --git a/code/modules/projectiles/guns/projectile/automatic.dm b/code/modules/projectiles/guns/projectile/automatic.dm index 1d3e576584e..442fbf6625d 100644 --- a/code/modules/projectiles/guns/projectile/automatic.dm +++ b/code/modules/projectiles/guns/projectile/automatic.dm @@ -4,7 +4,6 @@ icon_state = "saber" //ugly w_class = 3.0 origin_tech = "combat=4;materials=2" - ammo_type = "/obj/item/ammo_casing/c9mm" automatic = 1 mag_type = "/obj/item/ammo_box/magazine/msmg9mm" var/alarmed = 0 @@ -30,7 +29,6 @@ w_class = 3.0 origin_tech = "combat=5;materials=2;syndicate=8" - ammo_type = "/obj/item/ammo_casing/c45" mag_type = "/obj/item/ammo_box/magazine/uzim45" isHandgun() @@ -44,20 +42,13 @@ item_state = "c20r" w_class = 3.0 origin_tech = "combat=5;materials=2;syndicate=8" - ammo_type = "/obj/item/ammo_casing/a12mm" mag_type = "/obj/item/ammo_box/magazine/m12mm" fire_sound = 'sound/weapons/Gunshot_smg.ogg' -/obj/item/weapon/gun/projectile/automatic/c20r/New() - ..() - update_icon() - return - /obj/item/weapon/gun/projectile/automatic/c20r/afterattack(atom/target as mob|obj|turf|area, mob/living/user as mob|obj, flag) ..() if(!chambered && !get_ammo() && !alarmed) playsound(user, 'sound/weapons/smg_empty_alarm.ogg', 40, 1) - update_icon() alarmed = 1 return @@ -69,13 +60,12 @@ /obj/item/weapon/gun/projectile/automatic/l6_saw name = "\improper L6 SAW" - desc = "A rather traditionally made light machine gun with a pleasantly lacquered wooden pistol grip. Has 'Aussec Armoury- 2531' engraved on the reciever" + desc = "A rather traditionally made medium machine gun with a pleasantly lacquered wooden pistol grip. Has 'Aussec Armoury- 2531' engraved on the reciever" icon_state = "l6closed100" item_state = "l6closedmag" w_class = 4 slot_flags = 0 origin_tech = "combat=5;materials=1;syndicate=2" - ammo_type = "/obj/item/ammo_casing/a762" mag_type = "/obj/item/ammo_box/magazine/m762" fire_sound = 'sound/weapons/Gunshot_smg.ogg' @@ -118,7 +108,7 @@ /obj/item/weapon/gun/projectile/automatic/l6_saw/attackby(var/obj/item/A as obj, mob/user as mob) - if(!cover_open) + if(!cover_open && istype(A, mag_type)) user << "[src]'s cover is closed! You can't insert a new mag!" return ..() diff --git a/code/modules/projectiles/guns/projectile/pistol.dm b/code/modules/projectiles/guns/projectile/pistol.dm index b6100ebe84c..7b2825214ae 100644 --- a/code/modules/projectiles/guns/projectile/pistol.dm +++ b/code/modules/projectiles/guns/projectile/pistol.dm @@ -1,16 +1,15 @@ -/obj/item/weapon/gun/projectile/automatic/silenced - name = "silenced pistol" - desc = "A small, quiet, easily concealable gun. Uses .45 rounds." - icon_state = "silenced_pistol" +/obj/item/weapon/gun/projectile/automatic/m2411 + name = "M2411" + desc = "John Browning's classic updated for the modern day. Uses .45 rounds. Has 'VADS' engraved on the grip." + icon_state = "m2411" w_class = 3.0 - silenced = 1 - origin_tech = "combat=2;materials=2;syndicate=8" - ammo_type = "/obj/item/ammo_casing/c45" - mag_type = "/obj/item/ammo_box/magazine/sm45" + origin_tech = "combat=3;materials=2" + mag_type = /obj/item/ammo_box/magazine/m45 -/obj/item/weapon/gun/projectile/automatic/silenced/update_icon() + +/obj/item/weapon/gun/projectile/automatic/m2411/update_icon() ..() - icon_state = "[initial(icon_state)]" + icon_state = "[initial(icon_state)][chambered ? "" : "-e"]" return @@ -20,7 +19,6 @@ desc = "A robust handgun that uses .50 AE ammo" icon_state = "deagle" force = 14.0 - ammo_type = "/obj/item/ammo_casing/a50" mag_type = "/obj/item/ammo_box/magazine/m50" /obj/item/weapon/gun/projectile/automatic/deagle/afterattack(atom/target as mob|obj|turf|area, mob/living/user as mob|obj, flag) @@ -55,7 +53,6 @@ icon_state = "gyropistol" fire_sound = 'sound/effects/Explosion1.ogg' origin_tech = "combat=3" - ammo_type = "/obj/item/ammo_casing/a75" mag_type = "/obj/item/ammo_box/magazine/m75" /obj/item/weapon/gun/projectile/automatic/gyropistol/New() @@ -83,18 +80,8 @@ w_class = 2 silenced = 0 origin_tech = "combat=2;materials=2;syndicate=2" - ammo_type = "/obj/item/ammo_casing/c9mm" mag_type = "/obj/item/ammo_box/magazine/m10mm" -/obj/item/weapon/gun/projectile/automatic/pistol/afterattack(atom/target as mob|obj|turf|area, mob/living/user as mob|obj, flag) - ..() - if(magazine) - if(!chambered && !magazine.ammo_count()) - magazine.update_icon() - magazine.loc = get_turf(src.loc) - magazine = null - return - /obj/item/weapon/gun/projectile/automatic/pistol/attack_hand(mob/user as mob) if(loc == user) if(silenced) diff --git a/code/modules/projectiles/guns/projectile/revolver.dm b/code/modules/projectiles/guns/projectile/revolver.dm index 5a9d9d8f7b8..aaa60b2f024 100644 --- a/code/modules/projectiles/guns/projectile/revolver.dm +++ b/code/modules/projectiles/guns/projectile/revolver.dm @@ -2,7 +2,6 @@ desc = "A classic revolver. Uses 357 ammo" name = "revolver" icon_state = "revolver" - ammo_type = "/obj/item/ammo_casing/a357" mag_type = "/obj/item/ammo_box/magazine/internal/cylinder" /obj/item/weapon/gun/projectile/revolver/chamber_round() @@ -31,10 +30,11 @@ if(istype(A, /obj/item/ammo_box)) var/obj/item/ammo_box/AM = A for(var/obj/item/ammo_casing/AC in AM.stored_ammo) - if(magazine.give_round(AC)) + var/didload = magazine.give_round(AC) + if(didload) AM.stored_ammo -= AC num_loaded++ - else + if(!didload || !magazine.multiload) break if(istype(A, /obj/item/ammo_casing)) var/obj/item/ammo_casing/AC = A @@ -79,7 +79,6 @@ name = "revolver" icon_state = "detective" origin_tech = "combat=2;materials=2" - ammo_type = "/obj/item/ammo_casing/c38" mag_type = "/obj/item/ammo_box/magazine/internal/cylinder/rev38" @@ -87,7 +86,7 @@ if(magazine.caliber == initial(magazine.caliber)) return 1 if(prob(70 - (magazine.ammo_count() * 10))) //minimum probability of 10, maximum of 60 - M << "[src] blows up in your face." + M << "[src] blows up in your face!" M.take_organ_damage(0,20) M.drop_item() del(src) @@ -140,7 +139,7 @@ user << "You can't modify it!" return magazine.caliber = "357" - desc = "The barrel and chamber assembly seems to have been modified." + desc = "[initial(desc)] The barrel and chamber assembly seems to have been modified." user << "You reinforce the barrel of [src]! Now it will fire .357 rounds." else user << "You begin to revert the modifications to [src]." @@ -170,7 +169,7 @@ /obj/item/weapon/gun/projectile/revolver/russian name = "Russian Revolver" - desc = "A Russian made revolver. Uses .357 ammo. It has a single slot in it's chamber for a bullet." + desc = "A Russian made revolver. Uses .357 ammo." origin_tech = "combat=2;materials=2" mag_type = "/obj/item/ammo_box/magazine/internal/cylinder/rus357" var/spun = 0 @@ -188,26 +187,8 @@ spun = 1 /obj/item/weapon/gun/projectile/revolver/russian/attackby(var/obj/item/A as obj, mob/user as mob) - var/num_loaded = 0 - if(istype(A, /obj/item/ammo_box)) - var/obj/item/ammo_box/AM = A - for(var/obj/item/ammo_casing/AC in AM.stored_ammo) - if(get_ammo() <= 1) - if(magazine.give_round(AC)) - AM.stored_ammo -= AC - num_loaded++ - break - if(istype(A, /obj/item/ammo_casing)) - var/obj/item/ammo_casing/AC = A - if(get_ammo() <= 1) - magazine.give_round(AC) - user.drop_item() - AC.loc = src - num_loaded++ - if(num_loaded) - user.visible_message("[user] loads a single bullet into the revolver and spins the chamber.", "You load a single bullet into the chamber and spin it.") - else - user.visible_message("[user] spins the chamber of the revolver.", "You spin the revolver's chamber.") + ..() + user.visible_message("[user] spins the chamber of the revolver.", "You spin the revolver's chamber.") if(get_ammo() > 0) Spin() update_icon() @@ -219,26 +200,19 @@ user.visible_message("[user] spins the chamber of the revolver.", "You spin the revolver's chamber.") Spin() else - var/num_unloaded = 0 - while (get_ammo() > 0) - var/obj/item/ammo_casing/CB - CB = magazine.get_round() - chambered = null - CB.loc = get_turf(src.loc) - CB.update_icon() - num_unloaded++ - if (num_unloaded) - user << "You unload [num_unloaded] shell\s from [src]!" - else - user << "[src] is empty." + ..() + /obj/item/weapon/gun/projectile/revolver/russian/afterattack(atom/target as mob|obj|turf, mob/living/user as mob|obj, flag, params) + if (!spun) + Spin() + return ..() spun = 0 /obj/item/weapon/gun/projectile/revolver/russian/attack(atom/target as mob|obj|turf|area, mob/living/user as mob|obj) - if(!chambered) + if(!chambered && target == user) user.visible_message("\red *click*", "\red *click*") return diff --git a/code/modules/projectiles/guns/projectile/shotgun.dm b/code/modules/projectiles/guns/projectile/shotgun.dm index b457657d013..54c7583d68a 100644 --- a/code/modules/projectiles/guns/projectile/shotgun.dm +++ b/code/modules/projectiles/guns/projectile/shotgun.dm @@ -8,7 +8,6 @@ flags = FPRINT | TABLEPASS | CONDUCT slot_flags = SLOT_BACK origin_tech = "combat=4;materials=2" - ammo_type = /obj/item/ammo_casing/shotgun/beanbag var/recentpump = 0 // to prevent spammage var/pumped = 0 @@ -18,10 +17,11 @@ if(istype(A, /obj/item/ammo_box)) var/obj/item/ammo_box/AM = A for(var/obj/item/ammo_casing/AC in AM.stored_ammo) - if(magazine && magazine.give_round(AC)) + var/didload = magazine.give_round(AC) + if(didload) AM.stored_ammo -= AC num_loaded++ - else + if(!didload || !magazine.multiload) break if(istype(A, /obj/item/ammo_casing)) var/obj/item/ammo_casing/AC = A @@ -84,7 +84,6 @@ name = "combat shotgun" icon_state = "cshotgun" origin_tech = "combat=5;materials=2" - ammo_type = "/obj/item/ammo_casing/shotgun" mag_type = "/obj/item/ammo_box/magazine/internal/shotcom" w_class = 5 @@ -98,20 +97,17 @@ flags = FPRINT | TABLEPASS | CONDUCT slot_flags = SLOT_BACK origin_tech = "combat=3;materials=1" - ammo_type = "/obj/item/ammo_casing/shotgun/beanbag" mag_type = "/obj/item/ammo_box/magazine/internal/cylinder/dualshot" /obj/item/weapon/gun/projectile/revolver/doublebarrel/attackby(var/obj/item/A as obj, mob/user as mob) ..() - if (istype(A,/obj/item/ammo_box) || istype(A,/obj/item/ammo_casing)) - chamber_round() if(istype(A, /obj/item/weapon/circular_saw) || istype(A, /obj/item/weapon/melee/energy) || istype(A, /obj/item/weapon/pickaxe/plasmacutter)) user << "You begin to shorten the barrel of \the [src]." if(get_ammo()) afterattack(user, user) //will this work? afterattack(user, user) //it will. we call it twice, for twice the FUN playsound(user, fire_sound, 50, 1) - user.visible_message("The shotgun goes off!", "The shotgun goes off in your face!") + user.visible_message("\The [src] goes off!", "\The [src] goes off in your face!") return if(do_after(user, 30)) //SHIT IS STEALTHY EYYYYY icon_state = "sawnshotgun" @@ -124,15 +120,5 @@ desc = "Omar's coming!" /obj/item/weapon/gun/projectile/revolver/doublebarrel/attack_self(mob/living/user as mob) - var/num_unloaded = 0 - while (get_ammo() > 0) - var/obj/item/ammo_casing/CB - CB = magazine.get_round(0) - chambered = null - CB.loc = get_turf(src.loc) - CB.update_icon() - num_unloaded++ - if (num_unloaded) - user << "You break open \the [src] and unload [num_unloaded] shell\s." - else - user << "[src] is empty." \ No newline at end of file + user << "You break open \the [src]." + ..() \ No newline at end of file diff --git a/code/modules/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm index dada9ac9491..bea343a6d7e 100644 --- a/code/modules/projectiles/projectile.dm +++ b/code/modules/projectiles/projectile.dm @@ -51,6 +51,10 @@ var/agony = 0 var/embed = 0 // whether or not the projectile can embed itself in the mob + proc/delete() + // Garbage collect the projectiles + loc = null + proc/on_hit(var/atom/target, var/blocked = 0) if(blocked >= 2) return 0//Full block if(!isliving(target)) return 0 diff --git a/code/modules/projectiles/projectile/bullets.dm b/code/modules/projectiles/projectile/bullets.dm index 25316e55f24..138e2bb6ced 100644 --- a/code/modules/projectiles/projectile/bullets.dm +++ b/code/modules/projectiles/projectile/bullets.dm @@ -14,7 +14,11 @@ return 1 return 0 -/obj/item/projectile/bullet/weakbullet +/obj/item/projectile/bullet/slug + name = "slug" + + +/obj/item/projectile/bullet/rubberbullet damage = 10 stun = 5 weaken = 5 @@ -40,15 +44,31 @@ A.volume += 5 //Because we can -/obj/item/projectile/bullet/midbullet +/obj/item/projectile/bullet/midbullet12 damage = 20 stun = 5 weaken = 5 embed = 0 -/obj/item/projectile/bullet/midbullet2 +/obj/item/projectile/bullet/midbullet9 damage = 25 +/obj/item/projectile/bullet/midbullet45 + damage = 25 + stun = 1 + weaken = 1 + +/obj/item/projectile/bullet/midbullet10 //Only used with the Stechkin Pistol - RobRichards + damage = 30 + +/obj/item/projectile/bullet/buck + name = "pellet" + damage = 15 + +/obj/item/projectile/bullet/blank + name = "blankshot" + nodamage = 1 + /obj/item/projectile/bullet/suffocationbullet//How does this even work? name = "co bullet" damage = 20 diff --git a/icons/obj/ammo.dmi b/icons/obj/ammo.dmi index e54f9327b81..b5ece3cd4e1 100644 Binary files a/icons/obj/ammo.dmi and b/icons/obj/ammo.dmi differ diff --git a/icons/obj/gun.dmi b/icons/obj/gun.dmi index 540f7be103b..27f0895247c 100644 Binary files a/icons/obj/gun.dmi and b/icons/obj/gun.dmi differ