Update every module to the latest.

This commit is contained in:
Relintai 2019-11-27 11:22:04 +01:00
parent 08971de608
commit 8fd696c71a
9 changed files with 138 additions and 37 deletions

2
HEADS
View File

@ -1 +1 @@
{"world_generator": "290d973ea9580f748881a54502850ae5fecfb586", "entity_spell_system": "9e16f68ff75bb2b8773a9ef4cd4aa84299e7579c", "ui_extensions": "271dcf89e9afe5cb6350de2f2433c8ebf8aba785", "voxelman": "2b369f5be8efc5fe0ef13da57afa46317c413f47", "texture_packer": "604c330188e220c15d10ea5bd545a6fc5aab0132", "fastnoise": "41b7ea05a1f7aa2b8ecddaa1fd739e64d6970f7e"}
{"engine": "8fb7481fd53313c5b7a7cece27af0de84c404853", "world_generator": "290d973ea9580f748881a54502850ae5fecfb586", "entity_spell_system": "6bd6ad462333017a01c247fad251059f95904be5", "ui_extensions": "271dcf89e9afe5cb6350de2f2433c8ebf8aba785", "voxelman": "2b369f5be8efc5fe0ef13da57afa46317c413f47", "texture_packer": "604c330188e220c15d10ea5bd545a6fc5aab0132", "fastnoise": "41b7ea05a1f7aa2b8ecddaa1fd739e64d6970f7e", "entity-spell-system-addons": "dd1953e7bbc4a36745fe4d7f6f7c94651fb07b95"}

View File

@ -219,7 +219,7 @@ func spawn_mob(class_id : int, level : int, position : Vector3) -> Entity:
createinfo.player_name = "Mob"
createinfo.level = level
# createinfo.level = level
createinfo.entity_controller = EntityEnums.ENITIY_CONTROLLER_MOB
createinfo.entity_controller = EntityEnums.ENITIY_CONTROLLER_AI
var entity : Entity = spawn(createinfo, false, position)
entity.slevelup(level - 1)

View File

@ -1,4 +1,4 @@
[gd_resource type="EntityClassData" load_steps=74 format=2]
[gd_resource type="EntityClassData" load_steps=76 format=2]
[ext_resource path="res://data/spells/26_rest.tres" type="Spell" id=1]
[ext_resource path="res://data/spells/21_strength_of_nature_rank_1.tres" type="Spell" id=2]
@ -19,6 +19,7 @@
[ext_resource path="res://data/spells/25_inner_will.tres" type="Spell" id=17]
[ext_resource path="res://data/auras/1_test1.tres" type="Aura" id=18]
[ext_resource path="res://scripts/entities/NaturalistGD.gd" type="Script" id=19]
[ext_resource path="res://scripts/ai/EntityAIGD.gd" type="Script" id=20]
[ext_resource path="res://data/auras/13_aspect_of_bees_rank_1.tres" type="Aura" id=21]
[ext_resource path="res://data/auras/15_close_wounds_rank_1.tres" type="Aura" id=22]
[ext_resource path="res://data/spells/29_aspect_of_wolves.tres" type="Spell" id=23]
@ -26,6 +27,9 @@
[ext_resource path="res://data/spells/28_aspectofwasps.tres" type="Spell" id=25]
[ext_resource path="res://data/spells/30_aspect_of_bees.tres" type="Spell" id=26]
[sub_resource type="EntityAI" id=49]
script = ExtResource( 20 )
[sub_resource type="TalentRowData" id=1]
Talent_0_0 = ExtResource( 21 )
@ -251,5 +255,5 @@ specs = [ SubResource( 3 ) ]
spells = [ ExtResource( 4 ), ExtResource( 6 ), ExtResource( 16 ), ExtResource( 5 ), ExtResource( 3 ), ExtResource( 10 ), ExtResource( 8 ), ExtResource( 11 ), ExtResource( 9 ), ExtResource( 7 ), ExtResource( 13 ), ExtResource( 2 ), ExtResource( 12 ), ExtResource( 14 ), ExtResource( 15 ), ExtResource( 17 ), ExtResource( 1 ), ExtResource( 24 ), ExtResource( 25 ), ExtResource( 23 ), ExtResource( 26 ) ]
start_spells = [ ExtResource( 24 ) ]
auras = [ ExtResource( 18 ) ]
ai_actions = [ null, null ]
ais = [ SubResource( 49 ) ]
script = ExtResource( 19 )

View File

@ -97,18 +97,18 @@ func _physics_process(delta : float) -> void:
if dead:
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)
# 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)

View File

