M1d: creatures, hunting, weapons, food buffs and the hide cloak

- Rabbits, deer and boars with procedural meshes and animated legs, a
  state machine (idle/wander/flee/charge/dead) and heightmap steering that
  avoids water, cliffs, the world edge, trees and buildings
- Spawner keeps a habitat-based budget around the player (6/4/3)
- Melee needs a weapon or tool (club, spear, axe, pickaxe); box sweep hits
- Wooden spear (thrust or throw) and crude bow with draw-scaled arrows;
  projectiles stick in the world as saved pickups
- Carcasses: E to butcher for meat, hide and embedded arrows
- Boars charge and gore when hit; hurt flash and a brief healing pause
- Cooked meat gives Well fed (faster stamina and healing); buffs saved
- Hide cloak: wear for warmth, saved, goes in the grave on death
- Feathers as meadow pickups (appended, existing save ids unchanged)
- New test_creatures_combat suite; run_all.sh gets a per-suite time limit
This commit is contained in:
Paul Bailey
2026-11-04 10:55:44 +00:00
parent fed96ef118
commit 67bf85523d
22 changed files with 1782 additions and 33 deletions

View File

@@ -18,6 +18,13 @@ var _menu: Control
var _bars: Dictionary = {}
var _status: Label
var _clock: Label
var _hurt: ColorRect
## A red flash at the screen edge when something hits you.
func _on_hurt(amount: float, _from: Vector3) -> void:
_hurt.color.a = clampf(0.15 + amount / 60.0, 0.15, 0.45)
var tw := _hurt.create_tween()
tw.tween_property(_hurt, "color:a", 0.0, 0.6)
func bind(p: CharacterBody3D) -> void:
player = p
@@ -93,6 +100,13 @@ func bind(p: CharacterBody3D) -> void:
player.selected_changed.connect(_refresh)
player.inventory_requested.connect(_on_inventory_requested)
player.hands.prompt_changed.connect(func(t): _prompt.text = t)
_hurt = ColorRect.new()
_hurt.color = Color(0.7, 0.0, 0.0, 0.0)
_hurt.set_anchors_preset(Control.PRESET_FULL_RECT)
_hurt.mouse_filter = Control.MOUSE_FILTER_IGNORE
root.add_child(_hurt)
root.move_child(_hurt, 0)
player.survival.hurt.connect(_on_hurt)
Actions.notify.connect(toast)
ItemDB.icons_ready.connect(_refresh)
_refresh()