killian's grab bag PR

a scattershot package of various changes
This commit is contained in:
Killian
2023-08-27 18:08:28 +01:00
parent 990819109a
commit 10474205d0
9 changed files with 132 additions and 86 deletions
+4 -1
View File
@@ -26,6 +26,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()
..()
@@ -37,7 +38,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()
@@ -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()
@@ -233,4 +233,4 @@
load_method = SINGLE_CASING
max_shells = 5
ammo_type = /obj/item/ammo_casing/a12g/beanbag