A4: Item models and icons
tools/models/items.py builds every item in headless Blender from primitives: the boathook, the eight weapons and powder keg, four consumables and five kinds of ammo, each with its own outline. It writes an OBJ per item (the Debian Blender's glTF exporter needs numpy), a JSON with the grip and the left hand's support point, and a 128 px Cycles icon rendered on the CPU. Materials are named after Palette colours, and TRIM2_/TRIM3_ surfaces are the tier treatment: rope whipping from tier 2, brass bands from tier 3; tier 0 is faded. ItemModels paints the models from Palette by tier. EntityView puts the held item's grip in each figure's right hand, turned with the player's pitch and put away aboard, falling, gliding or swimming, and draws items lying in the world with their models, one MultiMesh per model and tier. The hotbar shows each slot's icon. make models rebuilds them; make item-captures renders the items held, over the shoulder, on the ground and by tier. Closes #44 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
[gd_scene load_steps=2 format=3]
|
||||
|
||||
[ext_resource type="Script" path="res://test/capture/items_scene.gd" id="1"]
|
||||
|
||||
[node name="CaptureItems" type="Node3D"]
|
||||
script = ExtResource("1")
|
||||
stage = "ground"
|
||||
@@ -0,0 +1,7 @@
|
||||
[gd_scene load_steps=2 format=3]
|
||||
|
||||
[ext_resource type="Script" path="res://test/capture/items_scene.gd" id="1"]
|
||||
|
||||
[node name="CaptureItems" type="Node3D"]
|
||||
script = ExtResource("1")
|
||||
stage = "held"
|
||||
@@ -0,0 +1,113 @@
|
||||
## 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.
|
||||
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)
|
||||
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))
|
||||
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)
|
||||
|
||||
|
||||
## 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
|
||||
@@ -0,0 +1 @@
|
||||
uid://b0gws66qbu53s
|
||||
@@ -0,0 +1,7 @@
|
||||
[gd_scene load_steps=2 format=3]
|
||||
|
||||
[ext_resource type="Script" path="res://test/capture/items_scene.gd" id="1"]
|
||||
|
||||
[node name="CaptureItems" type="Node3D"]
|
||||
script = ExtResource("1")
|
||||
stage = "shoulder"
|
||||
@@ -0,0 +1,7 @@
|
||||
[gd_scene load_steps=2 format=3]
|
||||
|
||||
[ext_resource type="Script" path="res://test/capture/items_scene.gd" id="1"]
|
||||
|
||||
[node name="CaptureItems" type="Node3D"]
|
||||
script = ExtResource("1")
|
||||
stage = "tiers"
|
||||
Reference in New Issue
Block a user