Smooth boosted fleet travel
This commit is contained in:
parent
e5439f7183
commit
fd792e8b63
12 changed files with 90 additions and 8 deletions
|
|
@ -2634,12 +2634,24 @@ func _advance_resource_converters(delta: float) -> void:
|
|||
building.conversion_progress = progress
|
||||
|
||||
|
||||
func _advance_distorder_drain(delta: float) -> void:
|
||||
func _distorder_boost_in_use() -> bool:
|
||||
for fleet in get_tree().get_nodes_in_group("player_fleet"):
|
||||
if fleet.has_method("is_using_speed_boost") and fleet.is_using_speed_boost():
|
||||
return true
|
||||
return false
|
||||
|
||||
|
||||
func _advance_distorder_drain(delta: float, boost_in_use: bool = true) -> void:
|
||||
if fleet_speed_multiplier <= 1.0:
|
||||
# Nothing owed at 1.0x - and no stale fractional progress should
|
||||
# carry over into a LATER, unrelated boost.
|
||||
_distorder_drain_progress = 0.0
|
||||
return
|
||||
if not boost_in_use:
|
||||
# The fader is a selected cruise speed, not an always-running machine.
|
||||
# Keep any already-earned fraction so stopping cannot erase a nearly
|
||||
# complete unit of cost, but accrue nothing while the fleet is parked.
|
||||
return
|
||||
# Normalized against the CURRENT ceiling, so "full boost" always costs
|
||||
# ENERGY_DRAIN_PER_SECOND however many distorder vessels widened it -
|
||||
# a bigger fleet buys more speed, not cheaper speed.
|
||||
|
|
@ -2897,7 +2909,7 @@ func _process(delta: float) -> void:
|
|||
_advance_planning()
|
||||
_advance_repairs(delta)
|
||||
_advance_resource_converters(delta)
|
||||
_advance_distorder_drain(delta)
|
||||
_advance_distorder_drain(delta, _distorder_boost_in_use())
|
||||
_advance_quests()
|
||||
for e in extractors:
|
||||
e.mining_progress = float(e.get("mining_progress", 0.0)) + delta * EXTRACTOR_RATE
|
||||
|
|
|
|||
Loading…
Reference in a new issue