Makes unloading ballistic weapons better (Namely revolvers)

This commit is contained in:
madmanmartian
2019-02-18 14:15:54 +00:00
parent f088f3100b
commit b4f373a492
3 changed files with 29 additions and 8 deletions

View File

@@ -98,7 +98,6 @@
playsound(src, 'sound/weapons/bulletinsert.ogg', 60, TRUE)
A.update_icon()
update_icon()
return num_loaded
/obj/item/ammo_box/attack_self(mob/user)
@@ -132,6 +131,12 @@
boolets++
return boolets
/obj/item/ammo_box/magazine/proc/ammo_list(drop_list = FALSE)
var/list/L = stored_ammo.Copy()
if(drop_list)
stored_ammo.Cut()
return L
/obj/item/ammo_box/magazine/proc/empty_magazine()
var/turf_mag = get_turf(src)
for(var/obj/item/ammo in stored_ammo)

View File

@@ -22,6 +22,16 @@
for(var/i in 1 to rand(0, max_ammo*2))
rotate()
/obj/item/ammo_box/magazine/internal/cylinder/ammo_list(drop_list = FALSE)
var/list/L = list()
for(var/i=1 to stored_ammo.len)
var/obj/item/ammo_casing/bullet = stored_ammo[i]
if(bullet)
L.Add(bullet)
if(drop_list)//We have to maintain the list size, to emulate a cylinder
stored_ammo[i] = null
return L
/obj/item/ammo_box/magazine/internal/cylinder/give_round(obj/item/ammo_casing/R, replace_spent = 0)
if(!R || (caliber && R.caliber != caliber) || (!caliber && R.type != ammo_type))
return FALSE

View File

@@ -127,7 +127,7 @@
chambered = magazine.get_round((bolt_type == BOLT_TYPE_NO_BOLT))
if (bolt_type != BOLT_TYPE_OPEN)
chambered.forceMove(src)
/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
@@ -205,7 +205,7 @@
eject_magazine(user, FALSE, AM)
else
to_chat(user, "<span class='notice'>There's already a [magazine_wording] in \the [src].</span>")
return
return
if (istype(A, /obj/item/ammo_casing) || istype(A, /obj/item/ammo_box))
if (bolt_type == BOLT_TYPE_NO_BOLT || internal_magazine)
if (chambered && !chambered.BB)
@@ -301,10 +301,7 @@
return
if(bolt_type == BOLT_TYPE_NO_BOLT)
var/num_unloaded = 0
while (get_ammo() > 0)
var/obj/item/ammo_casing/CB
CB = magazine.get_round(FALSE)
chambered = null
for(var/obj/item/ammo_casing/CB in get_ammo_list(TRUE, TRUE))
CB.forceMove(drop_location())
CB.bounce_away(FALSE, NONE)
num_unloaded++
@@ -320,7 +317,7 @@
if (recent_rack > world.time)
return
recent_rack = world.time + rack_delay
rack(user)
rack(user)
return
@@ -343,6 +340,15 @@
boolets += magazine.ammo_count()
return boolets
/obj/item/gun/ballistic/proc/get_ammo_list(countchambered = TRUE, drop_all = FALSE)
var/list/rounds = list()
if(chambered && countchambered)
rounds.Add(chambered)
if(drop_all)
chambered = null
rounds.Add(magazine.ammo_list(drop_all))
return rounds
#define BRAINS_BLOWN_THROW_RANGE 3
#define BRAINS_BLOWN_THROW_SPEED 1
/obj/item/gun/ballistic/suicide_act(mob/user)