完善客户端功能并同步差距文档
This commit is contained in:
@@ -118,6 +118,24 @@ func try_pickup() -> int:
|
||||
client.pickup_item(best_vid)
|
||||
return best_vid
|
||||
|
||||
# Mouse hover probe used by PlayerController's cursor state. Ground drops are
|
||||
# deliberately tested in screen space, so clicking a visible label / mesh
|
||||
# selects PICK even when the item is not the nearest drop in world distance.
|
||||
func hover_at(camera: Camera3D, screen_pos: Vector2) -> bool:
|
||||
if camera == null:
|
||||
return false
|
||||
var best := INF
|
||||
for node in _by_vid.values():
|
||||
if not is_instance_valid(node):
|
||||
continue
|
||||
if camera.is_position_behind(node.global_position):
|
||||
continue
|
||||
var p := camera.unproject_position(node.global_position + Vector3(0, 0.35, 0))
|
||||
var d := p.distance_to(screen_pos)
|
||||
if d <= 28.0:
|
||||
best = minf(best, d)
|
||||
return best < INF
|
||||
|
||||
func _name_for(vnum: int) -> String:
|
||||
if proto:
|
||||
var pd: Dictionary = proto.item(vnum)
|
||||
|
||||
Reference in New Issue
Block a user