B9: Loot tables and containers
Seeded loot at every point of interest's loot markers, rolled once per match from the "loot" stream by LootSet.plan() and placed by Simulation.place_loot(). - Each marker holds a sea chest (chance by location) or floor loot (rolls on the location's weapon/consumable/ammo/nothing weights). Weapons roll a tier from the location's tier weights and come with their ammunition; chests hold a weapon (best of two tier rolls), a consumable and spare ammunition. - Interact opens the nearest closed chest in reach unless a pickup is nearer, and spills its contents as pickups. - Washed-up crate props hold one roll of the crate table and spill it when broken by any means. - If the rolls leave fewer POI weapons than LOOT_MIN_POI_WEAPONS (one per player in a full lobby), extra weapon rolls top up floor spots. - Chest and crate state is part of state_hash(). ServerLoop places loot. Tests: test_loot (12), including a statistics run of 1,000 loot seeds over four generated islands that checks tier shares against the tables, that shrines beat hamlets, and that every match has a weapon per player at POIs and 1.25 per player counting crates. Closes #23 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -10,7 +10,12 @@ func _run(match_seed: int, players: int, bots: int, ticks: int) -> ServerLoop:
|
||||
|
||||
func test_creates_players_then_bots() -> void:
|
||||
var loop: ServerLoop = ServerLoop.new(1, 2, 3)
|
||||
assert_eq(loop.sim.entities.count(), 5)
|
||||
var players: int = 0
|
||||
for entity: SimEntity in loop.sim.entities.entities():
|
||||
if entity.archetype == SimEntity.ARCHETYPE_PLAYER:
|
||||
players += 1
|
||||
assert_eq(players, 5)
|
||||
assert_true(loop.sim.pickups.size() > 0, "the match's floor loot was placed")
|
||||
assert_eq(loop.player_ids, [1, 2, 3, 4, 5] as Array[int])
|
||||
assert_eq(loop.bots.size(), 3)
|
||||
assert_eq(loop.bots[0].player_id, 3)
|
||||
|
||||
Reference in New Issue
Block a user