From 3cce8a8caf1cf5dbacb827afbdec921cf75bda74 Mon Sep 17 00:00:00 2001 From: Relintai Date: Sun, 8 Oct 2023 20:31:46 +0200 Subject: [PATCH] Updated entity's body related methods. --- game/autoload/Server.gd | 2 +- game/player/Body.gd | 2 +- game/player/Mob.gd | 6 +++--- game/player/NamePlate.gd | 2 +- game/player/NetworkedPlayer.gd | 4 ++-- game/player/PlayerGDBase.gd | 8 ++++---- game/scenes/CharacterSelectorMenu.gd | 4 ++-- game/scripts/ai/EntityAIGD.gd | 10 +++++----- game/scripts/networking/SpawnPoint.gd | 2 +- game/scripts/spells/gd_spell_script.gd | 4 ++-- 10 files changed, 22 insertions(+), 22 deletions(-) diff --git a/game/autoload/Server.gd b/game/autoload/Server.gd index cde36f5..41d32aa 100644 --- a/game/autoload/Server.gd +++ b/game/autoload/Server.gd @@ -223,4 +223,4 @@ func set_terrarin_player(): var terrarin : Node = get_node("/root/GameScene/VoxelWorld") if terrarin.has_method("set_player"): - terrarin.set_player(local_player_master.player.get_body()) + terrarin.set_player(local_player_master.player.body_get()) diff --git a/game/player/Body.gd b/game/player/Body.gd index 518cb2b..230e875 100644 --- a/game/player/Body.gd +++ b/game/player/Body.gd @@ -106,7 +106,7 @@ func _enter_tree() -> void: on_c_controlled_changed() transform = entity.get_transform_2d(true) - entity.set_body(self) + entity.body_set(self) set_physics_process(true) func on_centity_data_changed(entd : EntityData): diff --git a/game/player/Mob.gd b/game/player/Mob.gd index cc6d788..17e735d 100644 --- a/game/player/Mob.gd +++ b/game/player/Mob.gd @@ -101,7 +101,7 @@ func _notification_sdeath(): func set_position(position : Vector3, rotation : Vector3) -> void: - get_body().set_position(position, rotation) + body_get().set_position(position, rotation) func _notification_sdamage(what, info): if what == SpellEnums.NOTIFICATION_DAMAGE_DAMAGE_DEALT: @@ -110,11 +110,11 @@ func _notification_sdamage(what, info): func _notification_cdamage(what, info): if what == SpellEnums.NOTIFICATION_DAMAGE_DAMAGE_DEALT: - WorldNumbers.damage(get_body().position, 1.6, info.damage, info.crit) + WorldNumbers.damage(body_get().position, 1.6, info.damage, info.crit) func _notification_cheal(what, info): if what == SpellEnums.NOTIFICATION_DAMAGE_DAMAGE_DEALT: - WorldNumbers.heal(get_body().position, 1.6, info.heal, info.crit) + WorldNumbers.heal(body_get().position, 1.6, info.heal, info.crit) func _notification_sxp_gained(value : int) -> void: if not ESS.can_character_level_up(slevel): diff --git a/game/player/NamePlate.gd b/game/player/NamePlate.gd index 5bba9fa..0cfe403 100644 --- a/game/player/NamePlate.gd +++ b/game/player/NamePlate.gd @@ -81,7 +81,7 @@ func _process(delta): if (get_scale() - target_scale).length() < 0.04: interpolating = false - #var position : Vector2 = entity.get_body().position + #var position : Vector2 = entity.body_get().position var position : Vector2 = Vector2() position.x -= (rect_size.x / 2.0) * rect_scale.x diff --git a/game/player/NetworkedPlayer.gd b/game/player/NetworkedPlayer.gd index fcfd05a..bee8ffa 100644 --- a/game/player/NetworkedPlayer.gd +++ b/game/player/NetworkedPlayer.gd @@ -110,8 +110,8 @@ class_name NetworkedPlayerGD ## if get_network_master() != 1: ## print(str(get_network_master()) + "npcset") # -# get_body().position = pposition -# get_body().rotation = protation +# body_get().position = pposition +# body_get().rotation = protation # #func _moved() -> void: # diff --git a/game/player/PlayerGDBase.gd b/game/player/PlayerGDBase.gd index 1a4b3af..888e98f 100644 --- a/game/player/PlayerGDBase.gd +++ b/game/player/PlayerGDBase.gd @@ -51,10 +51,10 @@ func _physics_process(delta): update_visibility() func update_visibility() -> void: - _query.collision_layer = get_body().get_collision_layer() + _query.collision_layer = body_get().get_collision_layer() - _query.transform = Transform2D(0, get_body().position) - var res : Array = get_body().get_world_2d().direct_space_state.intersect_shape(_query) + _query.transform = Transform2D(0, body_get().position) + var res : Array = body_get().get_world_2d().direct_space_state.intersect_shape(_query) #warning-ignore:unassigned_variable var currenty_sees : Array = Array() @@ -107,5 +107,5 @@ func set_position_remote(pos : Vector2) -> void: if get_tree().is_network_server(): rpc("set_position_remote", pos) #print(position) - get_body().position = pos + body_get().position = pos diff --git a/game/scenes/CharacterSelectorMenu.gd b/game/scenes/CharacterSelectorMenu.gd index fadb8d8..89c7138 100644 --- a/game/scenes/CharacterSelectorMenu.gd +++ b/game/scenes/CharacterSelectorMenu.gd @@ -215,6 +215,6 @@ func character_selection_changed() -> void: return for e in player_display_container_node.get_children(): - e.get_body().hide() + e.body_get().hide() - b.entity.get_body().show() + b.entity.body_get().show() diff --git a/game/scripts/ai/EntityAIGD.gd b/game/scripts/ai/EntityAIGD.gd index 293ad4f..70d07b9 100644 --- a/game/scripts/ai/EntityAIGD.gd +++ b/game/scripts/ai/EntityAIGD.gd @@ -78,7 +78,7 @@ func attack(delta): if target == null: owner.ai_state = EntityEnums.AI_STATE_REGENERATE - owner.get_body().target_movement_direction = Vector2() + owner.body_get().target_movement_direction = Vector2() return var cast : bool = false @@ -118,16 +118,16 @@ func attack(delta): break if owner.cast_is_castings(): - owner.get_body().target_movement_direction = Vector2() + owner.body_get().target_movement_direction = Vector2() return - owner.get_body().target_movement_direction = Vector2() + owner.body_get().target_movement_direction = Vector2() - var dir : Vector2 = target.get_body().position - owner.get_body().position + var dir : Vector2 = target.body_get().position - owner.body_get().position var l = dir.length() if l > 2.5: - owner.get_body().target_movement_direction = Vector2(dir.x, dir.y) + owner.body_get().target_movement_direction = Vector2(dir.x, dir.y) func sort_spells_by_rank(a, b): if a == null or b == null: diff --git a/game/scripts/networking/SpawnPoint.gd b/game/scripts/networking/SpawnPoint.gd index 7dc512d..471692e 100644 --- a/game/scripts/networking/SpawnPoint.gd +++ b/game/scripts/networking/SpawnPoint.gd @@ -92,7 +92,7 @@ func spawn(): func set_terrarin_player(): pass -# terrarin.set_player(player.get_body() as Spatial) +# terrarin.set_player(player.body_get() as Spatial) func _on_host_button_clicked(): get_tree().connect("network_peer_connected", self, "_network_peer_connected") diff --git a/game/scripts/spells/gd_spell_script.gd b/game/scripts/spells/gd_spell_script.gd index 3cc44d0..8930bfd 100644 --- a/game/scripts/spells/gd_spell_script.gd +++ b/game/scripts/spells/gd_spell_script.gd @@ -61,8 +61,8 @@ func _cast_starts(info : SpellCastInfo) -> void: if range_enabled: if info.caster != info.target: - var c : Vector2 = info.caster.get_body().position - var t : Vector2 = info.target.get_body().position + var c : Vector2 = info.caster.body_get().position + var t : Vector2 = info.target.body_get().position if (c - t).length() > range_range: return