P3 alpha: wolf moon every 7th night, the alpha breaks wooden doors, iron-banded door, broken-door repair, alpha pelt and cloak (protocol 7)
This commit is contained in:
@@ -95,8 +95,8 @@ func _server_tick(w: Node3D, delta: float) -> void:
|
||||
|
||||
const PER_PACKET := 40
|
||||
const ENTRY := 23
|
||||
const KIND_IDS := ["rabbit", "deer", "boar", "wolf"]
|
||||
const STATE_IDS := ["idle", "wander", "flee", "charge", "dead", "rest", "alert", "stalk", "lunge", "retreat", "home", "defend"]
|
||||
const KIND_IDS := ["rabbit", "deer", "boar", "wolf", "alpha"]
|
||||
const STATE_IDS := ["idle", "wander", "flee", "charge", "dead", "rest", "alert", "stalk", "lunge", "retreat", "home", "defend", "bash"]
|
||||
|
||||
## One creature in 23 bytes: id, kind, state, position, facing, speed, health.
|
||||
static func _encode(buf: PackedByteArray, o: int, c: Node3D) -> void:
|
||||
|
||||
@@ -32,7 +32,7 @@ signal clock(day: int, time: float) ## the server's time of day
|
||||
const Identity = preload("res://scripts/net/identity.gd")
|
||||
const ServerConfig = preload("res://scripts/net/server_config.gd")
|
||||
|
||||
const PROTOCOL := 6 ## 3: shared world; 4: the server decides; 5: wildlife; 6: rules and chat (M2.6)
|
||||
const PROTOCOL := 7 ## 3: shared world; 4: the server decides; 5: wildlife; 6: rules and chat (M2.6); 7: the alpha, broken doors (P3)
|
||||
const DEFAULT_PORT := 24242
|
||||
const HANDSHAKE_TIMEOUT := 10.0
|
||||
const JOIN_TIMEOUT := 20.0 ## includes the server building its terrain on first join
|
||||
|
||||
@@ -324,6 +324,11 @@ func _run(p: Node3D, what: String, a: Array) -> void:
|
||||
if d != null and d.get("open") != null and _allowed(Rules.use_problem(p.player_id, d)) \
|
||||
and Actions.toggle_door(p, d):
|
||||
WorldNet.piece_state(d)
|
||||
"door_repair":
|
||||
var d := WorldNet.piece(_i(a, 0))
|
||||
if d != null and d.get("broken") != null and _allowed(Rules.use_problem(p.player_id, d)) \
|
||||
and Actions.repair_door(p, d):
|
||||
WorldNet.piece_state(d)
|
||||
"fuel":
|
||||
var f := WorldNet.piece(_i(a, 0))
|
||||
if f != null and f.get("fuel") != null and Actions.add_fuel(p, f):
|
||||
@@ -421,7 +426,7 @@ func _run(p: Node3D, what: String, a: Array) -> void:
|
||||
for m in w.get_tree().get_nodes_in_group("processor"):
|
||||
m.step(float(a[0]) if a.size() > 0 and (a[0] is float or a[0] is int) else 60.0)
|
||||
"debug_spawn":
|
||||
if cheats and Creature.KINDS.has(_s(a, 0)) and _s(a, 0) != "wolf" and _v(a, 1).is_finite():
|
||||
if cheats and Creature.KINDS.has(_s(a, 0)) and not (_s(a, 0) in ["wolf", "alpha"]) and _v(a, 1).is_finite():
|
||||
w.creatures.spawn(_s(a, 0), _v(a, 1))
|
||||
"debug_time":
|
||||
if cheats:
|
||||
|
||||
@@ -427,8 +427,8 @@ func _s2c_piece_state(nid_: int, extra: Dictionary) -> void:
|
||||
var p: Node3D = pieces.get(nid_)
|
||||
if p == null or not is_instance_valid(p):
|
||||
return
|
||||
if extra.has("open") and p.has_method("set_open"):
|
||||
p.set_open(bool(extra.open))
|
||||
if p.has_method("net_state"):
|
||||
p.net_state(extra) # (a door)
|
||||
elif p.has_method("load_extra"):
|
||||
p.load_extra(extra)
|
||||
received += 1
|
||||
|
||||
Reference in New Issue
Block a user