B8: Thrown powder kegs with line-of-sight blasts
Fire with a powder keg held now throws one (Explosives.throw): lobbed along the look direction, it drops down anything it strikes, rests where it lands, falls again if its support goes, and blows when its fuse runs out (3 s). The blast (Explosives.blast) reaches blast_radius, measured to the nearest point of each body, piece or prop: - terrain, pieces, props and fixed solids shield what is behind them; players are hit if their body middle or head is in sight; - damage falls off linearly to BLAST_EDGE_FACTOR at the edge, times tier; - players take damage armor first, credited to the thrower, who takes BLAST_SELF_FACTOR of their own; - pieces and props take structure_damage, so kegs can breach breakwaters. Everything reached is worked out before any damage is applied. Line of sight uses a per-blast Sight: the nearby solids once, a cheap box pre-check per ray, and a coarse terrain check skipped above the highest ground in reach. Four kegs blowing on one tick inside a 5x5x3 stone fort take about 5 ms, under the 12 ms tick budget (tested). Kegs in flight and lying lit are drawn with the item models (EntityView); capture scenario items_kegs. A blast emits "explosion" for A7's effects and an impact the sound director already plays as keg_blast. The launcher and bots that throw are follow-up #83. Closes #22 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="CaptureKegs" type="Node3D"]
|
||||
script = ExtResource("1")
|
||||
stage = "kegs"
|
||||
@@ -6,6 +6,8 @@
|
||||
## 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"
|
||||
@@ -32,6 +34,8 @@ func _ready() -> void:
|
||||
_row(spot, ["whalers_longgun"], [])
|
||||
"ground":
|
||||
_lay_out(spot)
|
||||
"kegs":
|
||||
_kegs(spot)
|
||||
view = MatchView.new()
|
||||
view.setup(sim, 0)
|
||||
add_child(view)
|
||||
@@ -50,6 +54,8 @@ func _ready() -> void:
|
||||
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()
|
||||
|
||||
|
||||
@@ -90,6 +96,27 @@ func _lay_out(spot: Vector3) -> void:
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user