Added a default level override variable to the Entities autoload. Fixed a few issues with applying stats on level up. And HEADS (ESS) update.

This commit is contained in:
Relintai 2019-12-02 19:19:49 +01:00
parent 633c380f08
commit 2d34cff90d
14 changed files with 141 additions and 59 deletions

2
HEADS
View File

@ -1 +1 @@
{"engine": "e64a663c59141f972345852f0bce613e3f13dd3a", "world_generator": "290d973ea9580f748881a54502850ae5fecfb586", "entity_spell_system": "68df038731b7bca1905ce09433c90d64650a3030", "ui_extensions": "271dcf89e9afe5cb6350de2f2433c8ebf8aba785", "voxelman": "2b369f5be8efc5fe0ef13da57afa46317c413f47", "texture_packer": "604c330188e220c15d10ea5bd545a6fc5aab0132", "fastnoise": "41b7ea05a1f7aa2b8ecddaa1fd739e64d6970f7e", "entity-spell-system-addons": "367b2318da45726710c27fd3ac1d23e8a5a8f1f7"} {"engine": "9607fc48a0134b289fe62f327db1f160d70fac24", "world_generator": "290d973ea9580f748881a54502850ae5fecfb586", "entity_spell_system": "fcf23281e8aec25ac9f5ef61fa8a7e300064b939", "ui_extensions": "271dcf89e9afe5cb6350de2f2433c8ebf8aba785", "voxelman": "2b369f5be8efc5fe0ef13da57afa46317c413f47", "texture_packer": "604c330188e220c15d10ea5bd545a6fc5aab0132", "fastnoise": "41b7ea05a1f7aa2b8ecddaa1fd739e64d6970f7e", "entity-spell-system-addons": "367b2318da45726710c27fd3ac1d23e8a5a8f1f7"}

View File

