Add kirby plants to the random render-pass

This commit is contained in:
Tad Hardesty 2018-03-11 12:54:26 -07:00
parent f4d2e54a94
commit ce1c6c3847

View file

@ -236,18 +236,27 @@ impl RenderPass for Random {
const CONTRABAND_POSTERS: u32 = 44;
const LEGIT_POSTERS: u32 = 35;
let mut rng = ::rand::thread_rng();
if atom.istype("/obj/structure/sign/poster/contraband/random/") {
atom.set_var("icon_state", Constant::string(format!("poster{}", ::rand::thread_rng().gen_range(1, 1 + CONTRABAND_POSTERS))));
atom.set_var("icon_state", Constant::string(format!("poster{}", rng.gen_range(1, 1 + CONTRABAND_POSTERS))));
} else if atom.istype("/obj/structure/sign/poster/official/random/") {
atom.set_var("icon_state", Constant::string(format!("poster{}_legit", ::rand::thread_rng().gen_range(1, 1 + LEGIT_POSTERS))));
atom.set_var("icon_state", Constant::string(format!("poster{}_legit", rng.gen_range(1, 1 + LEGIT_POSTERS))));
} else if atom.istype("/obj/structure/sign/poster/random/") {
let i = 1 + ::rand::thread_rng().gen_range(0, CONTRABAND_POSTERS + LEGIT_POSTERS);
let i = 1 + rng.gen_range(0, CONTRABAND_POSTERS + LEGIT_POSTERS);
if i <= CONTRABAND_POSTERS {
atom.set_var("icon_state", Constant::string(format!("poster{}", i)));
} else {
atom.set_var("icon_state", Constant::string(format!("poster{}_legit", i - CONTRABAND_POSTERS)));
}
} else if atom.istype("/obj/item/twohanded/required/kirbyplants/random/") {
atom.set_var("icon", Constant::string("icons/obj/flora/plants.dmi"));
let random = rng.gen_range(0, 26);
if random == 0 {
atom.set_var("icon_state", Constant::string("applebush"));
} else {
atom.set_var("icon_state", Constant::string(format!("plant-{:02}", random)));
}
} else if atom.istype("/obj/structure/sign/barsign/") {
if let Some(root) = objtree.find("/datum/barsign") {
let mut signs = Vec::new();
@ -263,7 +272,7 @@ impl RenderPass for Random {
}
}
}
if let Some(c) = ::rand::thread_rng().choose(&signs) {
if let Some(c) = rng.choose(&signs) {
atom.set_var("icon_state", c.clone());
}
}