M2.5: wildlife, wolves, hunting, fishing and sleeping on the server

This commit is contained in:
Paul Bailey
2026-11-04 21:25:10 +00:00
parent 26be17b05f
commit a211fe4c63
20 changed files with 1258 additions and 88 deletions

View File

@@ -1,4 +1,4 @@
extends Node3D
extends CharacterBody3D
## One player's character on a dedicated server (M2.4): what they carry, what
## they hold, what they wear, their bed, and their survival stats, which run
## here (warmth from the server's fires and buildings, hunger, diet...).
@@ -23,8 +23,12 @@ var worn := ""
var cursor = null ## the stack held on the inventory screen's cursor
var survival: Node
var hands: Node ## (self: held_heat for a carried torch)
var velocity := Vector3.ZERO
## (A body with no collision, so it has a physics id: wolves look for a clear
## line to it, and arrows skip whoever shot them. `velocity` comes from the
## player's moves.)
var water_level := -INF
var in_bed := false ## got into bed, waiting for the night to pass
var bed_at := Vector3.ZERO
var has_bed_spawn := false
var bed_spawn := Vector3.ZERO
var anim := 0 ## last movement state reported (avatar.gd Anim)
@@ -32,6 +36,9 @@ var died_at := 0 ## ticks (ms) when they last died
func setup(world: Node3D) -> void:
hands = self
collision_layer = 0
collision_mask = 0
set_physics_process(false)
water_level = world.terrain.water_level
survival = preload("res://scripts/player/survival.gd").new()
survival.name = "Survival"