[MIRROR] Killian's Grab Bag PR (#6880)

Co-authored-by: Casey <a.roaming.shadow@gmail.com>
Co-authored-by: Raeschen <rycoop29@gmail.com>
This commit is contained in:
CHOMPStation2
2023-08-29 08:30:20 -07:00
committed by GitHub
parent ad34ddcdc2
commit dc189c0b16
9 changed files with 130 additions and 83 deletions

View File

@@ -27,6 +27,7 @@
var/shot_counter = TRUE // does this gun tell you how many shots it has?
var/battery_lock = 0 //If set, weapon cannot switch batteries
var/random_start_ammo = FALSE //if TRUE, the weapon will spawn with randomly-determined ammo
/obj/item/weapon/gun/energy/New()
..()
@@ -41,7 +42,9 @@
power_supply = new cell_type(src)
else
power_supply = null
//random starting power! gives us a random number of shots in the battery between 0 and the max possible
if(random_start_ammo && cell_type)
power_supply.charge = charge_cost*rand(0,power_supply.maxcharge/charge_cost)
update_icon()
/obj/item/weapon/gun/energy/Destroy()

View File

@@ -35,15 +35,23 @@
//var/list/icon_keys = list() //keys
//var/list/ammo_states = list() //values
var/random_start_ammo = FALSE //randomize amount of starting ammo
/obj/item/weapon/gun/projectile/New(loc, var/starts_loaded = 1)
..()
if(starts_loaded)
if(ispath(ammo_type) && (load_method & (SINGLE_CASING|SPEEDLOADER)))
for(var/i in 1 to max_shells)
loaded += new ammo_type(src)
if(random_start_ammo)
loaded.Cut(0,rand(0,max_shells))
if(ispath(magazine_type) && (load_method & MAGAZINE))
ammo_magazine = new magazine_type(src)
allowed_magazines += /obj/item/ammo_magazine/smart
if(random_start_ammo)
var/ammo_cut = rand(0,ammo_magazine.max_ammo)
ammo_magazine.contents.Cut(0,ammo_cut)
ammo_magazine.stored_ammo.Cut(0,ammo_cut)
update_icon()
/obj/item/weapon/gun/projectile/consume_next_projectile()

View File

@@ -241,3 +241,4 @@
load_method = SINGLE_CASING
max_shells = 5
ammo_type = /obj/item/ammo_casing/a12g/beanbag