## Capture scenario for item models (A4), on seed 2's island in the real MatchView: ## ## - held: a row of players, each holding a different weapon or consumable, seen from ## their right side, so the grips can be checked against the hands. ## - shoulder: the over-the-shoulder view of a player holding the whaler's longgun, as ## the game's camera has it, aiming down the sight line. ## - ground: every item lying on the ground, at a mix of tiers, from above. ## - tiers: the dock carbine at tiers 0 to 3, side by side, held. ## - kegs: B8's thrown powder kegs: a player holding one, one in flight, and one lying ## lit against a stone wall, from behind the thrower. extends Node3D @export var stage: String = "held" @export var match_seed: int = 2 const HELD: Array[String] = [ "boathook", "fowling_piece", "dock_carbine", "signal_revolver", "rivet_repeater", "whalers_longgun", "line_thrower", "harpoon_gun", "powder_keg", "brine_tonic", ] var sim: Simulation var view: MatchView func _ready() -> void: sim = Simulation.new(match_seed) var spot: Vector3 = _open_ground() match stage: "held": _row(spot, HELD, []) "tiers": _row(spot, ["dock_carbine", "dock_carbine", "dock_carbine", "dock_carbine"], [0, 1, 2, 3]) "shoulder": _row(spot, ["whalers_longgun"], []) "ground": _lay_out(spot) "kegs": _kegs(spot) view = MatchView.new() view.setup(sim, 0) add_child(view) view.sync() match stage: "held", "tiers": var count: int = HELD.size() if stage == "held" else 4 var middle: Vector3 = _at(spot, (count - 1) * 0.5) # From the players' right (-X of a figure facing +Z), a little ahead. var back: float = 5.5 + count * 0.25 if stage == "held" else 2.6 var eye: Vector3 = middle + Vector3(-back, 1.6, 0.8) view.look_from(eye, middle + Vector3(0.0, 1.0, 0.0)) "shoulder": var id: int = sim.entities.entities()[0].id view.rig.aim_blend = 1.0 view.follow(id, deg_to_rad(4.0)) "ground": view.look_from(spot + Vector3(0.0, 5.0, -3.6), spot + Vector3(0.0, 0.0, 1.8)) "kegs": view.look_from(spot + Vector3(-2.2, 2.4, -3.2), spot + Vector3(0.0, 1.0, 3.5)) view.settle() func _at(spot: Vector3, index: float) -> Vector3: var at: Vector3 = spot + Vector3(0.0, 0.0, index * 1.7 - 6.0) at.y = sim.ground.terrain_height(at.x, at.z) return at func _row(spot: Vector3, items: Array, tiers: Array) -> void: for index: int in items.size(): var player: SimEntity = sim.entities.find(sim.add_player()) player.position = _at(spot, index) player.drop_state = Drop.NONE player.on_ground = true player.health = 100 player.yaw = 0 var id: String = items[index] if id == ItemCatalog.BOATHOOK: player.selected = 0 continue player.slot_items[0] = ItemCatalog.code_of(id) player.slot_counts[0] = 1 player.slot_tiers[0] = int(tiers[index]) if index < tiers.size() else 1 player.selected = 1 func _lay_out(spot: Vector3) -> void: var ids: Array[String] = ItemModels.ids() for index: int in ids.size(): var code: int = ItemCatalog.code_of(ids[index]) var x: float = (index % 6 - 2.5) * 2.2 var z: float = (index / 6) * 1.6 var at: Vector3 = spot + Vector3(x, 0.0, z) at.y = sim.ground.terrain_height(at.x, at.z) if code < 0: continue Inventory.spawn_pickup(sim, at, code, 1, -1, index % 4) func _kegs(spot: Vector3) -> void: _row(spot + Vector3(0.0, 0.0, 6.0), ["powder_keg"], []) var keg: int = ItemCatalog.code_of("powder_keg") var g: float = Tuning.GRID_CELL_METRES var cell: Vector3i = Vector3i(floori(spot.x / g), floori(spot.y / Tuning.BUILD_LEVEL_METRES), floori((spot.z + 8.0) / g)) var wall: StructureSet.Piece = sim.structures.add(StructureSet.WALL, Materials.STONE, Vector4i(cell.x, cell.y, cell.z, StructureSet.SLOT_WALL_Z), 0, 0, sim.tick, sim.ground) wall.build_ticks_left = 0 wall.health = wall.max_health var lying: Vector3 = Vector3(spot.x + 0.6, 0.0, cell.z * g - 0.4) lying.y = sim.ground.terrain_height(lying.x, lying.z) var flying: Vector3 = spot + Vector3(0.2, 2.1, 3.0) for at: Vector3 in [lying, flying]: var charge: SimEntity = sim.entities.create(SimEntity.ARCHETYPE_PROJECTILE) charge.item = keg charge.position = at charge.origin = at charge.use_ticks = 60 charge.on_ground = at == lying sim.projectiles.append(charge.id) ## Fairly flat, open ground above the sea near the middle of the island. func _open_ground() -> Vector3: var size: float = Tuning.WORLD_SIZE_METRES var best: Vector3 = Vector3(size * 0.5, 0.0, size * 0.5) for ring: int in 60: for step: int in 24: var angle: float = TAU * step / 24.0 var x: float = size * 0.5 + cos(angle) * ring * 12.0 var z: float = size * 0.5 + sin(angle) * ring * 12.0 var feet: Vector3 = Vector3(x, sim.ground.terrain_height(x, z), z) if feet.y < sim.sea_level + 3.0 or sim.ground.terrain_normal(x, z).y < 0.985: continue if not sim.props.near(feet, 12.0).is_empty(): continue var level: bool = true for dz: float in [-7.0, 0.0, 9.0]: if absf(sim.ground.terrain_height(x - 2.0, z + dz) - feet.y) > 0.8: level = false if level: return feet return best