@ -23,11 +23,12 @@ extends Node
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE. # SOFTWARE.
export (PackedScene) var player_scene : PackedScene export(PackedScene) var player_scene : PackedScene
export (PackedScene) var networked_player_scene : PackedScene export(PackedScene) var networked_player_scene : PackedScene
export (PackedScene) var mob_scene : PackedScene export(PackedScene) var mob_scene : PackedScene
export (PackedScene) var player_display_scene : PackedScene export(PackedScene) var player_display_scene : PackedScene
export (String) var spawn_parent_path : String = "/root/Main" export(String) var spawn_parent_path : String = "/root/Main"
export(int) var default_level_override : int = 0
var _spawn_parent : Node = null var _spawn_parent : Node = null
@ -167,17 +168,23 @@ func spawn_player_for_menu(class_id : int, name : String, parent : Node) -> Enti
createinfo.entity_data = cls createinfo.entity_data = cls
createinfo.player_name = name createinfo.player_name = name
createinfo.level = class_profile.level createinfo.level = 1
createinfo.xp = class_profile.xp createinfo.xp = class_profile.xp
createinfo.entity_controller = EntityEnums.ENITIY_CONTROLLER_PLAYER createinfo.entity_controller = EntityEnums.ENITIY_CONTROLLER_PLAYER
var entity : Entity = player_display_scene.instance() as Entity var entity : Entity = player_display_scene.instance() as Entity
entity.initialize(createinfo)
var level : int = class_profile.level
if default_level_override > 0:
level = default_level_override
entity.slevelup(level - 1)
parent.add_child(entity) parent.add_child(entity)
entity.owner = parent entity.owner = parent
entity.initialize(createinfo)
return entity return entity
func spawn_networked_player(class_id : int, position : Vector3, name : String, node_name : String, sid : int) -> Entity: func spawn_networked_player(class_id : int, position : Vector3, name : String, node_name : String, sid : int) -> Entity:
@ -189,12 +196,19 @@ func spawn_networked_player(class_id : int, position : Vector3, name : String,
createinfo.entity_data = cls createinfo.entity_data = cls
createinfo.player_name = name createinfo.player_name = name
createinfo.level = class_profile.level createinfo.level = 1
createinfo.xp = class_profile.xp createinfo.xp = class_profile.xp
createinfo.entity_controller = EntityEnums.ENITIY_CONTROLLER_PLAYER createinfo.entity_controller = EntityEnums.ENITIY_CONTROLLER_PLAYER
var entity : Entity = spawn(createinfo, true, position, node_name) var entity : Entity = spawn(createinfo, true, position, node_name)
var level : int = class_profile.level
if default_level_override > 0:
level = default_level_override
entity.slevelup(level - 1)
if get_tree().is_network_server(): if get_tree().is_network_server():
entity.set_network_master(sid) entity.set_network_master(sid)
@ -213,12 +227,19 @@ func spawn_player(class_id : int, position : Vector3, name : String, node_name
createinfo.entity_data = cls createinfo.entity_data = cls
createinfo.player_name = name createinfo.player_name = name
createinfo.level = class_profile.level createinfo.level = 1
createinfo.xp = class_profile.xp createinfo.xp = class_profile.xp
createinfo.entity_controller = EntityEnums.ENITIY_CONTROLLER_PLAYER createinfo.entity_controller = EntityEnums.ENITIY_CONTROLLER_PLAYER
var entity : Entity = spawn(createinfo, false, position, node_name) var entity : Entity = spawn(createinfo, false, position, node_name)
var level : int = class_profile.level
if default_level_override > 0:
level = default_level_override
entity.slevelup(level - 1)
entity.set_network_master(network_owner) entity.set_network_master(network_owner)
Logger.info("Player spawned " + str(createinfo)) Logger.info("Player spawned " + str(createinfo))
@ -237,11 +258,15 @@ func spawn_mob(class_id : int, level : int, position : Vector3) -> Entity:
createinfo.entity_data = cls createinfo.entity_data = cls
createinfo.player_name = "Mob" createinfo.player_name = "Mob"
createinfo.level = level createinfo.level = 1
# createinfo.level = level
createinfo.entity_controller = EntityEnums.ENITIY_CONTROLLER_AI createinfo.entity_controller = EntityEnums.ENITIY_CONTROLLER_AI
var entity : Entity = spawn(createinfo, false, position) var entity : Entity = spawn(createinfo, false, position)
if default_level_override > 0:
level = default_level_override
entity.slevelup(level - 1) entity.slevelup(level - 1)
Logger.info("Mob spawned " + str(createinfo)) Logger.info("Mob spawned " + str(createinfo))

View File

@ -22,3 +22,4 @@ player_scene = ExtResource( 3 )
networked_player_scene = ExtResource( 2 ) networked_player_scene = ExtResource( 2 )
mob_scene = ExtResource( 4 ) mob_scene = ExtResource( 4 )
player_display_scene = ExtResource( 5 ) player_display_scene = ExtResource( 5 )
default_level_override = 50

View File

@ -4,4 +4,3 @@
[node name="ProfileManager" type="ProfileManager"] [node name="ProfileManager" type="ProfileManager"]
script = ExtResource( 1 ) script = ExtResource( 1 )
save_interval = 1.0

View File

@ -5,6 +5,7 @@
[ext_resource path="res://data/icons/4_chest_of_the_infinite_wisdom.tres" type="Texture" id=3] [ext_resource path="res://data/icons/4_chest_of_the_infinite_wisdom.tres" type="Texture" id=3]
[resource] [resource]
resource_name = "Chest of the Infinite Wisdom"
id = 3 id = 3
text_name = "Chest of the Infinite Wisdom" text_name = "Chest of the Infinite Wisdom"
item_type = 1 item_type = 1

View File

@ -4,7 +4,7 @@
[ext_resource path="res://data/icons/naturalist/aspect_of_scorpions.tres" type="Texture" id=2] [ext_resource path="res://data/icons/naturalist/aspect_of_scorpions.tres" type="Texture" id=2]
[ext_resource path="res://data/auras/10_aspect_of_scorpions_rank_1.tres" type="Aura" id=3] [ext_resource path="res://data/auras/10_aspect_of_scorpions_rank_1.tres" type="Aura" id=3]
[ext_resource path="res://data/effect_data/aspect_of_scorpions.tres" type="SpellEffectVisual" id=4] [ext_resource path="res://data/effect_data/aspect_of_scorpions.tres" type="SpellEffectVisual" id=4]
[ext_resource path="res://data/spells/2_test_cast_spell.tres" type="Spell" id=5] [ext_resource path="res://data/spells/27_aspect_of_scorpions.tres" type="Spell" id=5]
[resource] [resource]
resource_name = "Aspect of Scorpions" resource_name = "Aspect of Scorpions"

View File

@ -3,7 +3,7 @@
[ext_resource path="res://scripts/spells/gd_spell_script.gd" type="Script" id=1] [ext_resource path="res://scripts/spells/gd_spell_script.gd" type="Script" id=1]
[ext_resource path="res://data/icons/naturalist/aspect_of_wasps.tres" type="Texture" id=2] [ext_resource path="res://data/icons/naturalist/aspect_of_wasps.tres" type="Texture" id=2]
[ext_resource path="res://data/auras/11_aspect_of_wasps_rank1.tres" type="Aura" id=3] [ext_resource path="res://data/auras/11_aspect_of_wasps_rank1.tres" type="Aura" id=3]
[ext_resource path="res://data/spells/2_test_cast_spell.tres" type="Spell" id=4] [ext_resource path="res://data/spells/28_aspectofwasps.tres" type="Spell" id=4]
[resource] [resource]
resource_name = "Aspect of Wasps" resource_name = "Aspect of Wasps"

View File

@ -3,7 +3,7 @@
[ext_resource path="res://scripts/spells/gd_spell_script.gd" type="Script" id=1] [ext_resource path="res://scripts/spells/gd_spell_script.gd" type="Script" id=1]
[ext_resource path="res://data/icons/naturalist/aspect_of_wolves.tres" type="Texture" id=2] [ext_resource path="res://data/icons/naturalist/aspect_of_wolves.tres" type="Texture" id=2]
[ext_resource path="res://data/auras/12_aspect_of_wolves_rank_1.tres" type="Aura" id=3] [ext_resource path="res://data/auras/12_aspect_of_wolves_rank_1.tres" type="Aura" id=3]
[ext_resource path="res://data/spells/2_test_cast_spell.tres" type="Spell" id=4] [ext_resource path="res://data/spells/29_aspect_of_wolves.tres" type="Spell" id=4]
[resource] [resource]
resource_name = "Aspect of Wolves" resource_name = "Aspect of Wolves"

View File

@ -3,7 +3,7 @@
[ext_resource path="res://scripts/spells/gd_spell_script.gd" type="Script" id=1] [ext_resource path="res://scripts/spells/gd_spell_script.gd" type="Script" id=1]
[ext_resource path="res://data/icons/naturalist/aspect_of_bees.tres" type="Texture" id=2] [ext_resource path="res://data/icons/naturalist/aspect_of_bees.tres" type="Texture" id=2]
[ext_resource path="res://data/auras/13_aspect_of_bees_rank_1.tres" type="Aura" id=3] [ext_resource path="res://data/auras/13_aspect_of_bees_rank_1.tres" type="Aura" id=3]
[ext_resource path="res://data/spells/2_test_cast_spell.tres" type="Spell" id=4] [ext_resource path="res://data/spells/30_aspect_of_bees.tres" type="Spell" id=4]
[resource] [resource]
resource_name = "Aspect of Bees" resource_name = "Aspect of Bees"

View File

@ -1,10 +1,52 @@
[gd_resource type="XPData" format=2] [gd_resource type="XPData" format=2]
[resource] [resource]
level_1 = 300
level_2 = 600 level_2 = 600
level_3 = 1000 level_3 = 1000
level_4 = 10000 level_4 = 1000
level_5 = 200000 level_5 = 1000
level_6 = 400000 level_6 = 1000
level_7 = 600000 level_7 = 1000
level_8 = 1000
level_9 = 1000
level_10 = 1000
level_11 = 1000
level_12 = 1000
level_13 = 1000
level_14 = 1000
level_15 = 1000
level_16 = 1000
level_17 = 1000
level_18 = 1000
level_19 = 1000
level_20 = 1000
level_21 = 1000
level_22 = 1000
level_23 = 1000
level_24 = 1000
level_25 = 1000
level_26 = 1000
level_27 = 1000
level_28 = 1000
level_29 = 1000
level_30 = 1000
level_31 = 1000
level_32 = 1000
level_33 = 1000
level_34 = 1000
level_35 = 1000
level_36 = 1000
level_37 = 1000
level_38 = 1000
level_39 = 1000
level_40 = 1000
level_41 = 1000
level_42 = 1000
level_43 = 1000
level_44 = 1000
level_45 = 1000
level_46 = 1000
level_47 = 1000
level_48 = 1000
level_49 = 1000
level_50 = 1000

View File

@ -376,4 +376,26 @@ func _con_spell_cast_success(info):
if animation_run: if animation_run:
anim_node_state_machine.travel("run-loop") anim_node_state_machine.travel("run-loop")
func _son_level_up(level: int) -> void:
if sentity_data == null:
return
var ecd : EntityClassData = sentity_data.entity_class_data
if ecd == null:
return
sfree_spell_points += ecd.spell_points_per_level * level
sfree_talent_points += level
for i in range(Stat.MAIN_STAT_ID_COUNT):
var st : int = sentity_data.entity_class_data.get_stat_data().get_level_stat_data().get_stat_diff(i, slevel - level, slevel)
var statid : int = i + Stat.MAIN_STAT_ID_START
var stat : Stat = get_stat_int(statid)
var sm : StatModifier = stat.get_modifier(0)
sm.base_mod += st

View File

@ -25,6 +25,29 @@ class_name DisplayPlayerGD
# SOFTWARE. # SOFTWARE.
func _setup(): func _setup():
._setup()
setup_actionbars() setup_actionbars()
func _son_level_up(level: int) -> void:
if sentity_data == null:
return
var ecd : EntityClassData = sentity_data.entity_class_data
if ecd == null:
return
sfree_spell_points += ecd.spell_points_per_level * level
sfree_talent_points += level
for i in range(Stat.MAIN_STAT_ID_COUNT):
var st : int = sentity_data.entity_class_data.get_stat_data().get_level_stat_data().get_stat_diff(i, slevel - level, slevel)
var statid : int = i + Stat.MAIN_STAT_ID_START
var stat : Stat = get_stat_int(statid)
var sm : StatModifier = stat.get_modifier(0)
sm.base_mod += st

View File

@ -117,19 +117,6 @@ func _physics_process(delta : float) -> void:
if dead: if dead:
return return
# if ai_state == EntityEnums.AI_STATE_OFF:
# return
# elif ai_state == EntityEnums.AI_STATE_PATROL:
# sentity_data.sai_rest(self)
# elif ai_state == EntityEnums.AI_STATE_REST:
# sentity_data.sai_rest(self)
# elif ai_state == EntityEnums.AI_STATE_REGENERATE:
# sentity_data.sai_regenerate(self)
# elif ai_state == EntityEnums.AI_STATE_ATTACK:
# sentity_data.sai_attack(self)
# elif ai_state == EntityEnums.AI_STATE_FOLLOW_PATH:
# sentity_data.sai_follow(self)
process_movement(delta) process_movement(delta)
func process_movement(delta : float) -> void: func process_movement(delta : float) -> void:
@ -147,7 +134,6 @@ func process_movement(delta : float) -> void:
anim_node_state_machine.travel("run-loop") anim_node_state_machine.travel("run-loop")
animation_run = true animation_run = true
target_movement_direction = target_movement_direction.normalized() target_movement_direction = target_movement_direction.normalized()
moving = true moving = true
else: else:
@ -203,26 +189,11 @@ func process_movement(delta : float) -> void:
facing.y = 0 facing.y = 0
vel = move_and_slide(vel, Vector3(0,1,0), false, 4, deg2rad(MAX_SLOPE_ANGLE)) vel = move_and_slide(vel, Vector3(0,1,0), false, 4, deg2rad(MAX_SLOPE_ANGLE))
# if facing.length_squared() > 0.1:
# look_at(translation + facing, Vector3(0, 1, 0))
# else:
# if starget != null:
# look_at(starget.translation, Vector3(0, 1, 0))
sset_position(translation, rotation) sset_position(translation, rotation)
if vel.length_squared() < 0.12: if vel.length_squared() < 0.12:
sleep = true sleep = true
# if get_tree().network_peer:
# if get_tree().is_network_server():
# set_position(translation, rotation)
# else:
# rpc("set_position", translation, rotation)
# print(vel.length_squared())
if translation.y < -50.0: if translation.y < -50.0:
print("killed mob with fall damage") print("killed mob with fall damage")
var sdi : SpellDamageInfo = SpellDamageInfo.new() var sdi : SpellDamageInfo = SpellDamageInfo.new()
@ -340,7 +311,6 @@ func _son_level_up(value: int) -> void:
sfree_talent_points += value sfree_talent_points += value
for i in range(Stat.MAIN_STAT_ID_COUNT): for i in range(Stat.MAIN_STAT_ID_COUNT):
# print(i)
var st : int = sentity_data.entity_class_data.get_stat_data().get_level_stat_data().get_stat_diff(i, slevel - value, slevel) var st : int = sentity_data.entity_class_data.get_stat_data().get_level_stat_data().get_stat_diff(i, slevel - value, slevel)
var statid : int = i + Stat.MAIN_STAT_ID_START var statid : int = i + Stat.MAIN_STAT_ID_START

View File

@ -447,11 +447,10 @@ func _son_level_up(level: int) -> void:
if ecd == null: if ecd == null:
return return
sfree_spell_points += ecd.spell_points_per_level sfree_spell_points += ecd.spell_points_per_level * level
sfree_talent_points += 1 sfree_talent_points += level
for i in range(Stat.MAIN_STAT_ID_COUNT): for i in range(Stat.MAIN_STAT_ID_COUNT):
# print(i)
var st : int = sentity_data.entity_class_data.get_stat_data().get_level_stat_data().get_stat_diff(i, slevel - level, slevel) var st : int = sentity_data.entity_class_data.get_stat_data().get_level_stat_data().get_stat_diff(i, slevel - level, slevel)
var statid : int = i + Stat.MAIN_STAT_ID_START var statid : int = i + Stat.MAIN_STAT_ID_START