B7: Weapon roster and consumables
Eight slot weapons: the six from the design plus the rivet repeater (fast, short-range automatic) and the harpoon gun (slow heavy bolt, 2.5x damage to built pieces). Four quality tiers, Rusted to Captain's, scale damage and reload time. The line thrower now yanks the shooter towards where its line lands, through a data field (pull_speed) any weapon can use. Four consumables: sailcloth bandage (heals to 75), brine tonic, cork vest and the new tar patch. Fire with one held starts using it if it would help; it takes effect after its use time. Changing slot, dropping, sprinting, swimming or elimination interrupts it and uses nothing up. All checks run on the server. A data-validation test covers every weapon, tier, consumable and ammunition type, including unknown stat keys, name format and that every ammo type is used. The GDD's weapons section lists the roster. Closes #21 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -162,6 +162,7 @@ func _apply_command(player: SimEntity, command: PlayerCommand) -> void:
|
||||
if player.action_cooldown > 0:
|
||||
player.action_cooldown -= 1
|
||||
Weapons.update(player)
|
||||
Consumables.update(self, player, command)
|
||||
var held: int = command.buttons if command != null else 0
|
||||
var pressed: int = held & ~player.prev_buttons
|
||||
player.prev_buttons = held
|
||||
@@ -184,7 +185,11 @@ func _apply_command(player: SimEntity, command: PlayerCommand) -> void:
|
||||
if player.selected == BOATHOOK_SLOT:
|
||||
Harvest.swing(player, ground, props, events, structures)
|
||||
else:
|
||||
Weapons.fire(self, player, command.is_pressed(PlayerCommand.BUTTON_AIM))
|
||||
var def: ItemDef = Inventory.held_def(player)
|
||||
if def != null and def.kind == ItemDef.CONSUMABLE:
|
||||
Consumables.start(self, player)
|
||||
else:
|
||||
Weapons.fire(self, player, command.is_pressed(PlayerCommand.BUTTON_AIM))
|
||||
|
||||
|
||||
## Marks players whose health reached 0 as eliminated, and drops what they carried.
|
||||
@@ -249,6 +254,7 @@ func state_hash() -> String:
|
||||
for array: PackedInt32Array in [entity.slot_items, entity.slot_counts, entity.slot_rounds, entity.slot_tiers, entity.ammo]:
|
||||
buffer.put_data(array.to_byte_array())
|
||||
buffer.put_32(entity.reload_ticks)
|
||||
buffer.put_32(entity.use_ticks)
|
||||
buffer.put_64(roundi(entity.bloom * 1000.0))
|
||||
buffer.put_32(entity.prev_buttons)
|
||||
buffer.put_u8(1 if entity.eliminated else 0)
|
||||
|
||||
Reference in New Issue
Block a user