enforce static typing

This commit is contained in:
anyreso 2024-04-19 06:19:21 +00:00 committed by Squinty
parent 09880cc957
commit e44426c2cc
36 changed files with 271 additions and 374 deletions

View file

@ -17,10 +17,10 @@ class_name ExplosiveDamageComponent extends Area3D
@export var damage : int = 100
@export var impulse_force : int = 1000
func _physics_process(_delta):
func _physics_process(_delta : float) -> void:
for body in get_overlapping_bodies():
if body is RigidBody3D:
var direction = (body.global_position - global_position).normalized()
var direction : Vector3 = (body.global_position - global_position).normalized()
body.apply_central_impulse(direction * impulse_force)
for area in get_overlapping_areas():

View file

@ -24,20 +24,20 @@ class_name FlagCarryComponent extends Node
var _carried_flag : Flag
func _ready():
func _ready() -> void:
sensor.body_entered.connect(_sensor_on_body_entered)
func _process(_delta):
func _process(_delta : float) -> void:
if _is_carrying():
_carried_flag.global_position = attachment.global_position
_carried_flag.global_rotation = attachment.global_rotation
func _grab(flag : Flag):
func _grab(flag : Flag) -> void:
if not _is_carrying():
flag.grab()
_carried_flag = flag
func _release(inherited_velocity : Vector3, throw_speed : float):
func _release(inherited_velocity : Vector3, throw_speed : float) -> void:
if _is_carrying():
_carried_flag.drop()
_carried_flag.rotation_degrees.x = 0.0
@ -49,12 +49,12 @@ func _release(inherited_velocity : Vector3, throw_speed : float):
func _is_carrying() -> bool:
return _carried_flag != null
func _sensor_on_body_entered(collider):
func _sensor_on_body_entered(collider : Flag) -> void:
if collider is Flag:
_grab(collider)
func drop():
func drop() -> void:
_release(Vector3.ZERO, 0.0)
func throw(inherited_velocity : Vector3):
func throw(inherited_velocity : Vector3) -> void:
_release(inherited_velocity, max_throw_speed)

View file

@ -23,7 +23,7 @@ class_name HealthComponent extends Area3D
signal health_zeroed
signal health_changed(value : int)
func _ready():
func _ready() -> void:
heal_full()
@rpc("call_local")
@ -33,10 +33,10 @@ func damage(amount : int) -> void:
health_zeroed.emit()
@rpc("call_local")
func _heal(amount : int):
func _heal(amount : int) -> void:
health = clampf(health + amount, 0.0, max_health)
func heal_full():
func heal_full() -> void:
if not is_multiplayer_authority():
return