weapon slots and loadout done
This commit is contained in:
+17
-1
@@ -7,10 +7,21 @@ extends FloatingBody
|
||||
@export var throttle_response := 1.5 # how fast the engine spools up/down
|
||||
@export var rudder_strength := 2.5 # turning torque at speed
|
||||
@export var keel_grip := 3.0 # resistance to sliding sideways
|
||||
@export var loadout: Dictionary[StringName, WeaponDef] = {}
|
||||
|
||||
var desired_throttle := 0.0 # move_toward target for actual throttle
|
||||
var steer_input := 0.0
|
||||
var throttle := 0.0
|
||||
var throttle := 0.0 # current throttle state of ship
|
||||
var _slots: Array[WeaponSlot] = []
|
||||
|
||||
func _ready() -> void:
|
||||
super()
|
||||
for child in get_children():
|
||||
if child is WeaponSlot:
|
||||
_slots.append(child)
|
||||
var def: WeaponDef = loadout.get(child.name)
|
||||
if def != null:
|
||||
child.mount(def)
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
super(delta)
|
||||
@@ -40,3 +51,8 @@ func _physics_process(delta: float) -> void:
|
||||
right = right.normalized()
|
||||
var lateral_speed := linear_velocity.dot(right)
|
||||
apply_central_force(-right * lateral_speed * keel_grip * mass * submerged_ratio)
|
||||
|
||||
func fire_weapons() -> void:
|
||||
for slot in _slots:
|
||||
if slot.weapon != null:
|
||||
slot.weapon.try_fire()
|
||||
|
||||
Reference in New Issue
Block a user