mirror of
https://github.com/Relintai/broken_seals_2d.git
synced 2024-11-11 20:35:10 +01:00
Updated entity's body related methods.
This commit is contained in:
parent
ff27359ade
commit
3cce8a8caf
@ -223,4 +223,4 @@ func set_terrarin_player():
|
|||||||
var terrarin : Node = get_node("/root/GameScene/VoxelWorld")
|
var terrarin : Node = get_node("/root/GameScene/VoxelWorld")
|
||||||
|
|
||||||
if terrarin.has_method("set_player"):
|
if terrarin.has_method("set_player"):
|
||||||
terrarin.set_player(local_player_master.player.get_body())
|
terrarin.set_player(local_player_master.player.body_get())
|
||||||
|
@ -106,7 +106,7 @@ func _enter_tree() -> void:
|
|||||||
on_c_controlled_changed()
|
on_c_controlled_changed()
|
||||||
|
|
||||||
transform = entity.get_transform_2d(true)
|
transform = entity.get_transform_2d(true)
|
||||||
entity.set_body(self)
|
entity.body_set(self)
|
||||||
set_physics_process(true)
|
set_physics_process(true)
|
||||||
|
|
||||||
func on_centity_data_changed(entd : EntityData):
|
func on_centity_data_changed(entd : EntityData):
|
||||||
|
@ -101,7 +101,7 @@ func _notification_sdeath():
|
|||||||
|
|
||||||
|
|
||||||
func set_position(position : Vector3, rotation : Vector3) -> void:
|
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):
|
func _notification_sdamage(what, info):
|
||||||
if what == SpellEnums.NOTIFICATION_DAMAGE_DAMAGE_DEALT:
|
if what == SpellEnums.NOTIFICATION_DAMAGE_DAMAGE_DEALT:
|
||||||
@ -110,11 +110,11 @@ func _notification_sdamage(what, info):
|
|||||||
|
|
||||||
func _notification_cdamage(what, info):
|
func _notification_cdamage(what, info):
|
||||||
if what == SpellEnums.NOTIFICATION_DAMAGE_DAMAGE_DEALT:
|
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):
|
func _notification_cheal(what, info):
|
||||||
if what == SpellEnums.NOTIFICATION_DAMAGE_DAMAGE_DEALT:
|
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:
|
func _notification_sxp_gained(value : int) -> void:
|
||||||
if not ESS.can_character_level_up(slevel):
|
if not ESS.can_character_level_up(slevel):
|
||||||
|
@ -81,7 +81,7 @@ func _process(delta):
|
|||||||
if (get_scale() - target_scale).length() < 0.04:
|
if (get_scale() - target_scale).length() < 0.04:
|
||||||
interpolating = false
|
interpolating = false
|
||||||
|
|
||||||
#var position : Vector2 = entity.get_body().position
|
#var position : Vector2 = entity.body_get().position
|
||||||
var position : Vector2 = Vector2()
|
var position : Vector2 = Vector2()
|
||||||
|
|
||||||
position.x -= (rect_size.x / 2.0) * rect_scale.x
|
position.x -= (rect_size.x / 2.0) * rect_scale.x
|
||||||
|
@ -110,8 +110,8 @@ class_name NetworkedPlayerGD
|
|||||||
## if get_network_master() != 1:
|
## if get_network_master() != 1:
|
||||||
## print(str(get_network_master()) + "npcset")
|
## print(str(get_network_master()) + "npcset")
|
||||||
#
|
#
|
||||||
# get_body().position = pposition
|
# body_get().position = pposition
|
||||||
# get_body().rotation = protation
|
# body_get().rotation = protation
|
||||||
#
|
#
|
||||||
#func _moved() -> void:
|
#func _moved() -> void:
|
||||||
#
|
#
|
||||||
|
@ -51,10 +51,10 @@ func _physics_process(delta):
|
|||||||
update_visibility()
|
update_visibility()
|
||||||
|
|
||||||
func update_visibility() -> void:
|
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)
|
_query.transform = Transform2D(0, body_get().position)
|
||||||
var res : Array = get_body().get_world_2d().direct_space_state.intersect_shape(_query)
|
var res : Array = body_get().get_world_2d().direct_space_state.intersect_shape(_query)
|
||||||
|
|
||||||
#warning-ignore:unassigned_variable
|
#warning-ignore:unassigned_variable
|
||||||
var currenty_sees : Array = Array()
|
var currenty_sees : Array = Array()
|
||||||
@ -107,5 +107,5 @@ func set_position_remote(pos : Vector2) -> void:
|
|||||||
if get_tree().is_network_server():
|
if get_tree().is_network_server():
|
||||||
rpc("set_position_remote", pos)
|
rpc("set_position_remote", pos)
|
||||||
#print(position)
|
#print(position)
|
||||||
get_body().position = pos
|
body_get().position = pos
|
||||||
|
|
||||||
|
@ -215,6 +215,6 @@ func character_selection_changed() -> void:
|
|||||||
return
|
return
|
||||||
|
|
||||||
for e in player_display_container_node.get_children():
|
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()
|
||||||
|
@ -78,7 +78,7 @@ func attack(delta):
|
|||||||
|
|
||||||
if target == null:
|
if target == null:
|
||||||
owner.ai_state = EntityEnums.AI_STATE_REGENERATE
|
owner.ai_state = EntityEnums.AI_STATE_REGENERATE
|
||||||
owner.get_body().target_movement_direction = Vector2()
|
owner.body_get().target_movement_direction = Vector2()
|
||||||
return
|
return
|
||||||
|
|
||||||
var cast : bool = false
|
var cast : bool = false
|
||||||
@ -118,16 +118,16 @@ func attack(delta):
|
|||||||
break
|
break
|
||||||
|
|
||||||
if owner.cast_is_castings():
|
if owner.cast_is_castings():
|
||||||
owner.get_body().target_movement_direction = Vector2()
|
owner.body_get().target_movement_direction = Vector2()
|
||||||
return
|
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()
|
var l = dir.length()
|
||||||
|
|
||||||
if l > 2.5:
|
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):
|
func sort_spells_by_rank(a, b):
|
||||||
if a == null or b == null:
|
if a == null or b == null:
|
||||||
|
@ -92,7 +92,7 @@ func spawn():
|
|||||||
|
|
||||||
func set_terrarin_player():
|
func set_terrarin_player():
|
||||||
pass
|
pass
|
||||||
# terrarin.set_player(player.get_body() as Spatial)
|
# terrarin.set_player(player.body_get() as Spatial)
|
||||||
|
|
||||||
func _on_host_button_clicked():
|
func _on_host_button_clicked():
|
||||||
get_tree().connect("network_peer_connected", self, "_network_peer_connected")
|
get_tree().connect("network_peer_connected", self, "_network_peer_connected")
|
||||||
|
@ -61,8 +61,8 @@ func _cast_starts(info : SpellCastInfo) -> void:
|
|||||||
|
|
||||||
if range_enabled:
|
if range_enabled:
|
||||||
if info.caster != info.target:
|
if info.caster != info.target:
|
||||||
var c : Vector2 = info.caster.get_body().position
|
var c : Vector2 = info.caster.body_get().position
|
||||||
var t : Vector2 = info.target.get_body().position
|
var t : Vector2 = info.target.body_get().position
|
||||||
|
|
||||||
if (c - t).length() > range_range:
|
if (c - t).length() > range_range:
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user