mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-30 00:29:02 +01:00
Fixes the Armory not spawning guns by reworking how the armory spawners work. (#9754)
* Fixes the Armory not spawning guns by reworking how the armory spawners work. They now just spawn 1 of each gun in their list instead of doing the whole randomized gun system. Frankly, I'm not sure why the previous code was broken. I do not have time to step through it with a debugger, but this is tested and working. * Update gun_spawns.dm * Update modular_skyrat/modules/sec_haul/code/guns/gun_spawns.dm Co-authored-by: Tom <8881105+tf-4@users.noreply.github.com> * Update gun_spawns.dm Co-authored-by: Tom <8881105+tf-4@users.noreply.github.com>
This commit is contained in:
@@ -13,37 +13,27 @@
|
||||
/// How many mags per gun do we spawn, if it takes magazines.
|
||||
var/mags_to_spawn = 3
|
||||
/// Do we want to angle it so that it is horizontal?
|
||||
var/vertial_guns = TRUE
|
||||
var/vertical_guns = TRUE
|
||||
|
||||
/obj/structure/rack/shelf
|
||||
|
||||
/obj/effect/spawner/armory_spawn/Initialize(mapload)
|
||||
..()
|
||||
if(guns?.len)
|
||||
var/guns_spawned = 0
|
||||
while((gun_count - guns_spawned) && guns.len)
|
||||
var/gunspawn = pick_weight(guns)
|
||||
while(islist(gunspawn))
|
||||
gunspawn = pick_weight(gunspawn)
|
||||
if(!gun_doubles)
|
||||
guns.Remove(gunspawn)
|
||||
for(var/gun in guns) // 11/20/21: Gun spawners now spawn 1 of each gun in it's list no matter what, so as to reduce the RNG of the armory stock.
|
||||
var/obj/item/gun/spawned_gun = new gun(loc)
|
||||
|
||||
if(gunspawn)
|
||||
var/obj/item/gun/spawned_gun = new gunspawn(loc)
|
||||
if(vertical_guns)
|
||||
spawned_gun.place_on_rack()
|
||||
spawned_gun.pixel_x = rand(-10, 10)
|
||||
|
||||
if(vertial_guns)
|
||||
spawned_gun.place_on_rack()
|
||||
spawned_gun.pixel_x = rand(-10,10)
|
||||
if(istype(spawned_gun, /obj/item/gun/ballistic))
|
||||
var/obj/item/gun/ballistic/spawned_ballistic_gun = spawned_gun
|
||||
if(spawned_ballistic_gun.magazine && !istype(spawned_ballistic_gun.magazine, /obj/item/ammo_box/magazine/internal))
|
||||
var/obj/item/storage/box/ammo_box/spawned_box = new(loc)
|
||||
spawned_box.name = "ammo box - [spawned_ballistic_gun.name]"
|
||||
for(var/i in 1 to mags_to_spawn)
|
||||
new spawned_ballistic_gun.mag_type (spawned_box)
|
||||
|
||||
if(istype(spawned_gun, /obj/item/gun/ballistic))
|
||||
var/obj/item/gun/ballistic/spawned_ballistic_gun = spawned_gun
|
||||
if(spawned_ballistic_gun.magazine && !istype(spawned_ballistic_gun.magazine, /obj/item/ammo_box/magazine/internal))
|
||||
var/obj/item/storage/box/ammo_box/spawned_box = new(loc)
|
||||
spawned_box.name = "ammo box - [spawned_ballistic_gun.name]"
|
||||
for(var/i in 1 to mags_to_spawn)
|
||||
new spawned_ballistic_gun.mag_type (spawned_box)
|
||||
|
||||
guns_spawned++
|
||||
return INITIALIZE_HINT_QDEL
|
||||
|
||||
/obj/effect/spawner/armory_spawn/shotguns
|
||||
|
||||
Reference in New Issue
Block a user