diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d59b08a17..a1f252e428 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Camera zoom can now be locked, to prevent accidental zooming while rolling in combat. It comes with a keybind to enable/disable the setting, and an Auto/Toggle behavior setting. Auto behavior will only lock the camera zoom while movement and combat inputs are also being pressed. +- Custom spots can be added without recompilation (only ron and vox files) ### Changed - Bats move slower and use a simple proportional controller to maintain altitude diff --git a/assets/world/manifests/spots.ron b/assets/world/manifests/spots.ron index 0fd8aad574..de39cf8456 100644 --- a/assets/world/manifests/spots.ron +++ b/assets/world/manifests/spots.ron @@ -1,8 +1,13 @@ [ -// ( -// base_structures: "spots_general.mage_tower", -// freq: 100.0, -// condition: And3((Typical, MaxGradient(0.2), Biome([Forest, Taiga]))), -// spawn: false, -// ), + // example entry, increase freq to activate + ( + // ron file pointing to voxel model and defining special colors + base_structures: "spots_general.mage_tower", + // maximum occurance per each 1000km^2 world area + freq: 0.0, + // placement requirements + condition: All([Typical, MaxGradient(0.2), Biome([Forest, Taiga])]), + // whether to prevent trees etc. around this spot + spawn: false, + ), ] diff --git a/world/src/layer/spot.rs b/world/src/layer/spot.rs index 5f27fe8fb0..9cb3ad985f 100644 --- a/world/src/layer/spot.rs +++ b/world/src/layer/spot.rs @@ -851,8 +851,8 @@ enum SpotCondition { MinWaterDepth(f32), Not(Box), - And(Box<(SpotCondition, SpotCondition)>), - And3(Box<(SpotCondition, SpotCondition, SpotCondition)>), + All(Vec), + Any(Vec), } impl SpotCondition { @@ -872,13 +872,21 @@ impl SpotCondition { SpotCondition::IsUnderwater.is_valid(g, c) && c.water_alt > c.alt + depth }, SpotCondition::Not(condition) => !condition.is_valid(g, c), - SpotCondition::And(conditions) => { - conditions.0.is_valid(g, c) && conditions.1.is_valid(g, c) + SpotCondition::All(conditions) => 'outer: { + for cond in conditions.iter() { + if !cond.is_valid(g, c) { + break 'outer false; + } + } + true }, - SpotCondition::And3(conditions) => { - conditions.0.is_valid(g, c) - && conditions.1.is_valid(g, c) - && conditions.2.is_valid(g, c) + SpotCondition::Any(conditions) => 'outer: { + for cond in conditions.iter() { + if cond.is_valid(g, c) { + break 'outer true; + } + } + false }, } }