diff --git a/server/src/construct.rs b/server/src/construct.rs index 3137184b..7c45217b 100644 --- a/server/src/construct.rs +++ b/server/src/construct.rs @@ -9,6 +9,7 @@ use failure::err_msg; use skill::{Skill, Cast, Immunity, Disable, Event}; use effect::{Cooldown, Effect, Colour}; +use names::{name}; use spec::{Spec}; use item::{Item}; use img; @@ -251,6 +252,10 @@ impl Construct { self } + pub fn new_name(self) -> Construct { + self.named(&name()) + } + pub fn learn(mut self, s: Skill) -> Construct { self.skills.push(ConstructSkill::new(s)); self.colours = Colours::from_construct(&self); diff --git a/server/src/mtx.rs b/server/src/mtx.rs index 196a5682..c33ada61 100644 --- a/server/src/mtx.rs +++ b/server/src/mtx.rs @@ -74,12 +74,14 @@ pub fn apply(tx: &mut Transaction, account: &Account, variant: MtxVariant, const account::debit(tx, account.id, 1)?; - construct = construct.new_img(); + construct = match mtx.variant { + MtxVariant::Rename => construct.new_name(), + _ => construct.new_img(), + }; match mtx.variant { MtxVariant::Invader => img::invader_write(construct.img)?, MtxVariant::Molecular => img::molecular_write(construct.img)?, - MtxVariant::Rename => unimplemented!(), - // _ => unimplemented!(), + _ => construct.img, }; construct_write(tx, construct)?;