The tutorial's sun waits for you (Gitea #5): the afternoon goes no later than 16:30 until the torch step brings dusk
This commit is contained in:
@@ -324,12 +324,34 @@ func _process(delta: float) -> void:
|
||||
if d > 0.01 and d < 5.0: # (not a teleport or a respawn)
|
||||
_count("walk", d)
|
||||
_last_pos = p
|
||||
hold_daylight()
|
||||
_marker_t -= delta
|
||||
if _marker_t <= 0.0:
|
||||
_marker_t = 0.5
|
||||
_marker = find_marker()
|
||||
poll()
|
||||
|
||||
## The sun waits for you (Gitea #5): until a step that sets the clock comes
|
||||
## up (the torch step, at dusk), the afternoon goes no later than
|
||||
## DAYLIGHT_UNTIL, however long the earlier steps take. Then dusk comes on
|
||||
## when the tutorial means it to.
|
||||
const DAYLIGHT_UNTIL := 16.5
|
||||
func hold_daylight() -> void:
|
||||
if not active or world == null or not is_instance_valid(world) or world.day_night == null:
|
||||
return
|
||||
if _clock_step_reached():
|
||||
return
|
||||
var latest := DAYLIGHT_UNTIL / 24.0
|
||||
if world.day_night.time > latest:
|
||||
world.day_night.time = latest
|
||||
|
||||
## Whether the current step, or one before it, moves the clock on.
|
||||
func _clock_step_reached() -> bool:
|
||||
for i in range(mini(index + 1, steps.size())):
|
||||
if Dictionary(steps[i].get("setup", {})).has("time"):
|
||||
return true
|
||||
return false
|
||||
|
||||
## Goals that are states, not events: checked twice a second.
|
||||
func poll() -> void:
|
||||
if not active or world == null or not is_instance_valid(world):
|
||||
|
||||
Reference in New Issue
Block a user