diff --git a/HEADS b/HEADS index b78b2a59..79c2c502 100644 --- a/HEADS +++ b/HEADS @@ -1 +1 @@ -{"engine": {"3.2": "78f0cf40cb4a37b54a27da25349718d1c4b324e5", "master": "8c73e813134001e575b6f59e3b0100471c007410"}, "world_generator": {"master": "97f10512f8832394389e1109154b8af34a2ef2c6"}, "entity_spell_system": {"master": "d110b3368ffabd83fc3d5719589816184cd90ed3"}, "ui_extensions": {"master": "6fe4f69fea8d71043b08d959b8085404c9c4fe47"}, "voxelman": {"master": "19f3c1f8ff34331a2f1bedf260637e415b3df7d0"}, "texture_packer": {"master": "b29b499adf570aa7f85af69ef080ff0d5e04afae"}, "fastnoise": {"master": "d0e3f1c759332cf0d9a5d7e0e71d0b0278310651"}, "mesh_data_resource": {"master": "4ee946963a16bbfdb4dbb5df52134d22aa168041"}, "procedural_animations": {"master": "9ae56c17230ba9c6160777650b2b89eecdc8df9e"}, "ess_data": {"master": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"}, "fast_quadratic_mesh_simplifier": {"master": "f6d3d65cc6ce4dddfc68054164feec1f612ecd1f"}, "props": {"master": "b2bcb5ea6469b19298cd849c1232ddb5ad26f71c"}} \ No newline at end of file +{"engine": {"3.2": "60609ff0ed357a38b58126791f7372c8aa3e446e", "master": "8c73e813134001e575b6f59e3b0100471c007410"}, "world_generator": {"master": "97f10512f8832394389e1109154b8af34a2ef2c6"}, "entity_spell_system": {"master": "90ad406d73ea252bb7fb74a7c9d58979fbbd355c"}, "ui_extensions": {"master": "6fe4f69fea8d71043b08d959b8085404c9c4fe47"}, "voxelman": {"master": "19f3c1f8ff34331a2f1bedf260637e415b3df7d0"}, "texture_packer": {"master": "b29b499adf570aa7f85af69ef080ff0d5e04afae"}, "fastnoise": {"master": "d0e3f1c759332cf0d9a5d7e0e71d0b0278310651"}, "mesh_data_resource": {"master": "4ee946963a16bbfdb4dbb5df52134d22aa168041"}, "procedural_animations": {"master": "9ae56c17230ba9c6160777650b2b89eecdc8df9e"}, "ess_data": {"master": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"}, "fast_quadratic_mesh_simplifier": {"master": "f6d3d65cc6ce4dddfc68054164feec1f612ecd1f"}, "props": {"master": "b2bcb5ea6469b19298cd849c1232ddb5ad26f71c"}} \ No newline at end of file diff --git a/game/player/Body.gd b/game/player/Body.gd index 2aa2e9c4..cdd8253f 100644 --- a/game/player/Body.gd +++ b/game/player/Body.gd @@ -97,10 +97,7 @@ func _ready() -> void: character_skeleton = get_node(character_skeleton_path) entity = get_node("..") entity.set_character_skeleton(character_skeleton) - entity.connect("ccast_started", self, "_con_cast_started") - entity.connect("ccast_failed", self, "_con_cast_failed") - entity.connect("ccast_finished", self, "_con_cast_finished") - entity.connect("cspell_cast_success", self, "_con_spell_cast_success") + entity.connect("notification_ccast", self, "on_notification_ccast") entity.connect("sdied", self, "on_sdied") entity.connect("isc_controlled_changed", self, "on_c_controlled_changed") owner = entity @@ -541,35 +538,33 @@ remote func cset_position(position : Vector3, rotation : Vector3) -> void: rotation = rotation -func _con_cast_started(info): - if anim_node_state_machine != null and not casting_anim: - anim_node_state_machine.travel("casting-loop") - casting_anim = true - animation_run = false - -func _con_cast_failed(info): - if anim_node_state_machine != null and casting_anim: - anim_node_state_machine.travel("idle-loop") - casting_anim = false - - if animation_run: - anim_node_state_machine.travel("run-loop") - -func _con_cast_finished(info): - if anim_node_state_machine != null: - anim_node_state_machine.travel("cast-end") - casting_anim = false - - if animation_run: - anim_node_state_machine.travel("run-loop") +func on_notification_ccast(what : int, info : SpellCastInfo) -> void: + if what == SpellEnums.NOTIFICATION_CAST_STARTED: + if anim_node_state_machine != null and not casting_anim: + anim_node_state_machine.travel("casting-loop") + casting_anim = true + animation_run = false + elif what == SpellEnums.NOTIFICATION_CAST_FAILED: + if anim_node_state_machine != null and casting_anim: + anim_node_state_machine.travel("idle-loop") + casting_anim = false -func _con_spell_cast_success(info): - if anim_node_state_machine != null: - anim_node_state_machine.travel("cast-end") - casting_anim = false - - if animation_run: - anim_node_state_machine.travel("run-loop") + if animation_run: + anim_node_state_machine.travel("run-loop") + elif what == SpellEnums.NOTIFICATION_CAST_FINISHED: + if anim_node_state_machine != null: + anim_node_state_machine.travel("cast-end") + casting_anim = false + + if animation_run: + anim_node_state_machine.travel("run-loop") + elif what == SpellEnums.NOTIFICATION_CAST_SUCCESS: + if anim_node_state_machine != null: + anim_node_state_machine.travel("cast-end") + casting_anim = false + + if animation_run: + anim_node_state_machine.travel("run-loop") func on_c_controlled_changed(val): diff --git a/game/player/Mob.gd b/game/player/Mob.gd index 2d4c4e6f..c9e8cb11 100644 --- a/game/player/Mob.gd +++ b/game/player/Mob.gd @@ -91,17 +91,19 @@ func _son_death(): func set_position(position : Vector3, rotation : Vector3) -> void: get_body().set_position(position, rotation) -func _son_damage_dealt(data): - if ai_state != EntityEnums.AI_STATE_ATTACK and data.dealer != self: - sstart_attack(data.dealer) +func _notification_sdamage(what, info): + if what == SpellEnums.NOTIFICATION_DAMAGE_DAMAGE_DEALT: + if ai_state != EntityEnums.AI_STATE_ATTACK and info.dealer != self: + sstart_attack(info.dealer) + +func _notification_cdamage(what, info): + if what == SpellEnums.NOTIFICATION_DAMAGE_DAMAGE_DEALT: + WorldNumbers.damage(get_body().translation, 1.6, info.damage, info.crit) + +func _notification_cheal(what, info): + if what == SpellEnums.NOTIFICATION_DAMAGE_DAMAGE_DEALT: + WorldNumbers.heal(get_body().translation, 1.6, info.heal, info.crit) -func _con_damage_dealt(info : SpellDamageInfo) -> void: -# if info.dealer == - WorldNumbers.damage(get_body().translation, 1.6, info.damage, info.crit) - -func _con_heal_dealt(info : SpellHealInfo) -> void: - WorldNumbers.heal(get_body().translation, 1.6, info.heal, info.crit) - func _son_xp_gained(value : int) -> void: if not ESS.get_resource_db().get_xp_data().can_character_level_up(gets_character_level()): return diff --git a/game/ui/auraframe/AuraFrame.gd b/game/ui/auraframe/AuraFrame.gd index d719f037..55101f8a 100644 --- a/game/ui/auraframe/AuraFrame.gd +++ b/game/ui/auraframe/AuraFrame.gd @@ -42,34 +42,33 @@ func set_target(pentity : Entity) -> void: pass entity = pentity - entity.connect("caura_added", self, "on_caura_added") - entity.connect("caura_removed", self, "on_caura_removed") + entity.connect("notification_caura", self, "on_notification_caura") -func on_caura_added(aura_data : AuraData) -> void: - var created_node : Node = aura_entry_scene.instance() - - if (not aura_data.aura.debuff): - buff_container_node.add_child(created_node) - created_node.owner = buff_container_node - else: - debuff_container_node.add_child(created_node) - created_node.owner = debuff_container_node - - created_node.set_aura_data(aura_data) - -func on_caura_removed(aura_data : AuraData) -> void: - if (not aura_data.aura.debuff): - for bn in buff_container_node.get_children(): - if bn.get_aura_data() == aura_data: - buff_container_node.remove_child(bn) - bn.queue_free() - return - else: - for bn in debuff_container_node.get_children(): - if bn.get_aura_data() == aura_data: - debuff_container_node.remove_child(bn) - bn.queue_free() - return +func on_notification_caura(what :int, aura_data : AuraData) -> void: + if what == SpellEnums.NOTIFICATION_AURA_ADDED: + var created_node : Node = aura_entry_scene.instance() + + if (not aura_data.aura.debuff): + buff_container_node.add_child(created_node) + created_node.owner = buff_container_node + else: + debuff_container_node.add_child(created_node) + created_node.owner = debuff_container_node + + created_node.set_aura_data(aura_data) + elif what == SpellEnums.NOTIFICATION_AURA_REMOVED: + if (not aura_data.aura.debuff): + for bn in buff_container_node.get_children(): + if bn.get_aura_data() == aura_data: + buff_container_node.remove_child(bn) + bn.queue_free() + return + else: + for bn in debuff_container_node.get_children(): + if bn.get_aura_data() == aura_data: + debuff_container_node.remove_child(bn) + bn.queue_free() + return func set_player(player : Entity) -> void: set_target(player) diff --git a/game/ui/castbar/Castbar.gd b/game/ui/castbar/Castbar.gd index a1abd502..42f2501b 100644 --- a/game/ui/castbar/Castbar.gd +++ b/game/ui/castbar/Castbar.gd @@ -46,44 +46,34 @@ func _process(delta: float) -> void: func set_player(p_player: Entity) -> void: if not player == null: - player.disconnect("ccast_started", self, "_ccast_started") - player.disconnect("ccast_failed", self, "_ccast_failed") - player.disconnect("ccast_finished", self, "_ccast_finished") - player.disconnect("ccast_interrupted", self, "_ccast_interrupted") + player.disconnect("notification_ccast", self, "on_notification_ccast") player = p_player - player.connect("ccast_started", self, "_ccast_started") - player.connect("ccast_failed", self, "_ccast_failed") - player.connect("ccast_finished", self, "_ccast_finished") - player.connect("ccast_interrupted", self, "_ccast_interrupted") + player.connect("notification_ccast", self, "on_notification_ccast") -func _ccast_started(pspell_cast_info: SpellCastInfo) -> void: - set_process(true) - - - spell_cast_info = pspell_cast_info - - label.text = spell_cast_info.spell.get_name() - - progress_bar.value = spell_cast_info.current_cast_time - progress_bar.max_value = spell_cast_info.cast_time - - show() - - -func _ccast_failed(pspell_cast_info: SpellCastInfo) -> void: - set_process(false) - hide() - -func _ccast_finished(pspell_cast_info: SpellCastInfo) -> void: - set_process(false) - hide() - -func _ccast_interrupted(pspell_cast_info: SpellCastInfo) -> void: - set_process(false) - hide() +func on_notification_ccast(what : int, pspell_cast_info: SpellCastInfo) -> void: + if what == SpellEnums.NOTIFICATION_CAST_STARTED: + set_process(true) + + spell_cast_info = pspell_cast_info + + label.text = spell_cast_info.spell.get_name() + + progress_bar.value = spell_cast_info.current_cast_time + progress_bar.max_value = spell_cast_info.cast_time + + show() + elif what == SpellEnums.NOTIFICATION_CAST_FAILED: + set_process(false) + hide() + elif what == SpellEnums.NOTIFICATION_CAST_FINISHED: + set_process(false) + hide() + elif what == SpellEnums.NOTIFICATION_CAST_INTERRUPTED: + set_process(false) + hide() diff --git a/game/ui/unitframes/TargetUnitframe.gd b/game/ui/unitframes/TargetUnitframe.gd index 926e4fe9..8d67d704 100644 --- a/game/ui/unitframes/TargetUnitframe.gd +++ b/game/ui/unitframes/TargetUnitframe.gd @@ -51,8 +51,7 @@ func _ready() -> void: func set_player(p_player : Entity) -> void: if not _player == null and is_instance_valid(_player): _player.getc_resource_index(EntityEnums.ENTITY_RESOURCE_INDEX_HEALTH).disconnect("changed", self, "_on_player_health_changed") - _player.disconnect("caura_added", self, "on_caura_added") - _player.disconnect("caura_removed", self, "on_caura_removed") + _player.disconnect("notification_caura", self, "on_notification_caura") _player.disconnect("cdied", self, "cdied") _player.disconnect("centity_resource_added", self, "centity_resource_added") @@ -76,11 +75,9 @@ func set_player(p_player : Entity) -> void: for index in range(_player.getc_aura_count()): var aura : AuraData = _player.getc_aura(index) - on_caura_added(aura) + on_notification_caura(SpellEnums.NOTIFICATION_AURA_ADDED, aura) - - _player.connect("caura_added", self, "on_caura_added") - _player.connect("caura_removed", self, "on_caura_removed") + _player.connect("notification_caura", self, "on_notification_caura") _player.connect("cdied", self, "cdied", [], CONNECT_DEFERRED) _player.connect("centity_resource_added", self, "centity_resource_added") @@ -119,20 +116,20 @@ func _on_mana_changed(resource: EntityResource) -> void: _resource_text.text = str(resource.current_value) + "/" + str(resource.max_value) -func on_caura_added(aura_data : AuraData) -> void: - var created_node : Node = aura_entry_scene.instance() - - _aura_grid.add_child(created_node) - created_node.owner = _aura_grid - - created_node.set_aura_data(aura_data) - -func on_caura_removed(aura_data : AuraData) -> void: - for bn in _aura_grid.get_children(): - if bn.get_aura_data() == aura_data: - _aura_grid.remove_child(bn) - bn.queue_free() - return +func on_notification_caura(what : int, aura_data : AuraData) -> void: + if what == SpellEnums.NOTIFICATION_AURA_ADDED: + var created_node : Node = aura_entry_scene.instance() + + _aura_grid.add_child(created_node) + created_node.owner = _aura_grid + + created_node.set_aura_data(aura_data) + elif what == SpellEnums.NOTIFICATION_AURA_REMOVED: + for bn in _aura_grid.get_children(): + if bn.get_aura_data() == aura_data: + _aura_grid.remove_child(bn) + bn.queue_free() + return func _on_player_health_changed(health : EntityResource) -> void: if health.max_value == 0: