Add walkable housing interiors and cross-hub visitors
This commit is contained in:
@@ -262,4 +262,4 @@ building:
|
||||
- {"id": "camp_platform", "name": "Camp platform", "description": "A persistent, destructible camp platform.", "model": "camp", "width": 4, "depth": 4, "height": 0.75, "hp": 300, "profession": "builder", "level": 1}
|
||||
- {"id": "fort_block", "name": "Fort block", "description": "A persistent, destructible fort block.", "model": "fort", "width": 6, "depth": 3, "height": 3, "hp": 800, "profession": "builder", "level": 5}
|
||||
|
||||
housing: { roomSize: 12, maxFurniture: 64, maxItems: 256, maxGuests: 64, keySeconds: 3 }
|
||||
housing: { walkSpeed: 4, playerRadius: 0.35, jumpSpeed: 6, gravity: 18, tableHeight: 0.8, storageHeight: 0.9, roomSize: 12, maxFurniture: 64, maxItems: 256, maxGuests: 64, keySeconds: 3 }
|
||||
|
||||
@@ -16,14 +16,23 @@ func (f FurnitureProfile) Validate() error {
|
||||
}
|
||||
|
||||
type HousingRules struct {
|
||||
RoomSize float64 `yaml:"roomSize"`
|
||||
MaxFurniture int `yaml:"maxFurniture"`
|
||||
MaxItems int `yaml:"maxItems"`
|
||||
MaxGuests int `yaml:"maxGuests"`
|
||||
KeySeconds float64 `yaml:"keySeconds"`
|
||||
WalkSpeed float64 `yaml:"walkSpeed"`
|
||||
PlayerRadius float64 `yaml:"playerRadius"`
|
||||
JumpSpeed float64 `yaml:"jumpSpeed"`
|
||||
Gravity float64 `yaml:"gravity"`
|
||||
TableHeight float64 `yaml:"tableHeight"`
|
||||
StorageHeight float64 `yaml:"storageHeight"`
|
||||
RoomSize float64 `yaml:"roomSize"`
|
||||
MaxFurniture int `yaml:"maxFurniture"`
|
||||
MaxItems int `yaml:"maxItems"`
|
||||
MaxGuests int `yaml:"maxGuests"`
|
||||
KeySeconds float64 `yaml:"keySeconds"`
|
||||
}
|
||||
|
||||
func (r HousingRules) Validate() error {
|
||||
if r.WalkSpeed != 0 && (!finiteRange(r.WalkSpeed, 1, 8) || !finiteRange(r.PlayerRadius, .2, .6) || !finiteRange(r.JumpSpeed, 1, 8) || !finiteRange(r.Gravity, 10, 30) || !finiteRange(r.TableHeight, .5, 2) || !finiteRange(r.StorageHeight, .5, 2)) {
|
||||
return fmt.Errorf("invalid indoor movement tuning")
|
||||
}
|
||||
if !finiteRange(r.RoomSize, 8, 32) || r.MaxFurniture < 1 || r.MaxFurniture > 128 || r.MaxItems < 1 || r.MaxItems > 512 || r.MaxGuests < 1 || r.MaxGuests > 128 || r.KeySeconds != 3 {
|
||||
return fmt.Errorf("invalid housing rules")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user