mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Make castles appear close to towns.
This commit is contained in:
parent
a0dd527a1d
commit
0fbe6a67f2
@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- Bats move slower and use a simple proportional controller to maintain altitude
|
- Bats move slower and use a simple proportional controller to maintain altitude
|
||||||
- Bats now have less health
|
- Bats now have less health
|
||||||
- Climbing no longer requires having 10 energy
|
- Climbing no longer requires having 10 energy
|
||||||
|
- Castles will now be placed close to towns
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
|
@ -113,11 +113,8 @@ struct ProximityRequirements {
|
|||||||
impl ProximityRequirements {
|
impl ProximityRequirements {
|
||||||
pub fn satisfied_by(&self, site: Vec2<i32>) -> bool {
|
pub fn satisfied_by(&self, site: Vec2<i32>) -> bool {
|
||||||
let all_of_compliance = self.all_of.iter().all(|spec| spec.satisfied_by(site));
|
let all_of_compliance = self.all_of.iter().all(|spec| spec.satisfied_by(site));
|
||||||
let any_of_compliance = if self.any_of.is_empty() {
|
let any_of_compliance =
|
||||||
true
|
self.any_of.is_empty() || self.any_of.iter().any(|spec| spec.satisfied_by(site));
|
||||||
} else {
|
|
||||||
self.any_of.iter().any(|spec| spec.satisfied_by(site))
|
|
||||||
};
|
|
||||||
all_of_compliance && any_of_compliance
|
all_of_compliance && any_of_compliance
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,7 +190,9 @@ impl Civs {
|
|||||||
0..=5 => (
|
0..=5 => (
|
||||||
find_site_loc(
|
find_site_loc(
|
||||||
&mut ctx,
|
&mut ctx,
|
||||||
&ProximityRequirements::new().avoid_all_of(this.castle_enemies(), 40),
|
&ProximityRequirements::new()
|
||||||
|
.avoid_all_of(this.castle_enemies(), 40)
|
||||||
|
.close_to_one_of(this.towns(), 20),
|
||||||
SiteKind::Castle,
|
SiteKind::Castle,
|
||||||
)?,
|
)?,
|
||||||
SiteKind::Castle,
|
SiteKind::Castle,
|
||||||
|
Loading…
Reference in New Issue
Block a user