From ce1c6c3847a4bcf08e45f372aa195702ab59197d Mon Sep 17 00:00:00 2001 From: Tad Hardesty Date: Sun, 11 Mar 2018 12:54:26 -0700 Subject: [PATCH] Add kirby plants to the random render-pass --- src/tools/render_passes/mod.rs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/tools/render_passes/mod.rs b/src/tools/render_passes/mod.rs index 2c2c2982..a33dcaf8 100644 --- a/src/tools/render_passes/mod.rs +++ b/src/tools/render_passes/mod.rs @@ -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()); } }