Add physical hub portals and shared housing entrances
This commit is contained in:
@@ -72,6 +72,7 @@ snapshotHz: 5
|
||||
chunkSize: 128
|
||||
terrainResolution: 16
|
||||
inventory: { stopWeightRatio: 2, slowdownExponent: 2, breakdownBase: 25, breakdownMax: 75, breakdownLevelScale: 25, recipeChance: 0.01, actionCooldown: 1 }
|
||||
entrances: { housingX: 12, housingZ: 0 }
|
||||
worldRadius: 1024
|
||||
maxPlayers: 100
|
||||
spawnSeparation: 48
|
||||
|
||||
@@ -19,6 +19,7 @@ type Recipe struct {
|
||||
}
|
||||
|
||||
type Balance struct {
|
||||
Entrances *EntranceRules `yaml:"entrances"`
|
||||
Inventory *InventoryRules `yaml:"inventory"`
|
||||
XPCurve *XPCurve `yaml:"xpCurve"`
|
||||
Housing *HousingRules `yaml:"housing"`
|
||||
@@ -86,6 +87,11 @@ func Parse(data []byte) (Balance, error) {
|
||||
return b, b.Validate()
|
||||
}
|
||||
func (b Balance) Validate() error {
|
||||
if b.Entrances != nil {
|
||||
if e := b.Entrances.Validate(); e != nil {
|
||||
return e
|
||||
}
|
||||
}
|
||||
if b.Inventory != nil {
|
||||
if e := b.Inventory.Validate(); e != nil {
|
||||
return e
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package content
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
)
|
||||
|
||||
type EntranceRules struct {
|
||||
HousingX float64 `yaml:"housingX"`
|
||||
HousingZ float64 `yaml:"housingZ"`
|
||||
}
|
||||
|
||||
func (r EntranceRules) Validate() error {
|
||||
if !finiteRange(r.HousingX, -64, 64) || !finiteRange(r.HousingZ, -64, 64) || math.Hypot(r.HousingX, r.HousingZ) < 6 {
|
||||
return fmt.Errorf("housing entrance must be near, but separate from, the central world portal")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user