Scale coastal crab spawning by habitat
This commit is contained in:
parent
d8bf59bca0
commit
0158b0215f
9 changed files with 261 additions and 59 deletions
|
|
@ -2,9 +2,10 @@ extends SceneTree
|
|||
|
||||
const MainScene: PackedScene = preload("res://main/main.tscn")
|
||||
const TEST_PORT: int = 18170
|
||||
const EXPECTED_POPULATION: int = 8
|
||||
const EXPECTED_POPULATION: int = 12
|
||||
const EXPECTED_BY_TYPE: Dictionary = {
|
||||
&"crab_brown": 2,
|
||||
&"crab_blue": 4,
|
||||
&"clam_manila": 3,
|
||||
&"beetle_stag_common": 3,
|
||||
}
|
||||
|
|
@ -161,6 +162,10 @@ func _validate_population(
|
|||
(position as Vector3).y
|
||||
>= entry.minimum_surface_y - 0.001
|
||||
)
|
||||
if entry.type_id == &"crab_brown":
|
||||
assert((position as Vector3).y > -0.45)
|
||||
elif entry.type_id == &"crab_blue":
|
||||
assert((position as Vector3).y < -0.45)
|
||||
if expect_authoritative_state:
|
||||
var quality: int = int(state.get("quality", -1))
|
||||
assert(FishQuality.is_valid(quality))
|
||||
|
|
@ -196,7 +201,10 @@ func _validate_respawn_budget(service: Node) -> void:
|
|||
false,
|
||||
true,
|
||||
)
|
||||
assert((service.get("_entities") as Dictionary).size() == 6)
|
||||
assert(
|
||||
(service.get("_entities") as Dictionary).size()
|
||||
== EXPECTED_POPULATION - crab_ids.size()
|
||||
)
|
||||
|
||||
var now: float = Time.get_ticks_msec() / 1000.0
|
||||
var respawns: Array = service.get("_respawns")
|
||||
|
|
@ -209,18 +217,27 @@ func _validate_respawn_budget(service: Node) -> void:
|
|||
respawns[index] = respawn
|
||||
|
||||
service.call("_update_respawns")
|
||||
assert((service.get("_entities") as Dictionary).size() == 7)
|
||||
assert(
|
||||
(service.get("_entities") as Dictionary).size()
|
||||
== EXPECTED_POPULATION - 1
|
||||
)
|
||||
assert((service.get("_respawns") as Array).size() == 1)
|
||||
var next_by_type: Dictionary = service.get("_next_respawn_by_type")
|
||||
var next_allowed: float = float(next_by_type.get(&"crab_brown", 0.0))
|
||||
assert(next_allowed - now >= 179.0)
|
||||
|
||||
service.call("_update_respawns")
|
||||
assert((service.get("_entities") as Dictionary).size() == 7)
|
||||
assert(
|
||||
(service.get("_entities") as Dictionary).size()
|
||||
== EXPECTED_POPULATION - 1
|
||||
)
|
||||
assert((service.get("_respawns") as Array).size() == 1)
|
||||
next_by_type[&"crab_brown"] = now - 1.0
|
||||
service.call("_update_respawns")
|
||||
assert((service.get("_entities") as Dictionary).size() == 8)
|
||||
assert(
|
||||
(service.get("_entities") as Dictionary).size()
|
||||
== EXPECTED_POPULATION
|
||||
)
|
||||
assert((service.get("_respawns") as Array).is_empty())
|
||||
_validate_population(service, true)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue