Wow this sure is bad code (#27769)

This commit is contained in:
DGamerL
2024-12-30 14:40:54 +00:00
committed by GitHub
parent c68637011a
commit 1ef4d825e5
@@ -146,64 +146,61 @@
K.amount = pick(1, 2, 3, 4)
K.update_icon()
//also drop dummy circuit boards deconstructable for research (loot)
var/obj/item/circuitboard/C
//spawn 1-4 boards of a random type
var/spawnees = 0
// Spawn 1-4 boards of a random type
var/num_boards = rand(1, 4)
var/list/options = list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512)
for(var/i=0, i<num_boards, i++)
var/chosen = pick(options)
options.Remove(options.Find(chosen))
spawnees |= chosen
var/list/options = subtypesof(/obj/item/circuitboard/random_tech_level)
for(var/i in 1 to num_boards)
var/obj/item/circuitboard/random_tech_level/board = pick_n_take(options)
new board(T)
if(spawnees & 1)
C = new(T)
C.name = "Drone CPU motherboard"
C.origin_tech = "programming=[rand(3, 6)]"
// Becomes a board with a random level in the specified tech
// It's done like this so we can have a random level because we can't do this in the type declaration
/obj/item/circuitboard/random_tech_level
/// Lower bound of random tech level
var/lower_bound = 3
/// Upper bound of random tech level
var/upper_bound = 6
if(spawnees & 2)
C = new(T)
C.name = "Drone neural interface"
C.origin_tech = "biotech=[rand(3, 6)]"
/obj/item/circuitboard/random_tech_level/Initialize(mapload)
. = ..()
origin_tech += "[rand(lower_bound, upper_bound)]"
if(spawnees & 4)
C = new(T)
C.name = "Drone suspension processor"
C.origin_tech = "magnets=[rand(3, 6)]"
/obj/item/circuitboard/random_tech_level/motherboard
name = "Drone CPU motherboard"
origin_tech = "programming="
if(spawnees & 8)
C = new(T)
C.name = "Drone shielding controller"
C.origin_tech = "bluespace=[rand(3, 6)]"
/obj/item/circuitboard/random_tech_level/interface
name = "Drone neural interface"
origin_tech = "biotech="
if(spawnees & 16)
C = new(T)
C.name = "Drone power capacitor"
C.origin_tech = "powerstorage=[rand(3, 6)]"
/obj/item/circuitboard/random_tech_level/processor
name = "Drone suspension processor"
origin_tech = "magnets="
if(spawnees & 32)
C = new(T)
C.name = "Drone hull reinforcer"
C.origin_tech = "materials=[rand(3, 6)]"
/obj/item/circuitboard/random_tech_level/controller
name = "Drone shielding controller"
origin_tech = "bluespace="
if(spawnees & 64)
C = new(T)
C.name = "Drone auto-repair system"
C.origin_tech = "engineering=[rand(3, 6)]"
/obj/item/circuitboard/random_tech_level/capacitor
name = "Drone power capacitor"
origin_tech = "powerstorage="
if(spawnees & 128)
C = new(T)
C.name = "Drone plasma overcharge counter"
C.origin_tech = "plasmatech=[rand(3, 6)]"
/obj/item/circuitboard/random_tech_level/reinforcer
name = "Drone hull reinforcer"
origin_tech = "materials="
if(spawnees & 256)
C = new(T)
C.name = "Drone targetting circuitboard"
C.origin_tech = "combat=[rand(3, 6)]"
/obj/item/circuitboard/random_tech_level/autorepair
name = "Drone auto-repair system"
origin_tech = "engineering="
if(spawnees & 512)
C = new(T)
C.name = "Corrupted drone morality core"
C.origin_tech = "syndicate=[rand(3, 6)]"
/obj/item/circuitboard/random_tech_level/counter
name = "Drone plasma overcharge counter"
origin_tech = "plasmatech="
/obj/item/circuitboard/random_tech_level/targeting
name = "Drone targeting circuitboard"
origin_tech = "combat="
/obj/item/circuitboard/random_tech_level/morality
name = "Corrupted drone morality core"
origin_tech = "syndicate="