@ -9,11 +9,6 @@
config_version=4
_global_script_classes=[ {
"base": "AIActionContainer",
"class": "AITestActionContainer",
"language": "GDScript",
"path": "res://scripts/ai/TestContainer.gd"
}, {
"base": "Aura",
"class": "AuraGD",
"language": "GDScript",
@ -34,6 +29,11 @@ _global_script_classes=[ {
"language": "GDScript",
"path": "res://player/DisplayPlayer.gd"
}, {
"base": "EntityAI",
"class": "EntityAIGD",
"language": "GDScript",
"path": "res://scripts/ai/EntityAIGD.gd"
}, {
"base": "EntityData",
"class": "EntityDataGD",
"language": "GDScript",
@ -180,11 +180,11 @@ _global_script_classes=[ {
"path": "res://voxelman/transvoxel_mesher/TestVoxelMesher.gd"
} ]
_global_script_class_icons={
"AITestActionContainer": "",
"AuraGD": "",
"CharacterSkeketonAttachPoint": "",
"CubicVoxelChunk": "",
"DisplayPlayerGD": "",
"EntityAIGD": "",
"EntityDataGD": "",
"GDCubicVoxelMesher": "",
"ItemTemplateGD": "",

View File

@ -0,0 +1,108 @@
extends EntityAI
class_name EntityAIGD
# Copyright Péter Magyar relintai@gmail.com
# MIT License, functionality from this class needs to be protable to the entity spell system
var _data : Dictionary = {
"target_aura_spells": {},
"spells": []
}
func _on_set_owner():
if not is_instance_valid(owner):
return
if not owner.sentity_data:
return
var ent_data : EntityData = owner.sentity_data
if not ent_data.entity_class_data:
return
var class_data : EntityClassData = ent_data.entity_class_data
for i in range(class_data.get_num_spells()):
var spell : Spell = class_data.get_spell(i)
if spell.get_num_target_aura_applys() > 0:
var aura : Aura = spell.get_target_aura_apply(0)
if not _data["target_aura_spells"].has(aura.aura_group):
_data["target_aura_spells"][aura.aura_group] = []
_data["target_aura_spells"][aura.aura_group].append({ "aura_id": aura.id, "spell_id": spell.id, "rank": spell.rank })
continue
_data["spells"].append(spell.id)
for key in _data["target_aura_spells"]:
var arr : Array = _data["target_aura_spells"][key]
arr.sort_custom(self, "sort_spells_by_rank")
func _update(delta):
if owner.ai_state == EntityEnums.AI_STATE_ATTACK:
attack(delta)
func attack(delta):
var target : Entity = owner.starget
if target == null:
owner.ai_state = EntityEnums.AI_STATE_REGENERATE
owner.target_movement_direction = Vector2()
return
var cast : bool = false
if not owner.gets_has_global_cooldown():
var taspellsdict : Dictionary = _data["target_aura_spells"]
for taskey in taspellsdict.keys():
for tas in taspellsdict[taskey]:
var spell_id : int = tas["spell_id"]
if not owner.hass_spell_id(spell_id):
continue
if taskey == null:
if target.sget_aura_by(owner, tas["aura_id"]) == null and not owner.hass_cooldown(spell_id):
owner.crequest_spell_cast(spell_id)
cast = true
break
else:
if target.sget_aura_with_group_by(owner, taskey) == null and not owner.hass_cooldown(spell_id):
owner.crequest_spell_cast(spell_id)
cast = true
break
if cast:
break
if not cast:
var sps : Array = _data["spells"]
for spell_id in sps:
if not owner.hass_spell_id(spell_id):
continue
if not owner.hass_cooldown(spell_id):
owner.crequest_spell_cast(spell_id)
cast = true
break
if owner.sis_casting():
owner.target_movement_direction = Vector2()
return
var dir : Vector3 = target.translation - owner.translation
owner.target_movement_direction = Vector2(dir.x, dir.z)
func sort_spells_by_rank(a, b):
if a == null or b == null:
return true
return a["rank"] > b["rank"]

View File

@ -1,9 +0,0 @@
extends AIActionContainer
class_name AITestActionContainer
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
func get_title() -> String:
return "AITestActionContainer"

View File

@ -1,9 +1,8 @@
extends EntityData
class_name EntityDataGD
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright Péter Magyar relintai@gmail.com
# MIT License, functionality from this class needs to be protable to the entity spell system
func _sinteract(entity: Entity) -> void:
var target : Entity = entity.gets_target()

View File

@ -1,8 +1,7 @@
extends EntityClassData
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Copyright Péter Magyar relintai@gmail.com
# MIT License, functionality from this class needs to be protable to the entity spell system
var _data : Dictionary = {
"target_aura_spells": {},