Skip to content

Commit

Permalink
Wow this sure is bad code (ParadiseSS13#27769)
Browse files Browse the repository at this point in the history
  • Loading branch information
DGamerL authored Dec 30, 2024
1 parent c686370 commit 1ef4d82
Showing 1 changed file with 57 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

if(spawnees & 1)
C = new(T)
C.name = "Drone CPU motherboard"
C.origin_tech = "programming=[rand(3, 6)]"

if(spawnees & 2)
C = new(T)
C.name = "Drone neural interface"
C.origin_tech = "biotech=[rand(3, 6)]"

if(spawnees & 4)
C = new(T)
C.name = "Drone suspension processor"
C.origin_tech = "magnets=[rand(3, 6)]"

if(spawnees & 8)
C = new(T)
C.name = "Drone shielding controller"
C.origin_tech = "bluespace=[rand(3, 6)]"

if(spawnees & 16)
C = new(T)
C.name = "Drone power capacitor"
C.origin_tech = "powerstorage=[rand(3, 6)]"

if(spawnees & 32)
C = new(T)
C.name = "Drone hull reinforcer"
C.origin_tech = "materials=[rand(3, 6)]"

if(spawnees & 64)
C = new(T)
C.name = "Drone auto-repair system"
C.origin_tech = "engineering=[rand(3, 6)]"

if(spawnees & 128)
C = new(T)
C.name = "Drone plasma overcharge counter"
C.origin_tech = "plasmatech=[rand(3, 6)]"

if(spawnees & 256)
C = new(T)
C.name = "Drone targetting circuitboard"
C.origin_tech = "combat=[rand(3, 6)]"

if(spawnees & 512)
C = new(T)
C.name = "Corrupted drone morality core"
C.origin_tech = "syndicate=[rand(3, 6)]"
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)

// 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

/obj/item/circuitboard/random_tech_level/Initialize(mapload)
. = ..()
origin_tech += "[rand(lower_bound, upper_bound)]"

/obj/item/circuitboard/random_tech_level/motherboard
name = "Drone CPU motherboard"
origin_tech = "programming="

/obj/item/circuitboard/random_tech_level/interface
name = "Drone neural interface"
origin_tech = "biotech="

/obj/item/circuitboard/random_tech_level/processor
name = "Drone suspension processor"
origin_tech = "magnets="

/obj/item/circuitboard/random_tech_level/controller
name = "Drone shielding controller"
origin_tech = "bluespace="

/obj/item/circuitboard/random_tech_level/capacitor
name = "Drone power capacitor"
origin_tech = "powerstorage="

/obj/item/circuitboard/random_tech_level/reinforcer
name = "Drone hull reinforcer"
origin_tech = "materials="

/obj/item/circuitboard/random_tech_level/autorepair
name = "Drone auto-repair system"
origin_tech = "engineering="

/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="

0 comments on commit 1ef4d82

Please sign in to comment.