M2.5: wildlife, wolves, hunting, fishing and sleeping on the server
This commit is contained in:
@@ -55,7 +55,15 @@ func setup(w: Node3D, p: Node3D, from: Vector3, vel: Vector3, seed: int) -> void
|
||||
_line.material_override = lm
|
||||
add_child(_line)
|
||||
|
||||
## Online, our game shows the server's float (creature_net.gd): it doesn't
|
||||
## run any fishing itself, it's just moved and shown.
|
||||
var puppet := false
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
if puppet:
|
||||
_t += delta
|
||||
_mesh.position.y = (-0.06 + sin(_t * 18.0) * 0.03) if state == "biting" else (sin(_t * 2.2) * 0.012 if state == "floating" else 0.0)
|
||||
return
|
||||
step(delta)
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
@@ -94,8 +102,8 @@ func step(dt: float) -> void:
|
||||
_t += dt
|
||||
var terrain: Node3D = world.terrain
|
||||
if global_position.distance_to(player.global_position) > LINE_LENGTH + 4.0:
|
||||
Actions.notify.emit("The line snapped")
|
||||
world.end_fishing()
|
||||
Actions.tell(player, "The line snapped")
|
||||
world.end_fishing(player)
|
||||
return
|
||||
match state:
|
||||
"flying":
|
||||
@@ -109,17 +117,17 @@ func step(dt: float) -> void:
|
||||
table = ItemDB.water_fishing(water_type)
|
||||
if table.is_empty() or table.fish.is_empty():
|
||||
state = "landed"
|
||||
Actions.notify.emit("Nothing to catch here")
|
||||
Actions.tell(player, "Nothing to catch here")
|
||||
elif float(water.depth) < float(table.min_depth):
|
||||
state = "landed"
|
||||
Actions.notify.emit("Too shallow here: cast further out")
|
||||
Actions.tell(player, "Too shallow here: cast further out")
|
||||
else:
|
||||
state = "floating"
|
||||
wait_left = _next_wait()
|
||||
elif p.y <= ground + 0.03:
|
||||
p.y = ground + 0.03
|
||||
state = "landed"
|
||||
Actions.notify.emit("Cast into the water")
|
||||
Actions.tell(player, "Cast into the water")
|
||||
global_position = p
|
||||
"floating":
|
||||
wait_left -= dt
|
||||
@@ -128,7 +136,7 @@ func step(dt: float) -> void:
|
||||
state = "biting"
|
||||
fish = _pick_fish()
|
||||
bite_left = BITE_WINDOW
|
||||
Actions.notify.emit("Bite! Click to reel in")
|
||||
Actions.tell(player, "Bite! Click to reel in")
|
||||
"biting":
|
||||
bite_left -= dt
|
||||
# The float bobs hard and goes under.
|
||||
@@ -138,7 +146,7 @@ func step(dt: float) -> void:
|
||||
fish = ""
|
||||
wait_left = _next_wait() * float(ItemDB.fishing.modifiers.get("missed_wait", 1.3))
|
||||
_mesh.position.y = 0.0
|
||||
Actions.notify.emit("It got away")
|
||||
Actions.tell(player, "It got away")
|
||||
|
||||
func _draw_line() -> void:
|
||||
_imesh.clear_surfaces()
|
||||
|
||||
Reference in New Issue
Block a user