style: apply gdformat formatting across the entire project
Auto-format all GDScript files using gdformat from gdtoolkit. This is a baseline formatting pass to ensure consistent style: - Normalizes indentation and spacing - Wraps long lines to 100 characters - Removes trailing whitespace - Standardizes blank lines between functions 68 files reformatted, 8 files left unchanged (3rd-party addon files with parse errors excluded).
This commit is contained in:
+11
-11
@@ -33,6 +33,7 @@ var last_task: StringName
|
||||
var random_source: RandomNumberGenerator
|
||||
var debug_logs := true
|
||||
|
||||
|
||||
func _init(
|
||||
_id: int,
|
||||
_npc_name: String,
|
||||
@@ -53,11 +54,10 @@ func _init(
|
||||
hunger = random_source.randf_range(20.0, 80.0)
|
||||
energy = random_source.randf_range(40.0, 100.0)
|
||||
position = Vector3(
|
||||
random_source.randf_range(-8.0, 8.0),
|
||||
0.0,
|
||||
random_source.randf_range(-8.0, 8.0)
|
||||
random_source.randf_range(-8.0, 8.0), 0.0, random_source.randf_range(-8.0, 8.0)
|
||||
)
|
||||
|
||||
|
||||
func die_from_starvation() -> void:
|
||||
is_dead = true
|
||||
current_task = SimulationIds.ACTION_DEAD
|
||||
@@ -69,35 +69,35 @@ func die_from_starvation() -> void:
|
||||
|
||||
if debug_logs:
|
||||
print("[SimNPC] ", npc_name, " died from starvation.")
|
||||
|
||||
|
||||
|
||||
func get_inventory_amount(item_id: StringName) -> float:
|
||||
return float(inventory.get(String(item_id), 0.0))
|
||||
|
||||
|
||||
func add_inventory(item_id: StringName, amount: float) -> void:
|
||||
inventory[String(item_id)] = get_inventory_amount(item_id) + maxf(amount, 0.0)
|
||||
|
||||
|
||||
func remove_inventory(item_id: StringName, requested_amount: float) -> float:
|
||||
var removed := minf(
|
||||
maxf(requested_amount, 0.0),
|
||||
get_inventory_amount(item_id)
|
||||
)
|
||||
var removed := minf(maxf(requested_amount, 0.0), get_inventory_amount(item_id))
|
||||
inventory[String(item_id)] = get_inventory_amount(item_id) - removed
|
||||
return removed
|
||||
|
||||
|
||||
func set_task(action_id: StringName, duration: float = -1.0) -> void:
|
||||
var definition := SimulationDefinitions.get_action(action_id)
|
||||
if definition == null:
|
||||
push_error("SimNPC: unknown action_id '%s'" % action_id)
|
||||
return
|
||||
current_task = action_id
|
||||
task_duration = (
|
||||
duration if duration >= 0.0 else definition.default_duration
|
||||
)
|
||||
task_duration = (duration if duration >= 0.0 else definition.default_duration)
|
||||
task_progress = 0.0
|
||||
task_complete = false
|
||||
task_state = TASK_STATE_TRAVELING
|
||||
has_travel_target = false
|
||||
|
||||
|
||||
func start_working() -> void:
|
||||
if task_state != TASK_STATE_TRAVELING:
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user