diff --git a/scripts/character/CharacterTemplate.cs b/scripts/character/CharacterTemplate.cs index a5eec70..285cc90 100644 --- a/scripts/character/CharacterTemplate.cs +++ b/scripts/character/CharacterTemplate.cs @@ -454,8 +454,6 @@ public partial class CharacterTemplate : CharacterBody2D { var lootData = LootListManager.GenerateLootData(LootListId); var finalGlobalPosition = GlobalPosition; - //Todo : change name str to nameof(), like this - // CallDeferred(nameof(GenerateLootObjects), this, lootData, finalGlobalPosition); GenerateLootObjects(GetParent(), lootData, finalGlobalPosition); } @@ -651,7 +649,7 @@ public partial class CharacterTemplate : CharacterBody2D return; } - CallDeferred("NodeReparent", node2D); + CallDeferred(nameof(NodeReparent), node2D); switch (item) { case WeaponTemplate weaponTemplate: diff --git a/scripts/damage/DamageNumberNodeSpawn.cs b/scripts/damage/DamageNumberNodeSpawn.cs index 3e79491..0bc00fc 100644 --- a/scripts/damage/DamageNumberNodeSpawn.cs +++ b/scripts/damage/DamageNumberNodeSpawn.cs @@ -106,7 +106,7 @@ public partial class DamageNumberNodeSpawn : Marker2D return; } - CallDeferred("AddDamageNumberNode", damageNumber); + CallDeferred(nameof(AddDamageNumberNode), damageNumber); damageNumber.Position = GlobalPosition; if (damageTemplate.MoveLeft) { diff --git a/scripts/item/ItemTypeManager.cs b/scripts/item/ItemTypeManager.cs index f91b4e2..1e29cca 100644 --- a/scripts/item/ItemTypeManager.cs +++ b/scripts/item/ItemTypeManager.cs @@ -70,7 +70,7 @@ public static class ItemTypeManager public static IItem? CreateItem(string id, Node? parent = null, Vector2? position = null) { var item = NewItem(id); - parent?.CallDeferred("add_child", (item as Node)!); + parent?.CallDeferred(GodotStringNameUtils.AddChild, (item as Node)!); if (item is not Node2D node) return item; if (position is { } pos) node.GlobalPosition = pos; return item; diff --git a/scripts/utils/GodotStringNameUtils.cs b/scripts/utils/GodotStringNameUtils.cs new file mode 100644 index 0000000..12cc573 --- /dev/null +++ b/scripts/utils/GodotStringNameUtils.cs @@ -0,0 +1,8 @@ +using Godot; + +namespace ColdMint.scripts.utils; + +public static class GodotStringNameUtils +{ + public static StringName AddChild { get; } = new("add_chile"); +} \ No newline at end of file