M3: Eliminations, spectating and results
The simulation now names what ended each player: weapon, fall, drown or tide, from the cause of the blow that took the last health. Hits carry the weapon's item code. Match keeps a kill feed (eliminator, cause, weapon, tick), per-player stats (damage dealt and taken between opponents, eliminations, never teammates), and a summary() with place, eliminations, damage and survival time. Players who fall on the same tick share the better place and are marked tied. When the last players fall together, the tie-break raises one team to first and the rest share the next place. Eliminated players spectate: first whoever knocked them out, then a living teammate, then the next living player in join order. When a target falls or leaves, the view follows its eliminator or moves on, on the same step. Spectators can cycle forwards and back. In results everyone watches the winner. The headless server logs every placement and the match summary. Closes #26 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -267,7 +267,10 @@ func _check_eliminations() -> void:
|
||||
continue
|
||||
player.eliminated = true
|
||||
player.velocity = Vector3.ZERO
|
||||
events.append({"type": "eliminated", "player": player_id, "by": player.last_attacker})
|
||||
events.append({
|
||||
"type": "eliminated", "player": player_id, "by": player.last_attacker,
|
||||
"cause": SimEntity.CAUSE_NAMES[player.last_cause],
|
||||
})
|
||||
Inventory.drop_all(self, player)
|
||||
|
||||
|
||||
@@ -299,6 +302,7 @@ func _advance_tide() -> void:
|
||||
var player: SimEntity = entities.find(player_id)
|
||||
if not player.eliminated and player.drop_state == Drop.NONE:
|
||||
player.health = maxi(player.health - Tuning.TIDE_SUDDEN_DEATH_DPS, 0)
|
||||
player.last_cause = SimEntity.CAUSE_TIDE
|
||||
|
||||
|
||||
## Damages a piece. Returns true if this destroyed it; anything it held up collapses.
|
||||
@@ -351,6 +355,7 @@ func state_hash() -> String:
|
||||
buffer.put_32(entity.prev_buttons)
|
||||
buffer.put_u8(1 if entity.eliminated else 0)
|
||||
buffer.put_32(entity.last_attacker)
|
||||
buffer.put_u8(entity.last_cause)
|
||||
buffer.put_32(entity.item)
|
||||
buffer.put_32(entity.item_count)
|
||||
buffer.put_32(entity.item_rounds)
|
||||
|
||||
Reference in New Issue
Block a user