mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-23 20:17:15 +01:00
Fixes rare empty gene_mask
Gene masks (like for plant genes) used unpadded num2hex on a random number 0-255. This had the (technically ok) result of masks for values 1-15 being a single character but also had the (not ok) result of the mask for value 0 being the empty string. This only happened to 1/256 of genes, so was easy to miss. This change pads all of them to 2 characters so this issue won't happen and to line things up nice.
This commit is contained in:
@@ -90,10 +90,10 @@ var/global/datum/controller/plants/plant_controller // Set in New().
|
||||
var/list/plant_traits = ALL_GENES
|
||||
while(plant_traits && plant_traits.len)
|
||||
var/gene_tag = pick(plant_traits)
|
||||
var/gene_mask = "[uppertext(num2hex(rand(0,255)))]"
|
||||
var/gene_mask = "[uppertext(num2hex(rand(0,255), 2))]"
|
||||
|
||||
while(gene_mask in used_masks)
|
||||
gene_mask = "[uppertext(num2hex(rand(0,255)))]"
|
||||
gene_mask = "[uppertext(num2hex(rand(0,255), 2))]"
|
||||
|
||||
var/decl/plantgene/G
|
||||
|
||||
|
||||
Reference in New Issue
Block a user