tavern_keeper/src/events/tavern_built.rs

26 lines
639 B
Rust

use std::rc::Rc;
use crate::{state::{GameState, Action}, site::{Structure, Tavern, Site}, entity::{Location, Entity}};
pub struct TavernBuilt {
pub loc: Location,
pub tavern: Tavern,
}
impl Action for TavernBuilt {
fn apply(&self, state: &mut GameState) {
let tavern_id = state.world.add_site(Site{
entity: Entity{ loc: self.loc, id: 0},
structure: Structure::Tavern(self.tavern.clone()),
});
state.set_tavern(tavern_id);
}
fn description(&self) -> String {
format!("{} was built", self.tavern.name)
}
fn notable(&self) -> bool {
true
}
}