The pirate treasure: each player's own mound at their X, dug with a pickaxe; the drowned crew rise at night or when the chest comes up; the ship's compass, a spyglass, a cutlass and pirate gold; online too
This commit is contained in:
@@ -145,6 +145,7 @@ func _target() -> Object:
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
_swing_cd = maxf(_swing_cd - delta, 0.0)
|
||||
_zoom(delta)
|
||||
if player.ui_open:
|
||||
_ghost.visible = false
|
||||
_set_prompt("")
|
||||
@@ -176,6 +177,8 @@ func _physics_process(delta: float) -> void:
|
||||
_set_prompt("[RMB] Wear %s" % def.name)
|
||||
elif def.has("read"):
|
||||
_set_prompt("[RMB] Read the %s" % String(def.name).to_lower())
|
||||
elif def.has("zoom"):
|
||||
_set_prompt("[hold RMB] Look through the %s" % String(def.name).to_lower())
|
||||
elif def.has("bow"):
|
||||
var n: int = Actions.ammo_count(player, def.bow)
|
||||
_set_prompt("Drawing %d%%" % roundi(draw_power() * 100.0) if _drawing else "[hold LMB] Draw (%d arrows)" % n)
|
||||
@@ -234,6 +237,21 @@ func _update_ghost(def: Dictionary) -> void:
|
||||
_ghost.material_override = _ghost_ok_mat if _place_ok else _ghost_bad_mat
|
||||
_ghost.visible = true
|
||||
|
||||
## The spyglass (0.6.0): holding right-click with it narrows the view by its
|
||||
## "zoom", eased in and out.
|
||||
var _base_fov := 0.0
|
||||
func _zoom(delta: float) -> void:
|
||||
var cam := get_parent() as Camera3D
|
||||
if cam == null:
|
||||
return
|
||||
if _base_fov <= 0.0:
|
||||
_base_fov = cam.fov
|
||||
var z := float(_held_def().get("zoom", 0.0))
|
||||
var looking: bool = z > 1.0 and not player.ui_open and Input.is_action_pressed("use_item") \
|
||||
and Input.mouse_mode == Input.MOUSE_MODE_CAPTURED
|
||||
var want: float = _base_fov / z if looking else _base_fov
|
||||
cam.fov = move_toward(cam.fov, want, delta * 160.0)
|
||||
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
if player.ui_open:
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user