diff --git a/HEADS b/HEADS index 4a2e9571..aeee0c07 100644 --- a/HEADS +++ b/HEADS @@ -1 +1 @@ -{"engine": "27b74f42b4fd6b6e56b7a4924697d8881488bee1", "world_generator": "63da1cc4a2084d1c2eb9430e436be22711e964f2", "entity_spell_system": "4a166becf4d9179fe85931bef678c967d5141651", "ui_extensions": "8a81cc53100c5a138fbaf927080410025c64c88e", "voxelman": "9d48a0758df7ef8913ef98ed2e37f3b6dba424da", "texture_packer": "fbf5d0d634ab04db049099b814d2d58e2743f5b2", "fastnoise": "41b7ea05a1f7aa2b8ecddaa1fd739e64d6970f7e", "entity-spell-system-addons": "d60e746b158d3ebf9d2ea306af1dd24bcae49be5", "mesh_data_resource": "3fedb4c8534af36d89a1a1a34a6b5ed4d333927a", "ess_data": "3bd637fdd3304b64a18287a49a6b7387acf2f5de", "prop_tool": "df438053ebc900966f8f842fc65f0264f1271d49"} \ No newline at end of file +{"engine": "71d372a8ab1ee972326f8bd333f510330b7b7204", "world_generator": "63da1cc4a2084d1c2eb9430e436be22711e964f2", "entity_spell_system": "6aa2df4647a4a221ab7e1c1735c55ef22f7e98f5", "ui_extensions": "8a81cc53100c5a138fbaf927080410025c64c88e", "voxelman": "9d48a0758df7ef8913ef98ed2e37f3b6dba424da", "texture_packer": "fbf5d0d634ab04db049099b814d2d58e2743f5b2", "fastnoise": "41b7ea05a1f7aa2b8ecddaa1fd739e64d6970f7e", "entity-spell-system-addons": "d60e746b158d3ebf9d2ea306af1dd24bcae49be5", "mesh_data_resource": "3fedb4c8534af36d89a1a1a34a6b5ed4d333927a", "ess_data": "3bd637fdd3304b64a18287a49a6b7387acf2f5de", "prop_tool": "df438053ebc900966f8f842fc65f0264f1271d49"} \ No newline at end of file diff --git a/game/autoload/EntityDataManager.gd b/game/autoload/EntityDataManager.gd index 10044723..b3b4466e 100644 --- a/game/autoload/EntityDataManager.gd +++ b/game/autoload/EntityDataManager.gd @@ -142,7 +142,7 @@ func load_player(file_name : String, position : Vector3, network_owner : int) -> entity.from_dict(load_file(file_name)) - entity.translation = position + entity.get_node(entity.get_body_path()).translation = position # entity.initialize(createinfo) entity.set_network_master(network_owner) @@ -302,7 +302,7 @@ func spawn(createinfo : EntityCreateInfo, networked : bool, position : Vector3, spawn_parent.add_child(entity_node) entity_node.owner = spawn_parent - entity_node.translation = position + entity_node.get_body().translation = position entity_node.initialize(createinfo) diff --git a/game/autoload/Server.gd b/game/autoload/Server.gd index b9a141ff..6a8c1b88 100644 --- a/game/autoload/Server.gd +++ b/game/autoload/Server.gd @@ -216,4 +216,4 @@ func set_terrarin_player(): var terrarin : VoxelWorld = get_node("/root/GameScene/VoxelWorld") - terrarin.set_player(local_player_master.player as Spatial) + terrarin.set_player(local_player_master.player.get_body() as Spatial) 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 0f84b999..72b41bb7 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 067426ee..71f3c19a 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 c4d6fd55..5e5ab0cb 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 8651131d..0aa25ea6 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 ee41e033..68c03730 100644 --- a/game/data/spells/14_amplify_pain_rank_1.tres +++ b/game/data/spells/14_amplify_pain_rank_1.tres @@ -27,11 +27,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 2b00494b..0482ddd4 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 fe4e3c73..cc5db001 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 da63fe34..f45de83f 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 19f806b9..f6a31f6f 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 db80897a..c5082dd6 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 20e46d6d..443b2ead 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 d140825f..9959c769 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 7c3cb772..586ed724 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 39a504b9..a66710e2 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 5dbed018..6f09f057 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 325e2b46..56bea62b 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 6d75c094..54f0891e 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 5494a899..275bffd5 100644 --- a/game/data/spells/31_overload.tres +++ b/game/data/spells/31_overload.tres @@ -27,11 +27,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/player/CameraPivot.gd b/game/player/CameraPivot.gd index 587f4fca..7187e895 100644 --- a/game/player/CameraPivot.gd +++ b/game/player/CameraPivot.gd @@ -37,7 +37,7 @@ func _ready() -> void: camera.translation.z = target_camera_distance - player = get_node("..") + player = get_node("../..") as Entity set_physics_process(true) @@ -46,7 +46,7 @@ func _physics_process(delta): var space_state = get_world().direct_space_state - var result : Dictionary = space_state.intersect_ray(pos, to_global(Vector3(0, 0, target_camera_distance)), [player], player.collision_mask) + var result : Dictionary = space_state.intersect_ray(pos, to_global(Vector3(0, 0, target_camera_distance)), [ player.get_body() ], player.get_body().collision_mask) if result: camera_distance = (result.position - pos).length() - 0.2 diff --git a/game/player/DisplayEntity.gd b/game/player/DisplayEntity.gd index ba1786ab..3be87419 100644 --- a/game/player/DisplayEntity.gd +++ b/game/player/DisplayEntity.gd @@ -171,13 +171,13 @@ func process_movement(delta : float) -> void: hvel = hvel.linear_interpolate(target, accel * delta) as Vector3 vel.x = hvel.x vel.z = hvel.z - vel = move_and_slide(vel, Vector3(0,1,0), false, 4, deg2rad(MAX_SLOPE_ANGLE)) + vel = get_body().move_and_slide(vel, Vector3(0,1,0), false, 4, deg2rad(MAX_SLOPE_ANGLE)) if get_tree().network_peer: if get_tree().is_network_server(): - set_position(translation, rotation) + set_position(get_body().translation, get_body().rotation) else: - rpc("set_position", translation, rotation) + rpc("set_position", get_body().translation, get_body().rotation) func _input(event: InputEvent) -> void: if not cursor_grabbed: @@ -285,17 +285,16 @@ func rotate_delta(x_delta : float) -> void: while y_rot < 0: y_rot += 360 - rotation_degrees = Vector3(0.0, y_rot, 0.0) + get_body().rotation_degrees = Vector3(0.0, y_rot, 0.0) 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().direct_space_state + var space_state = get_body().get_world().direct_space_state var result = space_state.intersect_ray(from, to, [], 2) if result: - print(result) if result.collider and result.collider is Entity: var ent : Entity = result.collider as Entity @@ -310,7 +309,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().direct_space_state + var space_state = get_body().get_world().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 78e5dac5..64b0a775 100644 --- a/game/player/DisplayPlayer.tscn +++ b/game/player/DisplayPlayer.tscn @@ -1,30 +1,38 @@ -[gd_scene load_steps=3 format=2] +[gd_scene load_steps=4 format=2] [ext_resource path="res://player/DisplayPlayer.gd" type="Script" id=1] [ext_resource path="res://data/models/armature_model_orig_v2.tscn" type="PackedScene" id=2] +[ext_resource path="res://player/EntityModel.gd" type="Script" id=3] [node name="DisplayPlayer" type="Entity" groups=[ "players", ]] -input_ray_pickable = false -collision_layer = 3 -collision_mask = 3 -character_skeleton_path = NodePath("Rotation_Helper/Model/character") +body_path = NodePath("DisplayPlayer") +character_skeleton_path = NodePath("DisplayPlayer/Rotation_Helper/Model/character") sseed = 9240987 cseed = 9240987 script = ExtResource( 1 ) -[node name="Rotation_Helper" type="Spatial" parent="."] +[node name="DisplayPlayer" type="KinematicBody" parent="."] +script = ExtResource( 3 ) + +[node name="Rotation_Helper" type="Spatial" parent="DisplayPlayer"] 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="DisplayPlayer/Rotation_Helper"] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.875205, 0 ) __meta__ = { "_editor_description_": "" } -[node name="character" parent="Rotation_Helper/Model" instance=ExtResource( 2 )] +[node name="character" parent="DisplayPlayer/Rotation_Helper/Model" instance=ExtResource( 2 )] use_threads = false +mesh_instance_path = NodePath("../../../../DisplayPlayer/Rotation_Helper/Model/character/armature/Armature/Skeleton/MeshInstance") +skeleton_path = NodePath("../../../../DisplayPlayer/Rotation_Helper/Model/character/armature/Armature/Skeleton") +left_hand_attach_point_path = NodePath("../../../../DisplayPlayer/Rotation_Helper/Model/character/armature/Armature/Skeleton/LeftHandAttachment/LeftHandAP") +right_hand_attach_point_path = NodePath("../../../../DisplayPlayer/Rotation_Helper/Model/character/armature/Armature/Skeleton/RightHandAttachment/RightHandAP") +torso_attach_point_path = NodePath("../../../../DisplayPlayer/Rotation_Helper/Model/character/armature/Armature/Skeleton/NeckAttachment/TorsoAP") +root_attach_point_path = NodePath("../../../../DisplayPlayer/Rotation_Helper/Model/character/armature/Armature/Skeleton/RootAttachment/RootAP") diff --git a/game/player/EntityModel.gd b/game/player/EntityModel.gd new file mode 100644 index 00000000..80e4b364 --- /dev/null +++ b/game/player/EntityModel.gd @@ -0,0 +1,13 @@ +extends KinematicBody + +func _enter_tree(): + var spat : Node = get_parent() + + while spat != null: + if spat is Spatial: + transform *= (spat as Spatial).transform + + spat = spat.get_parent() + + + diff --git a/game/player/Mob.gd b/game/player/Mob.gd index adb9ac95..8cb1c958 100644 --- a/game/player/Mob.gd +++ b/game/player/Mob.gd @@ -82,17 +82,17 @@ func _process(delta : float) -> void: return var cam_pos : Vector3 = camera.global_transform.xform(Vector3()) - var dstv : Vector3 = cam_pos - translation + var dstv : Vector3 = cam_pos - get_body().translation dstv.y = 0 var dst : float = dstv.length_squared() if dst > max_visible_distance_squared: - if visible: - hide() + if get_body().visible: + get_body().hide() return else: - if not visible: - show() + if not get_body().visible: + get_body().show() #TODO check later if this gives a performance boost # var cam_facing : Vector3 = -camera.global_transform.basis.z @@ -121,7 +121,7 @@ func _physics_process(delta : float) -> void: func process_movement(delta : float) -> void: if starget != null: - look_at(starget.translation, Vector3(0, 1, 0)) + get_body().look_at(starget.get_body().translation, Vector3(0, 1, 0)) var state : int = getc_state() @@ -188,13 +188,13 @@ func process_movement(delta : float) -> void: var facing : Vector3 = vel facing.y = 0 - vel = move_and_slide(vel, Vector3(0,1,0), false, 4, deg2rad(MAX_SLOPE_ANGLE)) - sset_position(translation, rotation) + vel = get_body().move_and_slide(vel, Vector3(0,1,0), false, 4, deg2rad(MAX_SLOPE_ANGLE)) + sset_position(get_body().translation, get_body().rotation) if vel.length_squared() < 0.12: sleep = true - if translation.y < -50.0: + if get_body().translation.y < -50.0: print("killed mob with fall damage") var sdi : SpellDamageInfo = SpellDamageInfo.new() sdi.damage_source_type = SpellDamageInfo.DAMAGE_SOURCE_UNKNOWN @@ -209,7 +209,7 @@ func rotate_delta(x_delta : float) -> void: if y_rot < 0: y_rot = 360 - rotation_degrees = Vector3(0.0, y_rot, 0.0) + get_body().rotation_degrees = Vector3(0.0, y_rot, 0.0) func sstart_attack(entity : Entity) -> void: ai_state = EntityEnums.AI_STATE_ATTACK @@ -271,10 +271,10 @@ func _son_damage_dealt(data): func _con_damage_dealt(info : SpellDamageInfo) -> void: # if info.dealer == - WorldNumbers.damage(translation, 1.6, info.damage, info.crit) + WorldNumbers.damage(get_body().translation, 1.6, info.damage, info.crit) func _con_heal_dealt(info : SpellHealInfo) -> void: - WorldNumbers.heal(translation, 1.6, info.heal, info.crit) + WorldNumbers.heal(get_body().translation, 1.6, info.heal, info.crit) func _moved() -> void: if sis_casting(): @@ -352,9 +352,9 @@ func _son_level_up(value: int) -> void: func sset_position(position : Vector3, rotation : Vector3) -> void: if multiplayer.network_peer and multiplayer.is_network_server(): # cset_position(position, rotation) - vrpc("cset_position", translation, rotation) + vrpc("cset_position", position, rotation) remote func cset_position(position : Vector3, rotation : Vector3) -> void: - translation = position - rotation = rotation + get_body().translation = position + get_body().rotation = rotation diff --git a/game/player/Mob.tscn b/game/player/Mob.tscn index 40436f6b..c9d349f9 100644 --- a/game/player/Mob.tscn +++ b/game/player/Mob.tscn @@ -14,32 +14,25 @@ extents = Vector3( 0.216228, 0.0681041, 0.183397 ) [node name="Mob" type="Entity" groups=[ "mobs", ]] -input_ray_pickable = false -collision_layer = 3 -collision_mask = 3 -character_skeleton_path = NodePath("Rotation_Helper/Model/character") +body_path = NodePath("Body") +character_skeleton_path = NodePath("Body/Rotation_Helper/Model/character") script = ExtResource( 2 ) -[node name="Body_CollisionShape" type="CollisionShape" parent="."] +[node name="NamePlate" parent="." instance=ExtResource( 3 )] + +[node name="Body" type="KinematicBody" parent="."] + +[node name="Body_CollisionShape" type="CollisionShape" parent="Body"] transform = Transform( 1, 0, 0, 0, -1.62921e-07, -1, 0, 1, -1.62921e-07, 0, 0.73, 0 ) shape = SubResource( 1 ) -[node name="Feet_CollisionShape" type="CollisionShape" parent="."] +[node name="Feet_CollisionShape" type="CollisionShape" parent="Body"] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.1, 0 ) shape = SubResource( 2 ) -[node name="Rotation_Helper" type="Spatial" parent="."] +[node name="Rotation_Helper" type="Spatial" parent="Body"] transform = Transform( -1, 0, -3.25841e-07, 0, 1, 0, 3.25841e-07, 0, -1, 0, 0, 0 ) -[node name="Model" type="Spatial" parent="Rotation_Helper"] +[node name="Model" type="Spatial" parent="Body/Rotation_Helper"] -[node name="character" parent="Rotation_Helper/Model" instance=ExtResource( 1 )] - -[node name="OmniLight" type="OmniLight" parent="."] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.185015, 1.74294, -0.107748 ) -visible = false -light_color = Color( 0.592157, 0.631373, 0.607843, 1 ) -omni_range = 8.0 -omni_attenuation = 0.31864 - -[node name="NamePlate" parent="." instance=ExtResource( 3 )] +[node name="character" parent="Body/Rotation_Helper/Model" instance=ExtResource( 1 )] diff --git a/game/player/NamePlate.gd b/game/player/NamePlate.gd index 6bbd019d..7e5fd9e5 100644 --- a/game/player/NamePlate.gd +++ b/game/player/NamePlate.gd @@ -84,7 +84,7 @@ func _process(delta): interpolating = false - var position : Vector3 = entity.translation + var position : Vector3 = entity.get_body().translation var camera : Camera = get_tree().get_root().get_camera() as Camera diff --git a/game/player/NetworkedPlayer.gd b/game/player/NetworkedPlayer.gd index 98e1f725..e1695002 100644 --- a/game/player/NetworkedPlayer.gd +++ b/game/player/NetworkedPlayer.gd @@ -100,7 +100,7 @@ func rotate_delta(x_delta : float) -> void: if y_rot < 0: y_rot = 360 - rotation_degrees = Vector3(0.0, y_rot, 0.0) + get_body().rotation_degrees = Vector3(0.0, y_rot, 0.0) #remote func set_position(position : Vector3, rot : Vector3) -> void: # translation = position @@ -113,14 +113,14 @@ remote func sset_position(position : Vector3, rotation : Vector3) -> void: if multiplayer.network_peer and multiplayer.is_network_server(): cset_position(position, rotation) - vrpc("cset_position", translation, rotation) + vrpc("cset_position", position, rotation) remote func cset_position(position : Vector3, rotation : Vector3) -> void: # if get_network_master() != 1: # print(str(get_network_master()) + "npcset") - translation = position - rotation = rotation + get_body().translation = position + get_body().rotation = rotation func _moved() -> void: if sis_casting(): diff --git a/game/player/NetworkedPlayer.tscn b/game/player/NetworkedPlayer.tscn index 418d5f2a..2dc69958 100644 --- a/game/player/NetworkedPlayer.tscn +++ b/game/player/NetworkedPlayer.tscn @@ -12,26 +12,29 @@ height = 0.927641 extents = Vector3( 0.216228, 0.0681041, 0.183397 ) [node name="NetworkedPlayer" type="Entity"] -input_ray_pickable = false -collision_layer = 3 -collision_mask = 3 -character_skeleton_path = NodePath("Rotation_Helper/Model/character") +body_path = NodePath("Body") +character_skeleton_path = NodePath("Body/Rotation_Helper/Model/character") script = ExtResource( 1 ) -[node name="Body_CollisionShape" type="CollisionShape" parent="."] +[node name="Body" type="KinematicBody" parent="."] + +[node name="Body_CollisionShape" type="CollisionShape" parent="Body"] transform = Transform( 1, 0, 0, 0, -1.62921e-07, -1, 0, 1, -1.62921e-07, 0, 0.8, 0 ) shape = SubResource( 1 ) -[node name="Feet_CollisionShape" type="CollisionShape" parent="."] +[node name="Feet_CollisionShape" type="CollisionShape" parent="Body"] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.194237, 0 ) shape = SubResource( 2 ) -[node name="Rotation_Helper" type="Spatial" parent="."] +[node name="Rotation_Helper" type="Spatial" parent="Body"] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.960532, 0 ) -[node name="Model" type="Spatial" parent="Rotation_Helper"] +[node name="Model" type="Spatial" parent="Body/Rotation_Helper"] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.875205, 0 ) -[node name="character" parent="Rotation_Helper/Model" instance=ExtResource( 2 )] +[node name="character" parent="Body/Rotation_Helper/Model" instance=ExtResource( 2 )] [node name="NamePlate" parent="." instance=ExtResource( 3 )] +name_label_path = NodePath("../../NetworkedPlayerNode/NamePlate/Name") +health_bar_path = NodePath("../../NetworkedPlayerNode/NamePlate/MarginContainer/TextureProgress") +health_bar_label_path = NodePath("../../NetworkedPlayerNode/NamePlate/MarginContainer/CenterContainer/Label") diff --git a/game/player/Player.gd b/game/player/Player.gd index 2e6ce1aa..df63f202 100644 --- a/game/player/Player.gd +++ b/game/player/Player.gd @@ -79,8 +79,8 @@ var world : VoxelWorld = null var model_rotation_node : Spatial func _ready() -> void: - camera = $CameraPivot/Camera as Camera - camera_pivot = $CameraPivot as Spatial + camera = $Body/CameraPivot/Camera as Camera + camera_pivot = $Body/CameraPivot as Spatial model_rotation_node = get_node(model_path) @@ -190,13 +190,13 @@ func process_movement(delta : float) -> void: hvel = hvel.linear_interpolate(target, accel * delta) as Vector3 vel.x = hvel.x vel.z = hvel.z - vel = move_and_slide(vel, Vector3(0,1,0), false, 4, deg2rad(MAX_SLOPE_ANGLE)) + vel = get_body().move_and_slide(vel, Vector3(0,1,0), false, 4, deg2rad(MAX_SLOPE_ANGLE)) if multiplayer.has_network_peer(): if not multiplayer.is_network_server(): - rpc_id(1, "sset_position", translation, rotation) + rpc_id(1, "sset_position", get_body().translation, get_body().rotation) else: - sset_position(translation, rotation) + sset_position(get_body().translation, get_body().rotation) func _input(event: InputEvent) -> void: @@ -305,19 +305,18 @@ func rotate_delta(x_delta : float) -> void: while y_rot < 0: y_rot += 360 - rotation_degrees = Vector3(0.0, y_rot, 0.0) + get_body().rotation_degrees = Vector3(0.0, y_rot, 0.0) 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().direct_space_state - var result = space_state.intersect_ray(from, to, [], 2) + var space_state = get_body().get_world().direct_space_state + var result = space_state.intersect_ray(from, to, [], get_body().collision_mask) if result: - print(result) - if result.collider and result.collider is Entity: - var ent : Entity = result.collider as Entity + if result.collider and result.collider.owner is Entity: + var ent : Entity = result.collider.owner as Entity crequest_target_change(ent.get_path()) return @@ -330,12 +329,15 @@ 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().direct_space_state - var result = space_state.intersect_ray(from, to, [], 2) + var space_state = get_body().get_world().direct_space_state + var result = space_state.intersect_ray(from, to, [], get_body().collision_mask) if result: - 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 mo == null: + return if last_mouse_over != null and last_mouse_over != mo: if is_instance_valid(last_mouse_over): @@ -369,14 +371,14 @@ remote func sset_position(position : Vector3, rotation : Vector3) -> void: print(str(get_network_master()) + "psset") if multiplayer.network_peer and multiplayer.is_network_server(): - vrpc("cset_position", translation, rotation) + vrpc("cset_position", position, rotation) cset_position(position, rotation) remote func cset_position(position : Vector3, rotation : Vector3) -> void: if get_network_master() != 1: print(str(get_network_master()) + " pcset") - translation = position - rotation = rotation + get_body().translation = position + get_body().rotation = rotation func _moved() -> void: if sis_casting(): diff --git a/game/player/Player.tscn b/game/player/Player.tscn index 5aaba640..e1e853c6 100644 --- a/game/player/Player.tscn +++ b/game/player/Player.tscn @@ -15,37 +15,38 @@ extents = Vector3( 0.216228, 0.0681041, 0.183397 ) [node name="Player" type="Entity" groups=[ "players", ]] -input_ray_pickable = false -collision_layer = 3 -collision_mask = 3 -character_skeleton_path = NodePath("Rotation_Helper/Model/character") +body_path = NodePath("Body") +character_skeleton_path = NodePath("Body/Rotation_Helper/Model/character") script = ExtResource( 2 ) +model_path = NodePath("Body/Rotation_Helper/Model") -[node name="Body_CollisionShape" type="CollisionShape" parent="."] +[node name="Body" type="KinematicBody" parent="."] + +[node name="Body_CollisionShape" type="CollisionShape" parent="Body"] transform = Transform( 1, 0, 0, 0, -1.62921e-07, -1, 0, 1, -1.62921e-07, 0, 0.73, 0 ) shape = SubResource( 1 ) -[node name="Feet_CollisionShape" type="CollisionShape" parent="."] +[node name="Feet_CollisionShape" type="CollisionShape" parent="Body"] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.1, 0 ) shape = SubResource( 2 ) -[node name="CameraPivot" type="Spatial" parent="."] +[node name="CameraPivot" type="Spatial" parent="Body"] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.44092, 0 ) script = ExtResource( 4 ) -[node name="Camera" type="Camera" parent="CameraPivot"] +[node name="Camera" type="Camera" parent="Body/CameraPivot"] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 6.822 ) current = true fov = 60.0 size = 28.0 far = 1000.0 -[node name="Rotation_Helper" type="Spatial" parent="."] +[node name="Rotation_Helper" type="Spatial" parent="Body"] transform = Transform( -1, 0, -3.25841e-07, 0, 1, 0, 3.25841e-07, 0, -1, 0, 0, 0 ) -[node name="Model" type="Spatial" parent="Rotation_Helper"] +[node name="Model" type="Spatial" parent="Body/Rotation_Helper"] -[node name="character" parent="Rotation_Helper/Model" instance=ExtResource( 1 )] +[node name="character" parent="Body/Rotation_Helper/Model" instance=ExtResource( 1 )] [node name="GUILayer" parent="." instance=ExtResource( 3 )] [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 97745fc4..7871df3b 100644 --- a/game/player/PlayerGDBase.gd +++ b/game/player/PlayerGDBase.gd @@ -50,8 +50,8 @@ func _physics_process(delta): update_visibility() func update_visibility() -> void: - _query.transform = Transform(Basis(), translation) - var res : Array = get_world().direct_space_state.intersect_shape(_query) + _query.transform = Transform(Basis(), get_body().translation) + var res : Array = get_body().get_world().direct_space_state.intersect_shape(_query) #warning-ignore:unassigned_variable var currenty_sees : Array = Array() diff --git a/game/scenes/Menu.tscn b/game/scenes/Menu.tscn index 6b1a1bad..18f90663 100644 --- a/game/scenes/Menu.tscn +++ b/game/scenes/Menu.tscn @@ -570,6 +570,8 @@ level_generator = SubResource( 1 ) voxel_scale = 6.0 chunk_spawn_range = 1 script = ExtResource( 16 ) +meshes = [ ] +editor_generate = false show_loading_screen = false generate_on_ready = true diff --git a/game/scripts/ai/EntityAIGD.gd b/game/scripts/ai/EntityAIGD.gd index a7b5e519..77ef061f 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 : Vector3 = target.translation - owner.translation + var dir : Vector3 = target.get_body().translation - owner.get_body().translation owner.target_movement_direction = Vector2(dir.x, dir.z) diff --git a/game/scripts/projectiles/WorldSpellGD.gd b/game/scripts/projectiles/WorldSpellGD.gd index 97a6ed2b..ee015d56 100644 --- a/game/scripts/projectiles/WorldSpellGD.gd +++ b/game/scripts/projectiles/WorldSpellGD.gd @@ -38,7 +38,7 @@ func launch(info : SpellCastInfo, effect : PackedScene, speed : float) -> void: _speed = speed # translation = info.caster.translation - translation = info.caster.get_character_skeleton().right_hand_attach_point.global_transform.origin + get_body().translation = info.caster.get_character_skeleton().right_hand_attach_point.global_transform.origin var eff : Node = effect.instance() @@ -53,7 +53,7 @@ func _process(delta : float) -> void: queue_free() return - var l : Vector3 = _target.global_transform.origin - translation + var l : Vector3 = _target.global_transform.origin - get_body().translation if l.length() < 1: _info.spell.son_spell_hit(_info) @@ -62,6 +62,6 @@ func _process(delta : float) -> void: var dir : Vector3 = l.normalized() - global_transform.origin += dir * _speed * delta - global_transform = transform.looking_at(_target.global_transform.origin, Vector3(0, 1, 0)) + get_body().global_transform.origin += dir * _speed * delta + get_body().global_transform = get_body().transform.looking_at(_target.global_transform.origin, Vector3(0, 1, 0)) diff --git a/game/scripts/spells/gd_spell_script.gd b/game/scripts/spells/gd_spell_script.gd index ce81280d..749f22aa 100644 --- a/game/scripts/spells/gd_spell_script.gd +++ b/game/scripts/spells/gd_spell_script.gd @@ -25,7 +25,7 @@ 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 info.spell.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):