mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'ubruntu/site2-guards-raiders' into 'master'
Bring raiders and guards to site2 towns See merge request veloren/veloren!3300
This commit is contained in:
commit
4aaefdf6be
@ -30,6 +30,7 @@ pub enum RtSimEntityKind {
|
||||
Wanderer,
|
||||
Cultist,
|
||||
Villager,
|
||||
TownGuard,
|
||||
Merchant,
|
||||
Blacksmith,
|
||||
Chef,
|
||||
@ -95,6 +96,7 @@ impl Entity {
|
||||
},
|
||||
RtSimEntityKind::Cultist
|
||||
| RtSimEntityKind::Villager
|
||||
| RtSimEntityKind::TownGuard
|
||||
| RtSimEntityKind::Chef
|
||||
| RtSimEntityKind::Alchemist
|
||||
| RtSimEntityKind::Blacksmith
|
||||
@ -746,6 +748,16 @@ impl Brain {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn town_guard(home_id: Id<Site>) -> Self {
|
||||
Self {
|
||||
begin: Some(home_id),
|
||||
tgt: None,
|
||||
route: Travel::Idle,
|
||||
last_visited: None,
|
||||
memories: Vec::new(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn begin_site(&self) -> Option<Id<Site>> { self.begin }
|
||||
|
||||
pub fn add_memory(&mut self, memory: Memory) { self.memories.push(memory); }
|
||||
@ -820,6 +832,7 @@ fn humanoid_config(kind: RtSimEntityKind, rank: TravelerRank) -> &'static str {
|
||||
TravelerRank::Rank3 => "common.entity.world.traveler3",
|
||||
},
|
||||
RtSimEntityKind::Villager => "common.entity.village.villager",
|
||||
RtSimEntityKind::TownGuard => "common.entity.village.guard",
|
||||
RtSimEntityKind::Merchant => "common.entity.village.merchant",
|
||||
RtSimEntityKind::Blacksmith => "common.entity.village.blacksmith",
|
||||
RtSimEntityKind::Chef => "common.entity.village.chef",
|
||||
|
@ -198,7 +198,8 @@ pub fn init(
|
||||
_ => {},
|
||||
},
|
||||
SiteKind::Refactor(site2) => {
|
||||
for _ in 0..site.economy.pop.min(site2.plots().len() as f32 * 1.5) as usize {
|
||||
// villagers
|
||||
for _ in 0..site.economy.pop.min(site2.plots().len() as f32) as usize {
|
||||
rtsim.entities.insert(Entity {
|
||||
is_loaded: false,
|
||||
pos: site2
|
||||
@ -217,7 +218,32 @@ pub fn init(
|
||||
});
|
||||
}
|
||||
|
||||
for _ in 0..(site2.plazas().len() as f32 * 1.5) as usize {
|
||||
// guards
|
||||
for _ in 0..site2.plazas().len() as usize {
|
||||
rtsim.entities.insert(Entity {
|
||||
is_loaded: false,
|
||||
pos: site2
|
||||
.plazas()
|
||||
.choose(&mut thread_rng())
|
||||
.map_or(site.get_origin(), |p| {
|
||||
site2.tile_center_wpos(site2.plot(p).root_tile())
|
||||
+ Vec2::new(
|
||||
thread_rng().gen_range(-8..9),
|
||||
thread_rng().gen_range(-8..9),
|
||||
)
|
||||
})
|
||||
.with_z(0)
|
||||
.map(|e| e as f32),
|
||||
seed: thread_rng().gen(),
|
||||
controller: RtSimController::default(),
|
||||
last_time_ticked: 0.0,
|
||||
kind: RtSimEntityKind::TownGuard,
|
||||
brain: Brain::town_guard(site_id),
|
||||
});
|
||||
}
|
||||
|
||||
// merchants
|
||||
for _ in 0..site2.plazas().len() as usize {
|
||||
rtsim.entities.insert(Entity {
|
||||
is_loaded: false,
|
||||
pos: site2
|
||||
|
@ -1298,7 +1298,9 @@ impl SiteKind {
|
||||
impl Site {
|
||||
pub fn is_dungeon(&self) -> bool { matches!(self.kind, SiteKind::Dungeon) }
|
||||
|
||||
pub fn is_settlement(&self) -> bool { matches!(self.kind, SiteKind::Settlement) }
|
||||
pub fn is_settlement(&self) -> bool {
|
||||
matches!(self.kind, SiteKind::Settlement | SiteKind::Refactor)
|
||||
}
|
||||
|
||||
pub fn is_castle(&self) -> bool { matches!(self.kind, SiteKind::Castle) }
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user