M2.6: server rules (PvP, raiding, locks and friends, death penalty, difficulty, wolf grace), chat, admin commands, server console
This commit is contained in:
@@ -164,6 +164,11 @@ func _physics_process(delta: float) -> void:
|
||||
var p: String = t.interact_prompt(player)
|
||||
if t.is_in_group("piece") and t.item_id != "grave":
|
||||
p += " [X] Dismantle"
|
||||
# Online: someone else's piece says whose it is (the server decides
|
||||
# whether you may use it, by its rules).
|
||||
var owner := String(t.get_meta("owner", ""))
|
||||
if not owner.is_empty() and Net.state == "connected" and owner != Net.get_identity().player_id:
|
||||
p = "%s's · %s" % [String(t.get_meta("owner_name", "someone")), p]
|
||||
_set_prompt(p)
|
||||
elif def.has("food"):
|
||||
_set_prompt("[RMB] Eat %s" % def.name)
|
||||
@@ -346,6 +351,9 @@ func _apply_hit() -> void:
|
||||
# Animals first: a short box sweep in front of the camera, so you don't
|
||||
# need pixel-perfect aim at a running rabbit.
|
||||
var animal := melee_target()
|
||||
if animal != null and animal.has_meta("avatar_peer"):
|
||||
Actions.hit_player(player, int(animal.get_meta("avatar_peer")))
|
||||
return
|
||||
if animal != null:
|
||||
Actions.melee(player, animal)
|
||||
return
|
||||
@@ -366,12 +374,14 @@ func melee_target() -> Node3D:
|
||||
var q := PhysicsShapeQueryParameters3D.new()
|
||||
q.shape = box
|
||||
q.transform = Transform3D(cam.global_basis, cam.global_position - cam.global_basis.z * reach * 0.5 - cam.global_basis.y * 0.5)
|
||||
q.collision_mask = 8
|
||||
# Online with PvP on, other players' avatars too (their hitbox, layer 16).
|
||||
var pvp: bool = Net.state == "connected" and bool(Net.server_info.get("pvp", false))
|
||||
q.collision_mask = 8 | (16 if pvp else 0)
|
||||
var best: Node3D = null
|
||||
var best_d := INF
|
||||
for h in cam.get_world_3d().direct_space_state.intersect_shape(q, 8):
|
||||
var c: Node3D = h.collider
|
||||
if c.is_in_group("creature"):
|
||||
if c.is_in_group("creature") or c.has_meta("avatar_peer"):
|
||||
var d := c.global_position.distance_to(cam.global_position)
|
||||
if d < best_d:
|
||||
best_d = d
|
||||
|
||||
Reference in New Issue
Block a user