mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Bring raiders and guards to site2 towns
This commit is contained in:
parent
3964ac466a
commit
6d30f7f748
@ -30,6 +30,7 @@ pub enum RtSimEntityKind {
|
|||||||
Wanderer,
|
Wanderer,
|
||||||
Cultist,
|
Cultist,
|
||||||
Villager,
|
Villager,
|
||||||
|
TownGuard,
|
||||||
Merchant,
|
Merchant,
|
||||||
Blacksmith,
|
Blacksmith,
|
||||||
Chef,
|
Chef,
|
||||||
@ -95,6 +96,7 @@ impl Entity {
|
|||||||
},
|
},
|
||||||
RtSimEntityKind::Cultist
|
RtSimEntityKind::Cultist
|
||||||
| RtSimEntityKind::Villager
|
| RtSimEntityKind::Villager
|
||||||
|
| RtSimEntityKind::TownGuard
|
||||||
| RtSimEntityKind::Chef
|
| RtSimEntityKind::Chef
|
||||||
| RtSimEntityKind::Alchemist
|
| RtSimEntityKind::Alchemist
|
||||||
| RtSimEntityKind::Blacksmith
|
| 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 begin_site(&self) -> Option<Id<Site>> { self.begin }
|
||||||
|
|
||||||
pub fn add_memory(&mut self, memory: Memory) { self.memories.push(memory); }
|
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",
|
TravelerRank::Rank3 => "common.entity.world.traveler3",
|
||||||
},
|
},
|
||||||
RtSimEntityKind::Villager => "common.entity.village.villager",
|
RtSimEntityKind::Villager => "common.entity.village.villager",
|
||||||
|
RtSimEntityKind::TownGuard => "common.entity.village.guard",
|
||||||
RtSimEntityKind::Merchant => "common.entity.village.merchant",
|
RtSimEntityKind::Merchant => "common.entity.village.merchant",
|
||||||
RtSimEntityKind::Blacksmith => "common.entity.village.blacksmith",
|
RtSimEntityKind::Blacksmith => "common.entity.village.blacksmith",
|
||||||
RtSimEntityKind::Chef => "common.entity.village.chef",
|
RtSimEntityKind::Chef => "common.entity.village.chef",
|
||||||
|
@ -198,7 +198,8 @@ pub fn init(
|
|||||||
_ => {},
|
_ => {},
|
||||||
},
|
},
|
||||||
SiteKind::Refactor(site2) => {
|
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 {
|
rtsim.entities.insert(Entity {
|
||||||
is_loaded: false,
|
is_loaded: false,
|
||||||
pos: site2
|
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 {
|
rtsim.entities.insert(Entity {
|
||||||
is_loaded: false,
|
is_loaded: false,
|
||||||
pos: site2
|
pos: site2
|
||||||
|
@ -1298,7 +1298,9 @@ impl SiteKind {
|
|||||||
impl Site {
|
impl Site {
|
||||||
pub fn is_dungeon(&self) -> bool { matches!(self.kind, SiteKind::Dungeon) }
|
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) }
|
pub fn is_castle(&self) -> bool { matches!(self.kind, SiteKind::Castle) }
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user