Clean up SweetLogger prints by making file and functions arguments automatic

This commit is contained in:
JonShard
2026-08-11 10:19:26 +02:00
parent bd43b0bd1e
commit 3ae1e089aa
26 changed files with 190 additions and 154 deletions
+1 -1
View File
@@ -25,7 +25,7 @@ func despawn_unheld_pickables():
NetworkManager.despawn_item(pickable)
continue
if not held_by.is_in_group("persistent_inventory"):
SweetLogger.debug("despawn_unheld_pickables held_by: {0}, pickable: {1}", [held_by, pickable], "build_mode_controller.gd", "despawn_unheld_pickables")
SweetLogger.debug("despawn_unheld_pickables held_by: {0}, pickable: {1}", [held_by, pickable])
NetworkManager.despawn_item(pickable)
+5 -5
View File
@@ -10,7 +10,7 @@ var _food_item: FoodItem
func _ready() -> void:
SweetLogger.debug("_ready(): {0}", [_pickable.name], "combinable_item.gd", "_ready")
SweetLogger.debug("_ready(): {0}", [_pickable.name])
_food_item = get_parent().get_node_or_null("FoodItem") as FoodItem
if not _food_item:
push_error("CombinableItem is missing FoodItem reference. must be a sibling of a FoodItem on ", get_parent().name, ".")
@@ -52,24 +52,24 @@ func _on_body_entered(body: Node3D) -> void:
if not NetworkManager.owns_world():
return
if _combining or body == _pickable:
SweetLogger.debug("other is our own pickable", [], "combinable_item.gd", "_on_body_entered")
SweetLogger.debug("other is our own pickable", [])
return
var other := Helper.find_food_item(body)
if not other:
SweetLogger.debug("other is not a foodItem", [], "combinable_item.gd", "_on_body_entered")
SweetLogger.debug("other is not a foodItem", [])
return
var result: PackedScene = RecipeManager.get_combination_result(_food_item.id, other.id)
if not result:
SweetLogger.debug("There is no recipe for {0} + {1}", [_food_item.id, other.id], "combinable_item.gd", "_on_body_entered")
SweetLogger.debug("There is no recipe for {0} + {1}", [_food_item.id, other.id])
return
_combine(body, result)
# Instantiate the result of combination and free the two ingredient items
func _combine(other_body: Node3D, result: PackedScene) -> void:
SweetLogger.debug("combining {0} + {1} into {2}", [_food_item.id, Helper.find_food_item(other_body).id, result.resource_path], "combinable_item.gd", "_combine")
SweetLogger.debug("combining {0} + {1} into {2}", [_food_item.id, Helper.find_food_item(other_body).id, result.resource_path])
# Get Snapzone
var snap_zone := _pickable.get_picked_up_by()
+1 -1
View File
@@ -41,7 +41,7 @@ func _process(delta: float) -> void:
# Count down to zero and despawn
_time_left -= delta
if _time_left <= 0:
SweetLogger.debug("despawning {0}", [get_parent()], "despawning_item.gd", "_process")
SweetLogger.debug("despawning {0}", [get_parent()])
NetworkManager.despawn_item(get_parent())
# Stop counting: despawn_item() only queues the free, so without this we
# keep re-reporting the same item every frame until it actually goes.
+2 -2
View File
@@ -9,10 +9,10 @@ func _ready() -> void:
if not kitchen_scene:
push_error("StationSpawner missing kitchen_scene")
SweetLogger.debug("initializing", [], "kitchen_instantiator.gd", "_ready")
SweetLogger.debug("initializing", [])
if NetworkManager.owns_world():
SweetLogger.debug("initializing on server", [], "kitchen_instantiator.gd", "_ready")
SweetLogger.debug("initializing on server", [])
# Later we will do procedural generation here.
# For now we just load a scene.
NetworkManager.call_deferred("spawn_item", kitchen_scene.resource_path, transform)