Fix minor warnings
This commit is contained in:
@ -125,7 +125,7 @@ func _generate_tooltip_text() -> String:
|
||||
return "\n".join(info)
|
||||
|
||||
func _format_seconds_to_mmss(seconds: float) -> String:
|
||||
var total_seconds = int(seconds)
|
||||
var minutes = total_seconds / 60
|
||||
var total_seconds: int = int(seconds)
|
||||
var minutes: int = total_seconds / 60
|
||||
var seconds_rem = total_seconds % 60
|
||||
return "%d min, %d sec" % [minutes, seconds_rem]
|
||||
|
||||
@ -71,7 +71,7 @@ func attach_component(component: Component, global_pos: Vector2, parent_piece: S
|
||||
# --- UPDATED: Logic now uses the helper function ---
|
||||
func _recalculate_collision_shape():
|
||||
# This logic is much simpler now. We just iterate over relevant children.
|
||||
var combined_polygons = []
|
||||
var _combined_polygons = []
|
||||
|
||||
for piece in get_structural_pieces():
|
||||
# You would use logic here to transform the piece's local shape
|
||||
|
||||
@ -97,8 +97,8 @@ func _orient_pawn(delta: float):
|
||||
|
||||
# --- THE FIX: Adjust how target_up is calculated ---
|
||||
# Calculate velocity components relative to camera orientation
|
||||
var forward_velocity_component = pawn.velocity.dot(target_forward)
|
||||
var right_velocity_component = pawn.velocity.dot(camera_pivot.global_transform.basis.x)
|
||||
var _forward_velocity_component = pawn.velocity.dot(target_forward)
|
||||
var _right_velocity_component = pawn.velocity.dot(camera_pivot.global_transform.basis.x)
|
||||
|
||||
# Only apply strong "feet trailing" if significant forward/backward movement dominates
|
||||
# and we are actually moving.
|
||||
@ -129,8 +129,8 @@ func _orient_pawn(delta: float):
|
||||
var new_basis = current_basis.slerp(target_basis, delta * orientation_speed)
|
||||
|
||||
# Store the body's yaw *before* applying the new basis
|
||||
var old_body_yaw = current_basis.get_euler().y
|
||||
var old_body_pitch = current_basis.get_euler().x
|
||||
var _old_body_yaw = current_basis.get_euler().y
|
||||
var _old_body_pitch = current_basis.get_euler().x
|
||||
|
||||
# 3. Apply the new orientation
|
||||
pawn.global_transform.basis = new_basis
|
||||
@ -140,7 +140,7 @@ func _orient_pawn(delta: float):
|
||||
|
||||
# --- Add new function placeholder ---
|
||||
# TODO: Implement Rotation Stabilization Logic
|
||||
func _apply_stabilization_torques(delta: float):
|
||||
func _apply_stabilization_torques(_delta: float):
|
||||
if not is_instance_valid(stabilization_target):
|
||||
stabilization_enabled = false
|
||||
return
|
||||
|
||||
@ -64,13 +64,13 @@ func apply_force(force: Vector2, pos: Vector2 = self.global_position):
|
||||
physics_mode = PhysicsMode.COMPOSITE
|
||||
apply_force(force, position)
|
||||
|
||||
func _add_forces(force: Vector2, position: Vector2 = Vector2.ZERO):
|
||||
func _add_forces(force: Vector2, pos: Vector2 = Vector2.ZERO):
|
||||
# If we are the root, accumulate the force and calculate torque on the total body.
|
||||
accumulated_force += force
|
||||
|
||||
# Calculate torque (2D cross product: T = r x F = r.x * F.y - r.y * F.x)
|
||||
# 'r' is the vector from the center of mass (global_position) to the point of force application (position).
|
||||
var r = position - global_position
|
||||
var r = pos - global_position
|
||||
var torque = r.x * force.y - r.y * force.x
|
||||
accumulated_torque += torque
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ func generate(star_system: StarSystem) -> SystemData:
|
||||
planet.position = Vector2.ZERO
|
||||
planet_barycenter.recalculate_total_mass()
|
||||
# C. Create moons for this planet.
|
||||
_generate_moons(planet, planet_barycenter, star_system, system_data)
|
||||
_generate_moons(planet, planet_barycenter, system_data)
|
||||
|
||||
# D. Place the entire planetary system in a stable orbit.
|
||||
planet_barycenter.global_position = Vector2(current_orbit_radius, 0).rotated(randf_range(0, TAU))
|
||||
@ -63,7 +63,7 @@ func generate(star_system: StarSystem) -> SystemData:
|
||||
|
||||
return system_data
|
||||
|
||||
func _generate_moons(planet: OrbitalBody2D, planet_barycenter: Barycenter, star_system: StarSystem, system_data: SystemData):
|
||||
func _generate_moons(planet: OrbitalBody2D, planet_barycenter: Barycenter, system_data: SystemData):
|
||||
var num_moons = randi_range(0, int(planet.mass / MOON_MASS / 2.0)) # Heavier planets get more moons
|
||||
num_moons = min(num_moons, MAX_MOONS_PER_PLANET)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user