diff --git a/HEADS b/HEADS index 4e9c430..60271e0 100644 --- a/HEADS +++ b/HEADS @@ -1 +1 @@ -{"engine": "48edf6333029fc961528892af190201197b44c40", "world_generator": "58e38c07bd798a44232ecdfe02db038e3c434239", "entity_spell_system": "e9a7a92fb289ba1927a1b74c27eeb4d776e7a4a1", "ui_extensions": "271dcf89e9afe5cb6350de2f2433c8ebf8aba785", "texture_packer": "604c330188e220c15d10ea5bd545a6fc5aab0132", "fastnoise": "41b7ea05a1f7aa2b8ecddaa1fd739e64d6970f7e", "ess_data": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"} \ No newline at end of file +{"engine": "94658de1ffab02ad2eacbadf44f86c3654e3afcb", "world_generator": "459538d6b94b8c6ce6ece4cb626dabd6ae06fbc8", "entity_spell_system": "413031fb3c88cbede25c929fec85dfc673d36c45", "ui_extensions": "8a81cc53100c5a138fbaf927080410025c64c88e", "texture_packer": "189810d1648cd72e486b357c4523b4eb2a0d71f3", "fastnoise": "41b7ea05a1f7aa2b8ecddaa1fd739e64d6970f7e", "ess_data": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"} \ No newline at end of file diff --git a/game/autoload/EntityDataManager.gd b/game/autoload/EntityDataManager.gd index 169bddf..913c7ae 100644 --- a/game/autoload/EntityDataManager.gd +++ b/game/autoload/EntityDataManager.gd @@ -66,7 +66,7 @@ remote func creceive_spawn_for(data: String, global_name : String, position: Vec entity.name = str(global_name) entity.from_dict(parse_json(data)) - entity.translation = position + entity.get_body().translation = position Logger.info("Player spawned ") @@ -92,7 +92,7 @@ func spawn_networked_player_from_data(data : String, position : Vector2, network entity.from_dict(parse_json(data)) entity.set_network_master(network_owner) - entity.translation = position + entity.get_body().translation = position Logger.info("Player spawned ") @@ -112,7 +112,7 @@ puppet func spawn_owned_player(data : String, position : Vector2) -> void: entity.from_dict(parse_json(data)) entity.name = str(multiplayer.get_network_unique_id()) - entity.translation = position + entity.get_body().translation = position entity.set_network_master(multiplayer.get_network_unique_id()) Logger.info("Player spawned ") @@ -142,7 +142,7 @@ func load_player(file_name : String, position : Vector2, network_owner : int) -> entity.from_dict(load_file(file_name)) - entity.position = position + entity.get_body().position = position # entity.initialize(createinfo) entity.set_network_master(network_owner) @@ -302,7 +302,7 @@ func spawn(createinfo : EntityCreateInfo, networked : bool, position : Vector2, spawn_parent.add_child(entity_node) entity_node.owner = spawn_parent - entity_node.position = position + entity_node.get_body().position = position entity_node.initialize(createinfo) diff --git a/game/autoload/Server.gd b/game/autoload/Server.gd index 3cf18f6..da63bbb 100644 --- a/game/autoload/Server.gd +++ b/game/autoload/Server.gd @@ -216,4 +216,4 @@ func set_terrarin_player(): var terrarin : Spatial = get_node("/root/GameScene/VoxelWorld") - terrarin.set_player(local_player_master.player as Node2D) + terrarin.set_player(local_player_master.player.get_body() as Node2D) diff --git a/game/characters/Character.tscn b/game/characters/Character.tscn index fee7672..70f5f0e 100644 --- a/game/characters/Character.tscn +++ b/game/characters/Character.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=10 format=2] -[ext_resource path="res://player/CharacterSkeleton2D.gd" type="Script" id=1] +[ext_resource path="res://player/CharacterSkeleton2DGD.gd" type="Script" id=1] [ext_resource path="res://characters/CharacterSideModel.tscn" type="PackedScene" id=2] [ext_resource path="res://characters/CharacterFrontModel.tscn" type="PackedScene" id=3] [ext_resource path="res://scripts/item_visuals/CharacterAtlas2D.gd" type="Script" id=4] @@ -45,7 +45,7 @@ HUMANOID_BONES_MAX = 16," texture = ExtResource( 6 ) slots = [ null, SubResource( 1 ), null, null, null, null, null, null, null, null, null, null, null, null, SubResource( 2 ), null ] -[node name="Character" type="CharacterSkeleton"] +[node name="Character" type="CharacterSkeleton2D"] script = ExtResource( 1 ) front_node_path = NodePath("CharacterFrontModel") front_animation_player_path = NodePath("../Character/CharacterFrontModel/AnimationPlayer") diff --git a/game/data/spells/10_aspect_of_scorpions_rank_1.tres b/game/data/spells/10_aspect_of_scorpions_rank_1.tres index 0f84b99..72b41bb 100644 --- a/game/data/spells/10_aspect_of_scorpions_rank_1.tres +++ b/game/data/spells/10_aspect_of_scorpions_rank_1.tres @@ -18,9 +18,8 @@ text_name = "Aspect of Scorpions" text_description = "Range: 26m. Casttime: {3}. Deals 340 to 380 damage every 3 sec, and increases damage taken by 10% for 30 sec." -range = true range_range = 26.0 -cast = true +cast_enabled = true cast_cast_time = 1.2 training_required_spell = ExtResource( 5 ) script = ExtResource( 1 ) diff --git a/game/data/spells/11_aspect_of_wasps_rank_1.tres b/game/data/spells/11_aspect_of_wasps_rank_1.tres index 067426e..71f3c19 100644 --- a/game/data/spells/11_aspect_of_wasps_rank_1.tres +++ b/game/data/spells/11_aspect_of_wasps_rank_1.tres @@ -16,7 +16,6 @@ text_name = "Aspect of Wasps" text_description = "Range: 26m. Instant. Deals 230 to 270 damage every 3 sec, this damage increases over the duration, for 21 sec." -range = true range_range = 26.0 aoe_targetType = 541 aoe_colliderType = 541 diff --git a/game/data/spells/12_aspect_of_wolves_rank_1.tres b/game/data/spells/12_aspect_of_wolves_rank_1.tres index c4d6fd5..5e5ab0c 100644 --- a/game/data/spells/12_aspect_of_wolves_rank_1.tres +++ b/game/data/spells/12_aspect_of_wolves_rank_1.tres @@ -16,7 +16,6 @@ target_aura_applys = [ ExtResource( 3 ) ] text_name = "Aspect of Wolves" text_description = "Range: 26m. Deals 280 to 330 damage every 2 sec, and reduces melee and spell damage by 10% for 22 sec." -range = true range_range = 26.0 aoe_targetType = 1129071960 aoe_colliderType = 1058050193 diff --git a/game/data/spells/13_aspect_of_bees_rank_1.tres b/game/data/spells/13_aspect_of_bees_rank_1.tres index 8651131..0aa25ea 100644 --- a/game/data/spells/13_aspect_of_bees_rank_1.tres +++ b/game/data/spells/13_aspect_of_bees_rank_1.tres @@ -19,7 +19,6 @@ Instant. Cooldown: {2} Deals 460 to 540 damage every 3 sec, healing you for 80% of the damage." cooldown_cooldown = 21.0 -range = true range_range = 26.0 aoe_targetType = -1910718371 aoe_colliderType = -298046312 diff --git a/game/data/spells/14_amplify_pain_rank_1.tres b/game/data/spells/14_amplify_pain_rank_1.tres index 7e11238..502bf2b 100644 --- a/game/data/spells/14_amplify_pain_rank_1.tres +++ b/game/data/spells/14_amplify_pain_rank_1.tres @@ -25,11 +25,8 @@ text_name = "Amplify Pain" text_description = "Range: 26m. Casttime: {3}. Causes your damage over time effects to tick." -range = true range_range = 26.0 -cast = true cast_cast_time = 1.5 -damage = true damage_type = 16 damage_min = 130 damage_max = 150 diff --git a/game/data/spells/16_close_wounds_rank_1.tres b/game/data/spells/16_close_wounds_rank_1.tres index 2b00494..0482ddd 100644 --- a/game/data/spells/16_close_wounds_rank_1.tres +++ b/game/data/spells/16_close_wounds_rank_1.tres @@ -17,7 +17,6 @@ text_name = "Close Wounds" text_description = "Casttime: 2 sec. Cooldown: {2} Heals you for 720 to 780 every 3 sec for 21 sec." -cast = true cast_cast_time = 1.3 aoe_colliderType = -2147479552 script = ExtResource( 1 ) diff --git a/game/data/spells/17_ironbark_rank_1.tres b/game/data/spells/17_ironbark_rank_1.tres index fe4e3c7..cc5db00 100644 --- a/game/data/spells/17_ironbark_rank_1.tres +++ b/game/data/spells/17_ironbark_rank_1.tres @@ -18,7 +18,6 @@ text_description = "Instant. Cooldown: {2} Reduces damage taken by 70%. This spell is not on the global cooldown." cooldown_cooldown = 60.0 -cooldown_global_cooldown = false aoe_targetType = -1910718371 aoe_colliderType = -298046312 script = ExtResource( 1 ) diff --git a/game/data/spells/18_natures_swiftness_rank_1.tres b/game/data/spells/18_natures_swiftness_rank_1.tres index da63fe3..f45de83 100644 --- a/game/data/spells/18_natures_swiftness_rank_1.tres +++ b/game/data/spells/18_natures_swiftness_rank_1.tres @@ -18,7 +18,6 @@ text_description = "Instant. Cooldown: {2} Increases your movement speed by 60% for 6 sec. This spell is not on the global cooldown." cooldown_cooldown = 20.0 -cooldown_global_cooldown = false aoe_targetType = 520 aoe_colliderType = 186459648 script = ExtResource( 3 ) diff --git a/game/data/spells/19_uproot_rank_1.tres b/game/data/spells/19_uproot_rank_1.tres index 19f806b..f6a31f6 100644 --- a/game/data/spells/19_uproot_rank_1.tres +++ b/game/data/spells/19_uproot_rank_1.tres @@ -15,7 +15,6 @@ text_description = "Instant. Cooldown: {2} Roots every enemy around you in a 15m radius for 8 sec. This spell doesn't have diminishing return." cooldown_cooldown = 24.0 -range = true range_range = 15.0 aoe = true aoe_targetType = -572653568 diff --git a/game/data/spells/1_test_spell.tres b/game/data/spells/1_test_spell.tres index db80897..c5082dd 100644 --- a/game/data/spells/1_test_spell.tres +++ b/game/data/spells/1_test_spell.tres @@ -11,7 +11,6 @@ rank = 1 icon = ExtResource( 2 ) needs_target = true text_name = "adadadadadad" -damage = true damage_min = 200 damage_max = 300 aoe_targetType = 1431112251 diff --git a/game/data/spells/20_root_rank_1.tres b/game/data/spells/20_root_rank_1.tres index 20e46d6..443b2ea 100644 --- a/game/data/spells/20_root_rank_1.tres +++ b/game/data/spells/20_root_rank_1.tres @@ -16,8 +16,6 @@ text_description = "Range: 26m. Casttime: 1.5 sec. Cooldown: {2} Roots the target for 8 sec." -range = true -cast = true cast_cast_time = 1.4 aoe_targetType = 8 aoe_colliderType = 537722880 diff --git a/game/data/spells/21_strength_of_nature_rank_1.tres b/game/data/spells/21_strength_of_nature_rank_1.tres index d140825..9959c76 100644 --- a/game/data/spells/21_strength_of_nature_rank_1.tres +++ b/game/data/spells/21_strength_of_nature_rank_1.tres @@ -17,7 +17,6 @@ text_description = "Instant. Cooldown: {2} Heals you for 6700 to 7000." cooldown_cooldown = 150.0 -heal = true heal_min = 6700 heal_max = 7000 aoe_targetType = 5 diff --git a/game/data/spells/25_inner_will.tres b/game/data/spells/25_inner_will.tres index 7c3cb77..586ed72 100644 --- a/game/data/spells/25_inner_will.tres +++ b/game/data/spells/25_inner_will.tres @@ -14,7 +14,6 @@ text_name = "Inner Will" text_description = "Cooldown: 1.5 min. Removes any movement impairing effects, stuns, and effects which makes you lose control of your character. This spell is not on the global cooldown." cooldown_cooldown = 90.0 -cooldown_global_cooldown = false aoe_targetType = 7 aoe_colliderType = 480 script = ExtResource( 1 ) diff --git a/game/data/spells/27_aspect_of_scorpions.tres b/game/data/spells/27_aspect_of_scorpions.tres index 39a504b..a66710e 100644 --- a/game/data/spells/27_aspect_of_scorpions.tres +++ b/game/data/spells/27_aspect_of_scorpions.tres @@ -17,9 +17,8 @@ text_name = "Aspect of Scorpions" text_description = "Range: 26m. Casttime: {3}. Deals 340 to 380 damage every 3 sec, and increases damage taken by 10% for 30 sec." -range = true range_range = 26.0 -cast = true +cast_enabled = true cast_cast_time = 1.2 spell_cooldown_mainpulation_data_count = -1 script = ExtResource( 2 ) diff --git a/game/data/spells/28_aspectofwasps.tres b/game/data/spells/28_aspectofwasps.tres index 5dbed01..6f09f05 100644 --- a/game/data/spells/28_aspectofwasps.tres +++ b/game/data/spells/28_aspectofwasps.tres @@ -15,7 +15,6 @@ text_name = "Aspect of Wasps" text_description = "Range: 26m. Instant. Deals 230 to 270 damage every 3 sec, this damage increases over the duration, for 21 sec." -range = true range_range = 26.0 aoe_targetType = 541 aoe_colliderType = 541 diff --git a/game/data/spells/29_aspect_of_wolves.tres b/game/data/spells/29_aspect_of_wolves.tres index 325e2b4..56bea62 100644 --- a/game/data/spells/29_aspect_of_wolves.tres +++ b/game/data/spells/29_aspect_of_wolves.tres @@ -15,7 +15,6 @@ target_aura_applys = [ ExtResource( 2 ) ] text_name = "Aspect of Wolves" text_description = "Range: 26m. Deals 280 to 330 damage every 2 sec, and reduces melee and spell damage by 10% for 22 sec." -range = true range_range = 26.0 aoe_targetType = 1129071960 aoe_colliderType = 1058050193 diff --git a/game/data/spells/30_aspect_of_bees.tres b/game/data/spells/30_aspect_of_bees.tres index 6d75c09..54f0891 100644 --- a/game/data/spells/30_aspect_of_bees.tres +++ b/game/data/spells/30_aspect_of_bees.tres @@ -19,7 +19,6 @@ Instant. Cooldown: {2} Deals 460 to 540 damage every 3 sec, healing you for 80% of the damage." cooldown_cooldown = 21.0 -range = true range_range = 26.0 aoe_targetType = -1910718371 aoe_colliderType = -298046312 diff --git a/game/data/spells/31_overload.tres b/game/data/spells/31_overload.tres index e000ed9..166d4c2 100644 --- a/game/data/spells/31_overload.tres +++ b/game/data/spells/31_overload.tres @@ -26,11 +26,8 @@ text_name = "Overload" text_description = "Range: 26m. Channeled. Free. Causes your dots to deal 10% more damage." -range = true range_range = 26.0 -cast = true cast_cast_time = 1.5 -damage = true damage_type = 16 damage_min = 130 damage_max = 150 diff --git a/game/ess_data.json b/game/ess_data.json index 9fe7f6b..d29de32 100644 --- a/game/ess_data.json +++ b/game/ess_data.json @@ -148,7 +148,7 @@ { "folder":"res://data/models/", "name":"Character Models", - "type":"CharacterSkeleton" + "type":"CharacterSkeleton2D" }, { "folder":"res://data/fonts/", diff --git a/game/networking/SpawnPoint.gd b/game/networking/SpawnPoint.gd index f7fe006..c8784f3 100644 --- a/game/networking/SpawnPoint.gd +++ b/game/networking/SpawnPoint.gd @@ -91,7 +91,7 @@ func spawn(): # Entities.spawn_mob(1, 50, Vector3(76, 6, 54)) func set_terrarin_player(): - terrarin.set_player(player as Node2D) + terrarin.set_player(player.get_body() as Node2D) func _on_host_button_clicked(): get_tree().connect("network_peer_connected", self, "_network_peer_connected") diff --git a/game/player/CharacterSkeleton2D.gd b/game/player/CharacterSkeleton2DGD.gd similarity index 98% rename from game/player/CharacterSkeleton2D.gd rename to game/player/CharacterSkeleton2DGD.gd index 05fcfda..9836cca 100644 --- a/game/player/CharacterSkeleton2D.gd +++ b/game/player/CharacterSkeleton2DGD.gd @@ -1,5 +1,5 @@ -extends CharacterSkeleton -class_name CharacterSkeleton2D +extends CharacterSkeleton2D +class_name CharacterSkeleton2DGD # Copyright Péter Magyar relintai@gmail.com # MIT License, functionality from this class needs to be protable to the entity spell system diff --git a/game/player/DisplayEntity.gd b/game/player/DisplayEntity.gd index 4710080..f52a5a5 100644 --- a/game/player/DisplayEntity.gd +++ b/game/player/DisplayEntity.gd @@ -175,9 +175,9 @@ func process_movement(delta : float) -> void: if get_tree().network_peer: if get_tree().is_network_server(): - rset_position(position, rotation) + rset_position(get_body().position, get_body().rotation) else: - rpc("set_position", position, rotation) + rpc("set_position", get_body().position, get_body().rotation) func _input(event: InputEvent) -> void: if not cursor_grabbed: @@ -272,7 +272,7 @@ func target(position : Vector2): var from = camera.project_ray_origin(position) var to = from + camera.project_ray_normal(position) * ray_length - var space_state = get_world_2d().direct_space_state + var space_state = get_body().get_world_2d().direct_space_state var result = space_state.intersect_ray(from, to, [], 2) if result: @@ -291,7 +291,7 @@ func cmouseover(event): var from = camera.project_ray_origin(event.position) var to = from + camera.project_ray_normal(event.position) * ray_length - var space_state = get_world_2d().direct_space_state + var space_state = get_body().get_world_2d().direct_space_state var result = space_state.intersect_ray(from, to, [], 2) if result: diff --git a/game/player/DisplayPlayer.tscn b/game/player/DisplayPlayer.tscn index f736773..a99ddf4 100644 --- a/game/player/DisplayPlayer.tscn +++ b/game/player/DisplayPlayer.tscn @@ -5,20 +5,21 @@ [node name="DisplayPlayer" type="Entity" groups=[ "players", ]] -collision_layer = 3 -collision_mask = 3 -character_skeleton_path = NodePath("Rotation_Helper/Model/character") +body_path = NodePath("KinematicBody2D") +character_skeleton_path = NodePath("KinematicBody2D/Rotation_Helper/Model") sseed = 9240987 cseed = 9240987 script = ExtResource( 1 ) -[node name="Rotation_Helper" type="Spatial" parent="."] +[node name="KinematicBody2D" type="KinematicBody2D" parent="."] + +[node name="Rotation_Helper" type="Spatial" parent="KinematicBody2D"] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.960532, 0 ) __meta__ = { "_editor_description_": "" } -[node name="Model" type="Spatial" parent="Rotation_Helper"] +[node name="Model" type="Spatial" parent="KinematicBody2D/Rotation_Helper"] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.875205, 0 ) __meta__ = { "_editor_description_": "" diff --git a/game/player/Mob.gd b/game/player/Mob.gd index f7d8154..a9a972c 100644 --- a/game/player/Mob.gd +++ b/game/player/Mob.gd @@ -78,17 +78,17 @@ func _process(delta : float) -> void: frame = 0 # print(get_tree().root.get_visible_rect()) - var vpos : Vector2 = -get_tree().root.canvas_transform.get_origin() - position + var vpos : Vector2 = -get_tree().root.canvas_transform.get_origin() - get_body().position var l : float = vpos.length_squared() var rs : float = get_tree().root.size.x * get_tree().root.size.x if l < rs: - if not visible: - show() + if not get_body().visible: + get_body().show() set_physics_process(true) else: - if visible: - hide() + if get_body().visible: + get_body().hide() set_physics_process(false) @@ -105,16 +105,16 @@ func _physics_process(delta : float) -> void: process_movement(delta) func move_along_path(distance : float) -> void: - var start_point : = position + var start_point : Vector2 = get_body().position for i in range(path.size()): var distance_to_next : = start_point.distance_to(path[0]) if distance <= distance_to_next and distance >= 0.0: - position = start_point.linear_interpolate(path[0], distance / distance_to_next) + get_body().position = start_point.linear_interpolate(path[0], distance / distance_to_next) break elif distance <= 0.0: - position = path[0] + get_body().position = path[0] follow_path = false break @@ -181,9 +181,9 @@ func process_movement(delta : float) -> void: return vel = hvel - vel = move_and_slide(vel) + vel = get_body().move_and_slide(vel) - sset_position(position, rotation) + sset_position(get_body().position, get_body().rotation) func sstart_attack(entity : Entity) -> void: @@ -244,10 +244,10 @@ func _son_damage_dealt(data): func _con_damage_dealt(info : SpellDamageInfo) -> void: # if info.dealer == - WorldNumbers.damage(position, 90, info.damage, info.crit) + WorldNumbers.damage(get_body().position, 90, info.damage, info.crit) func _con_heal_dealt(info : SpellHealInfo) -> void: - WorldNumbers.heal(position, 90, info.heal, info.crit) + WorldNumbers.heal(get_body().position, 90, info.heal, info.crit) func _moved() -> void: if sis_casting(): @@ -328,6 +328,6 @@ func sset_position(pposition : Vector2, protation : float) -> void: vrpc("cset_position", pposition, protation) remote func cset_position(pposition : Vector2, protation : float) -> void: - position = pposition - rotation = protation + get_body().position = pposition + get_body().rotation = protation diff --git a/game/player/Mob.tscn b/game/player/Mob.tscn index 626bc00..091bb53 100644 --- a/game/player/Mob.tscn +++ b/game/player/Mob.tscn @@ -10,12 +10,15 @@ radius = 20.0 [node name="Mob" type="Entity" groups=[ "mobs", ]] -character_skeleton_path = NodePath("Character") +body_path = NodePath("KinematicBody2D") +character_skeleton_path = NodePath("KinematicBody2D/Character") script = ExtResource( 2 ) -[node name="NamePlate" parent="." instance=ExtResource( 3 )] +[node name="KinematicBody2D" type="KinematicBody2D" parent="."] -[node name="Character" parent="." instance=ExtResource( 1 )] - -[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +[node name="CollisionShape2D" type="CollisionShape2D" parent="KinematicBody2D"] shape = SubResource( 1 ) + +[node name="Character" parent="KinematicBody2D" instance=ExtResource( 1 )] + +[node name="NamePlate" parent="KinematicBody2D" instance=ExtResource( 3 )] diff --git a/game/player/NamePlate.gd b/game/player/NamePlate.gd index f7746ec..ef71654 100644 --- a/game/player/NamePlate.gd +++ b/game/player/NamePlate.gd @@ -51,7 +51,7 @@ func _ready(): health_bar = get_node(health_bar_path) as TextureProgress health_bar_label = get_node(health_bar_label_path) as Label - entity = get_node("..") as Entity + entity = get_node("../..") as Entity health = entity.get_health() health.connect("c_changed", self, "c_health_changed") @@ -84,7 +84,7 @@ func _process(delta): interpolating = false - var position : Vector2 = entity.position + var position : Vector2 = entity.get_body().position position = get_global_transform().xform_inv(position) diff --git a/game/player/NetworkedPlayer.gd b/game/player/NetworkedPlayer.gd index db39f00..e9c0349 100644 --- a/game/player/NetworkedPlayer.gd +++ b/game/player/NetworkedPlayer.gd @@ -110,8 +110,8 @@ remote func cset_position(pposition : Vector2, protation : float) -> void: # if get_network_master() != 1: # print(str(get_network_master()) + "npcset") - position = pposition - rotation = protation + get_body().position = pposition + get_body().rotation = protation func _moved() -> void: if sis_casting(): diff --git a/game/player/NetworkedPlayer.tscn b/game/player/NetworkedPlayer.tscn index e6061a2..a65f0c9 100644 --- a/game/player/NetworkedPlayer.tscn +++ b/game/player/NetworkedPlayer.tscn @@ -8,14 +8,15 @@ radius = 20.0 [node name="NetworkedPlayer" type="Entity"] -collision_layer = 3 -collision_mask = 3 -character_skeleton_path = NodePath("Character") +body_path = NodePath("KinematicBody2D") +character_skeleton_path = NodePath("KinematicBody2D/Character") script = ExtResource( 1 ) -[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +[node name="NamePlate" parent="." instance=ExtResource( 3 )] + +[node name="KinematicBody2D" type="KinematicBody2D" parent="."] + +[node name="CollisionShape2D" type="CollisionShape2D" parent="KinematicBody2D"] shape = SubResource( 1 ) -[node name="Character" parent="." instance=ExtResource( 2 )] - -[node name="NamePlate" parent="." instance=ExtResource( 3 )] +[node name="Character" parent="KinematicBody2D" instance=ExtResource( 2 )] diff --git a/game/player/Player.gd b/game/player/Player.gd index 29761ed..2ea305e 100644 --- a/game/player/Player.gd +++ b/game/player/Player.gd @@ -140,13 +140,13 @@ func process_movement(delta : float) -> void: hvel = hvel.linear_interpolate(target, accel*delta) vel = hvel - vel = move_and_slide(vel) + vel = get_body().move_and_slide(vel) if multiplayer.has_network_peer(): if not multiplayer.is_network_server(): - rpc_id(1, "sset_position", position) + rpc_id(1, "sset_position", get_body().position) else: - sset_position(position) + sset_position(get_body().position) func _input(event: InputEvent) -> void: if not cursor_grabbed: @@ -189,7 +189,7 @@ func _unhandled_input(event: InputEvent) -> void: mouse_left_down = event.pressed if mouse_left_down: - mouse_dir = (event.position - get_viewport_rect().size / 2).normalized() + mouse_dir = (event.position - get_body().get_viewport_rect().size / 2).normalized() else: mouse_dir = Vector2() @@ -210,18 +210,18 @@ func _unhandled_input(event: InputEvent) -> void: target(event.position) if event is InputEventMouseMotion and mouse_left_down and event.device != -1: - mouse_dir = (event.position - get_viewport_rect().size / 2).normalized() + mouse_dir = (event.position - get_body().get_viewport_rect().size / 2).normalized() func target(position : Vector2): - var space_state = get_world_2d().direct_space_state - var results = space_state.intersect_point(world.make_canvas_position_local(position), 32, [], get_collision_layer()) + var space_state = get_body().get_world_2d().direct_space_state + var results = space_state.intersect_point(world.make_canvas_position_local(position), 32, [], get_body().get_collision_layer()) #var results = space_state.intersect_point(position, 32, [], 2) if results: for result in results: - if result.collider and result.collider is Entity: - crequest_target_change((result.collider as Node).get_path()) + if result.collider and result.collider.owner is Entity: + crequest_target_change((result.collider.owner as Node).get_path()) return crequest_target_change(NodePath()) @@ -230,14 +230,14 @@ func target(position : Vector2): func cmouseover(event): - var space_state = get_world_2d().direct_space_state - var results = space_state.intersect_point(world.make_canvas_position_local(position), 32, [], get_collision_layer()) + var space_state = get_body().get_world_2d().direct_space_state + var results = space_state.intersect_point(world.make_canvas_position_local(get_body().position), 32, [], get_body().get_collision_layer()) #var results = space_state.intersect_point(position, 32, [], 2) if results: for result in results: - if result.collider and result.collider is Entity: - var mo : Entity = result.collider as Entity + if result.collider and result.collider.owner is Entity: + var mo : Entity = result.collider.owner as Entity if last_mouse_over != null and last_mouse_over != mo: if is_instance_valid(last_mouse_over): @@ -276,7 +276,7 @@ remote func cset_position(pposition : Vector2) -> void: if get_network_master() != 1: print(str(get_network_master()) + " pcset") - position = pposition + get_body().position = pposition func _moved() -> void: if sis_casting(): diff --git a/game/player/Player.tscn b/game/player/Player.tscn index 4127a79..57093fe 100644 --- a/game/player/Player.tscn +++ b/game/player/Player.tscn @@ -10,16 +10,19 @@ radius = 8.0 [node name="Player" type="Entity" groups=[ "players", ]] -character_skeleton_path = NodePath("Character") +body_path = NodePath("KinematicBody2D") +character_skeleton_path = NodePath("KinematicBody2D/Character") script = ExtResource( 2 ) -[node name="CollisionShape2D" type="CollisionShape2D" parent="."] -shape = SubResource( 1 ) - -[node name="Camera" type="Camera2D" parent="."] -current = true - [node name="GUILayer" parent="." instance=ExtResource( 3 )] -[node name="Character" parent="." instance=ExtResource( 1 )] +[node name="KinematicBody2D" type="KinematicBody2D" parent="."] + +[node name="Character" parent="KinematicBody2D" instance=ExtResource( 1 )] + +[node name="CollisionShape2D" type="CollisionShape2D" parent="KinematicBody2D"] +shape = SubResource( 1 ) + +[node name="Camera" type="Camera2D" parent="KinematicBody2D"] +current = true [connection signal="onc_open_loot_winow_request" from="." to="GUILayer" method="_on_Player_onc_open_loot_winow_request"] diff --git a/game/player/PlayerGDBase.gd b/game/player/PlayerGDBase.gd index cd84bd5..08ba1c4 100644 --- a/game/player/PlayerGDBase.gd +++ b/game/player/PlayerGDBase.gd @@ -49,10 +49,10 @@ func _physics_process(delta): update_visibility() func update_visibility() -> void: - _query.collision_layer = get_collision_layer() + _query.collision_layer = get_body().get_collision_layer() - _query.transform = Transform2D(0, position) - var res : Array = get_world_2d().direct_space_state.intersect_shape(_query) + _query.transform = Transform2D(0, get_body().position) + var res : Array = get_body().get_world_2d().direct_space_state.intersect_shape(_query) #warning-ignore:unassigned_variable var currenty_sees : Array = Array() @@ -104,6 +104,6 @@ func update_visibility() -> void: remote func set_position_remote(pos : Vector2) -> void: if get_tree().is_network_server(): rpc("set_position_remote", pos) - print(position) - position = pos + #print(position) + get_body().position = pos diff --git a/game/project.godot b/game/project.godot index a5a85dd..05778d5 100644 --- a/game/project.godot +++ b/game/project.godot @@ -29,10 +29,10 @@ _global_script_classes=[ { "language": "GDScript", "path": "res://player/CharacterSkeletonAttachPoint.gd" }, { -"base": "CharacterSkeleton", -"class": "CharacterSkeleton2D", +"base": "CharacterSkeleton2D", +"class": "CharacterSkeleton2DGD", "language": "GDScript", -"path": "res://player/CharacterSkeleton2D.gd" +"path": "res://player/CharacterSkeleton2DGD.gd" }, { "base": "Entity", "class": "DisplayPlayerGD", @@ -129,7 +129,7 @@ _global_script_class_icons={ "CharacterAtlas2D": "", "CharacterAtlasEntry2D": "", "CharacterSkeketonAttachPoint": "", -"CharacterSkeleton2D": "", +"CharacterSkeleton2DGD": "", "DisplayPlayerGD": "", "EntityAIGD": "", "EntityDataGD": "", diff --git a/game/scripts/ai/EntityAIGD.gd b/game/scripts/ai/EntityAIGD.gd index fbb9abf..ed91279 100644 --- a/game/scripts/ai/EntityAIGD.gd +++ b/game/scripts/ai/EntityAIGD.gd @@ -117,7 +117,7 @@ func attack(delta): owner.target_movement_direction = Vector2() return - var dir : Vector2 = target.position - owner.position + var dir : Vector2 = target.get_body().position - owner.get_body().position owner.target_movement_direction = dir diff --git a/game/scripts/item_visuals/CharacterAtlasEntry2D.gd b/game/scripts/item_visuals/CharacterAtlasEntry2D.gd index 357d805..cd0cf99 100644 --- a/game/scripts/item_visuals/CharacterAtlasEntry2D.gd +++ b/game/scripts/item_visuals/CharacterAtlasEntry2D.gd @@ -27,13 +27,13 @@ export(Rect2) var right_rect : Rect2 export(Rect2) var left_rect : Rect2 func get_index(facing : int) -> Rect2: - if facing == CharacterSkeleton2D.CharacterFacing.FACING_FRONT: + if facing == CharacterSkeleton2DGD.CharacterFacing.FACING_FRONT: return front_rect - if facing == CharacterSkeleton2D.CharacterFacing.FACING_BACK: + if facing == CharacterSkeleton2DGD.CharacterFacing.FACING_BACK: return back_rect - if facing == CharacterSkeleton2D.CharacterFacing.FACING_RIGHT: + if facing == CharacterSkeleton2DGD.CharacterFacing.FACING_RIGHT: return right_rect - if facing == CharacterSkeleton2D.CharacterFacing.FACING_LEFT: + if facing == CharacterSkeleton2DGD.CharacterFacing.FACING_LEFT: return left_rect return front_rect diff --git a/game/scripts/spells/gd_spell_script.gd b/game/scripts/spells/gd_spell_script.gd index 57c99a5..13e60c9 100644 --- a/game/scripts/spells/gd_spell_script.gd +++ b/game/scripts/spells/gd_spell_script.gd @@ -25,13 +25,13 @@ func _sstart_casting(info : SpellCastInfo) -> void: if info.caster.sis_casting(): return - if info.spell.cooldown_global_cooldown and info.caster.gets_has_global_cooldown() or info.caster.hass_category_cooldown(spell_type) or info.caster.hass_cooldown(id): + if cooldown_global_cooldown_enabled and info.caster.gets_has_global_cooldown() or info.caster.hass_category_cooldown(spell_type) or info.caster.hass_cooldown(id): return if !info.caster.hass_spell(self): return - if cast: + if cast_enabled: info.caster.sstart_casting(info) return @@ -102,7 +102,7 @@ func handle_effect(info : SpellCastInfo) -> void: elif target_type == SPELL_TARGET_TYPE_SELF: info.target = info.caster - if damage and info.target: + if damage_enabled and info.target: var sdi : SpellDamageInfo = SpellDamageInfo.new() sdi.damage_source = self @@ -149,7 +149,7 @@ func handle_cooldown(info : SpellCastInfo) -> void: info.caster.adds_cooldown(id, cooldown_cooldown) func handle_gcd(info : SpellCastInfo) -> void: - if cooldown_global_cooldown and cast_cast_time < 0.01: + if cooldown_global_cooldown_enabled and cast_cast_time < 0.01: info.caster.sstart_global_cooldown(info.caster.get_gcd().scurrent) func add_spell_cast_effect(info : SpellCastInfo) -> void: diff --git a/game/ui/actionbars/ActionBarEntry.gd b/game/ui/actionbars/ActionBarEntry.gd index 6cf86d5..f81f79c 100644 --- a/game/ui/actionbars/ActionBarEntry.gd +++ b/game/ui/actionbars/ActionBarEntry.gd @@ -161,7 +161,7 @@ func setup_icon() -> void: ThemeAtlas.unref_texture(icon_rect.texture) icon_rect.texture = null - var spell = Entities.get_spell(button_entry.item_id) + var spell : Spell = Entities.get_spell(button_entry.item_id) as Spell if spell.icon != null: icon_rect.texture = ThemeAtlas.add_texture(spell.icon) @@ -169,7 +169,7 @@ func setup_icon() -> void: spell_id = spell.id spell_type = spell.spell_type - has_gcd = spell.cooldown_global_cooldown + has_gcd = spell.cooldown_global_cooldown_enabled func _on_button_pressed() -> void: if (button_entry.type == ActionBarButtonEntry.ACTION_BAR_BUTTON_ENTRY_TYPE_SPELL):