adding panel to create creature, adding model arche & isodor
This commit is contained in:
parent
fe375adea7
commit
07b364f11d
69 changed files with 5581 additions and 776 deletions
BIN
assets/creatures/arche/MatArcheBleue.material
Normal file
BIN
assets/creatures/arche/MatArcheBleue.material
Normal file
Binary file not shown.
BIN
assets/creatures/arche/MatArcheCyan.material
Normal file
BIN
assets/creatures/arche/MatArcheCyan.material
Normal file
Binary file not shown.
BIN
assets/creatures/arche/MatArcheJaune.material
Normal file
BIN
assets/creatures/arche/MatArcheJaune.material
Normal file
Binary file not shown.
BIN
assets/creatures/arche/MatArcheRose.material
Normal file
BIN
assets/creatures/arche/MatArcheRose.material
Normal file
Binary file not shown.
BIN
assets/creatures/arche/MatArcheRouge.material
Normal file
BIN
assets/creatures/arche/MatArcheRouge.material
Normal file
Binary file not shown.
BIN
assets/creatures/arche/MatArcheVert.material
Normal file
BIN
assets/creatures/arche/MatArcheVert.material
Normal file
Binary file not shown.
BIN
assets/creatures/arche/arche.glb
Normal file
BIN
assets/creatures/arche/arche.glb
Normal file
Binary file not shown.
1933
assets/creatures/arche/arche.gltf
Normal file
1933
assets/creatures/arche/arche.gltf
Normal file
File diff suppressed because it is too large
Load diff
5
assets/creatures/arche/arche.tscn
Normal file
5
assets/creatures/arche/arche.tscn
Normal file
|
@ -0,0 +1,5 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://assets/creatures/arche/arche.gltf" type="PackedScene" id=1]
|
||||
|
||||
[node name="arche" instance=ExtResource( 1 )]
|
BIN
assets/creatures/isidor/IsidorMatCorps.material
Normal file
BIN
assets/creatures/isidor/IsidorMatCorps.material
Normal file
Binary file not shown.
BIN
assets/creatures/isidor/IsidorMatHalo.material
Normal file
BIN
assets/creatures/isidor/IsidorMatHalo.material
Normal file
Binary file not shown.
BIN
assets/creatures/isidor/IsidorMatPropulsion.material
Normal file
BIN
assets/creatures/isidor/IsidorMatPropulsion.material
Normal file
Binary file not shown.
BIN
assets/creatures/isidor/IsidorMatRoue.material
Normal file
BIN
assets/creatures/isidor/IsidorMatRoue.material
Normal file
Binary file not shown.
1159
assets/creatures/isidor/isidor.gltf
Normal file
1159
assets/creatures/isidor/isidor.gltf
Normal file
File diff suppressed because it is too large
Load diff
8
assets/creatures/isidor/isidor.tscn
Normal file
8
assets/creatures/isidor/isidor.tscn
Normal file
|
@ -0,0 +1,8 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://assets/creatures/isidor/isidor.gltf" type="PackedScene" id=1]
|
||||
|
||||
[node name="isidor" instance=ExtResource( 1 )]
|
||||
|
||||
[node name="BoneHalo" parent="Isidor/BoneBase" index="1"]
|
||||
transform = Transform( 0.547755, 0, 0.836639, 0, 1, 0, -0.836639, 0, 0.547755, 0, 1.32818, 0 )
|
BIN
assets/interfaces/Login-Khanat-sound-button-empty.png
Normal file
BIN
assets/interfaces/Login-Khanat-sound-button-empty.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
BIN
assets/interfaces/creature_creation.png
Normal file
BIN
assets/interfaces/creature_creation.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 50 KiB |
BIN
assets/interfaces/creatures_creation/Material.material
Normal file
BIN
assets/interfaces/creatures_creation/Material.material
Normal file
Binary file not shown.
BIN
assets/interfaces/creatures_creation/creature_creation.png
Normal file
BIN
assets/interfaces/creatures_creation/creature_creation.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 28 KiB |
147
assets/interfaces/creatures_creation/root.gltf
Normal file
147
assets/interfaces/creatures_creation/root.gltf
Normal file
|
@ -0,0 +1,147 @@
|
|||
{
|
||||
"asset" : {
|
||||
"generator" : "Khronos glTF Blender I/O v1.6.16",
|
||||
"version" : "2.0"
|
||||
},
|
||||
"scene" : 0,
|
||||
"scenes" : [
|
||||
{
|
||||
"name" : "Scene",
|
||||
"nodes" : [
|
||||
0,
|
||||
1,
|
||||
2
|
||||
]
|
||||
}
|
||||
],
|
||||
"nodes" : [
|
||||
{
|
||||
"mesh" : 0,
|
||||
"name" : "Cube"
|
||||
},
|
||||
{
|
||||
"name" : "Light",
|
||||
"rotation" : [
|
||||
0.16907575726509094,
|
||||
0.7558803558349609,
|
||||
-0.27217137813568115,
|
||||
0.570947527885437
|
||||
],
|
||||
"translation" : [
|
||||
4.076245307922363,
|
||||
5.903861999511719,
|
||||
-1.0054539442062378
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "Camera",
|
||||
"rotation" : [
|
||||
0.483536034822464,
|
||||
0.33687159419059753,
|
||||
-0.20870360732078552,
|
||||
0.7804827094078064
|
||||
],
|
||||
"translation" : [
|
||||
7.358891487121582,
|
||||
4.958309173583984,
|
||||
6.925790786743164
|
||||
]
|
||||
}
|
||||
],
|
||||
"materials" : [
|
||||
{
|
||||
"doubleSided" : true,
|
||||
"name" : "Material",
|
||||
"pbrMetallicRoughness" : {
|
||||
"baseColorFactor" : [
|
||||
0.800000011920929,
|
||||
0.800000011920929,
|
||||
0.800000011920929,
|
||||
1
|
||||
],
|
||||
"metallicFactor" : 0,
|
||||
"roughnessFactor" : 0.4000000059604645
|
||||
}
|
||||
}
|
||||
],
|
||||
"meshes" : [
|
||||
{
|
||||
"name" : "Cube",
|
||||
"primitives" : [
|
||||
{
|
||||
"attributes" : {
|
||||
"POSITION" : 0,
|
||||
"NORMAL" : 1,
|
||||
"TEXCOORD_0" : 2
|
||||
},
|
||||
"indices" : 3,
|
||||
"material" : 0
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"accessors" : [
|
||||
{
|
||||
"bufferView" : 0,
|
||||
"componentType" : 5126,
|
||||
"count" : 24,
|
||||
"max" : [
|
||||
4,
|
||||
0,
|
||||
4
|
||||
],
|
||||
"min" : [
|
||||
-4,
|
||||
-1,
|
||||
-4
|
||||
],
|
||||
"type" : "VEC3"
|
||||
},
|
||||
{
|
||||
"bufferView" : 1,
|
||||
"componentType" : 5126,
|
||||
"count" : 24,
|
||||
"type" : "VEC3"
|
||||
},
|
||||
{
|
||||
"bufferView" : 2,
|
||||
"componentType" : 5126,
|
||||
"count" : 24,
|
||||
"type" : "VEC2"
|
||||
},
|
||||
{
|
||||
"bufferView" : 3,
|
||||
"componentType" : 5123,
|
||||
"count" : 36,
|
||||
"type" : "SCALAR"
|
||||
}
|
||||
],
|
||||
"bufferViews" : [
|
||||
{
|
||||
"buffer" : 0,
|
||||
"byteLength" : 288,
|
||||
"byteOffset" : 0
|
||||
},
|
||||
{
|
||||
"buffer" : 0,
|
||||
"byteLength" : 288,
|
||||
"byteOffset" : 288
|
||||
},
|
||||
{
|
||||
"buffer" : 0,
|
||||
"byteLength" : 192,
|
||||
"byteOffset" : 576
|
||||
},
|
||||
{
|
||||
"buffer" : 0,
|
||||
"byteLength" : 72,
|
||||
"byteOffset" : 768
|
||||
}
|
||||
],
|
||||
"buffers" : [
|
||||
{
|
||||
"byteLength" : 840,
|
||||
"uri" : "data:application/octet-stream;base64,AACAQAAAAAAAAIDAAACAQAAAAAAAAIDAAACAQAAAAAAAAIDAAACAQAAAgL8AAIDAAACAQAAAgL8AAIDAAACAQAAAgL8AAIDAAACAQAAAAAAAAIBAAACAQAAAAAAAAIBAAACAQAAAAAAAAIBAAACAQAAAgL8AAIBAAACAQAAAgL8AAIBAAACAQAAAgL8AAIBAAACAwAAAAAAAAIDAAACAwAAAAAAAAIDAAACAwAAAAAAAAIDAAACAwAAAgL8AAIDAAACAwAAAgL8AAIDAAACAwAAAgL8AAIDAAACAwAAAAAAAAIBAAACAwAAAAAAAAIBAAACAwAAAAAAAAIBAAACAwAAAgL8AAIBAAACAwAAAgL8AAIBAAACAwAAAgL8AAIBAAAAAAAAAAAAAAIC/AAAAAAAAgD8AAACAAACAPwAAAAAAAACAAAAAAAAAgL8AAACAAAAAAAAAAAAAAIC/AACAPwAAAAAAAACAAAAAAAAAAAAAAIA/AAAAAAAAgD8AAACAAACAPwAAAAAAAACAAAAAAAAAgL8AAACAAAAAAAAAAAAAAIA/AACAPwAAAAAAAACAAACAvwAAAAAAAACAAAAAAAAAAAAAAIC/AAAAAAAAgD8AAACAAACAvwAAAAAAAACAAAAAAAAAgL8AAACAAAAAAAAAAAAAAIC/AACAvwAAAAAAAACAAAAAAAAAAAAAAIA/AAAAAAAAgD8AAACAAACAvwAAAAAAAACAAAAAAAAAgL8AAACAAAAAAAAAAAAAAIA/AAAgPwAAAD8AACA/AAAAPwAAID8AAAA/AADAPgAAAD8AAMA+AAAAPwAAwD4AAAA/AAAgPwAAgD4AACA/AACAPgAAID8AAIA+AADAPgAAgD4AAMA+AACAPgAAwD4AAIA+AAAgPwAAQD8AACA/AABAPwAAYD8AAAA/AADAPgAAQD8AAAA+AAAAPwAAwD4AAEA/AAAgPwAAgD8AACA/AAAAAAAAYD8AAIA+AADAPgAAgD8AAAA+AACAPgAAwD4AAAAAAQAOABQAAQAUAAcACgAGABMACgATABcAFQASAAwAFQAMAA8AEAADAAkAEAAJABYABQACAAgABQAIAAsAEQANAAAAEQAAAAQA"
|
||||
}
|
||||
]
|
||||
}
|
BIN
assets/interfaces/next.png
Normal file
BIN
assets/interfaces/next.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
assets/interfaces/previous.png
Normal file
BIN
assets/interfaces/previous.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
assets/interfaces/rollback.png
Normal file
BIN
assets/interfaces/rollback.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1 KiB |
BIN
assets/interfaces/themes/khanat_create_creature.theme
Normal file
BIN
assets/interfaces/themes/khanat_create_creature.theme
Normal file
Binary file not shown.
18
locale/en.po
18
locale/en.po
|
@ -154,3 +154,21 @@ msgstr "Settings"
|
|||
|
||||
msgid "JUKEBOX_ADD"
|
||||
msgstr "Add music(s)"
|
||||
|
||||
msgid "CREATURE_CREATION_CHOICE_RACE"
|
||||
msgstr "Choice your race"
|
||||
|
||||
msgid "CREATURE_CREATION_FIRST_NAME"
|
||||
msgstr "First name"
|
||||
|
||||
msgid "CREATURE_CREATION_LAST_NAME"
|
||||
msgstr "Last name"
|
||||
|
||||
msgid "FIRST_NAME"
|
||||
msgstr "First name"
|
||||
|
||||
msgid "LAST_NAME"
|
||||
msgstr "Last name"
|
||||
|
||||
msgid "CREATURE_CREATION_PROPERTIES"
|
||||
msgstr "Define your properties"
|
||||
|
|
18
locale/fr.po
18
locale/fr.po
|
@ -154,3 +154,21 @@ msgstr "Configuration"
|
|||
|
||||
msgid "JUKEBOX_ADD"
|
||||
msgstr "Ajouter une(des) musique(s)"
|
||||
|
||||
msgid "CREATURE_CREATION_CHOICE_RACE"
|
||||
msgstr "Sélectionner votre race"
|
||||
|
||||
msgid "CREATURE_CREATION_FIRST_NAME"
|
||||
msgstr "Prénom"
|
||||
|
||||
msgid "CREATURE_CREATION_LAST_NAME"
|
||||
msgstr "Nom"
|
||||
|
||||
msgid "FIRST_NAME"
|
||||
msgstr "Prénom"
|
||||
|
||||
msgid "LAST_NAME"
|
||||
msgstr "Nom"
|
||||
|
||||
msgid "CREATURE_CREATION_PROPERTIES"
|
||||
msgstr "Éditer vos attributs"
|
||||
|
|
Binary file not shown.
|
@ -146,4 +146,20 @@ msgstr ""
|
|||
msgid "JUKEBOX_ADD"
|
||||
msgstr ""
|
||||
|
||||
msgid "CREATURE_CREATION_CHOICE_RACE"
|
||||
msgstr ""
|
||||
|
||||
msgid "CREATURE_CREATION_FIRST_NAME"
|
||||
msgstr ""
|
||||
|
||||
msgid "CREATURE_CREATION_LAST_NAME"
|
||||
msgstr ""
|
||||
|
||||
msgid "FIRST_NAME"
|
||||
msgstr ""
|
||||
|
||||
msgid "LAST_NAME"
|
||||
msgstr ""
|
||||
|
||||
msgid "CREATURE_CREATION_PROPERTIES"
|
||||
msgstr ""
|
||||
|
|
|
@ -9,21 +9,56 @@
|
|||
config_version=4
|
||||
|
||||
_global_script_classes=[ {
|
||||
"base": "Equipment",
|
||||
"class": "Cloth",
|
||||
"language": "GDScript",
|
||||
"path": "res://ressources/scripts/datas/cloth.gd"
|
||||
}, {
|
||||
"base": "Data",
|
||||
"class": "Creature",
|
||||
"language": "GDScript",
|
||||
"path": "res://ressources/scripts/datas/creature.gd"
|
||||
}, {
|
||||
"base": "Reference",
|
||||
"class": "CreatureOld",
|
||||
"language": "GDScript",
|
||||
"path": "res://ressources/scripts/creatures/creature.gd"
|
||||
}, {
|
||||
"base": "Node",
|
||||
"class": "Creature_old",
|
||||
"language": "GDScript",
|
||||
"path": "res://ressources/scripts/creatures/creature_old.gd"
|
||||
}, {
|
||||
"base": "Object",
|
||||
"class": "Data",
|
||||
"language": "GDScript",
|
||||
"path": "res://ressources/scripts/datas/data.gd"
|
||||
}, {
|
||||
"base": "Item",
|
||||
"class": "Equipment",
|
||||
"language": "GDScript",
|
||||
"path": "res://ressources/scripts/datas/equipment.gd"
|
||||
}, {
|
||||
"base": "Node",
|
||||
"class": "Equippable",
|
||||
"language": "GDScript",
|
||||
"path": "res://ressources/scripts/items/equippable.gd"
|
||||
}, {
|
||||
"base": "Creature",
|
||||
"class": "Human",
|
||||
"language": "GDScript",
|
||||
"path": "res://ressources/scripts/datas/human.gd"
|
||||
}, {
|
||||
"base": "Node",
|
||||
"class": "Inventory",
|
||||
"language": "GDScript",
|
||||
"path": "res://ressources/scripts/items/inventory.gd"
|
||||
}, {
|
||||
"base": "Data",
|
||||
"class": "Item",
|
||||
"language": "GDScript",
|
||||
"path": "res://ressources/scripts/datas/item.gd"
|
||||
}, {
|
||||
"base": "Node",
|
||||
"class": "Item_old",
|
||||
"language": "GDScript",
|
||||
|
@ -39,7 +74,17 @@ _global_script_classes=[ {
|
|||
"language": "GDScript",
|
||||
"path": "res://scenes/creatures/ra/ra_model.gd"
|
||||
}, {
|
||||
"base": "Node",
|
||||
"base": "ProxyData",
|
||||
"class": "PickupItem",
|
||||
"language": "GDScript",
|
||||
"path": "res://ressources/scripts/datas/pickup_item.gd"
|
||||
}, {
|
||||
"base": "Data",
|
||||
"class": "ProxyData",
|
||||
"language": "GDScript",
|
||||
"path": "res://ressources/scripts/datas/proxy_data.gd"
|
||||
}, {
|
||||
"base": "Reference",
|
||||
"class": "Ra",
|
||||
"language": "GDScript",
|
||||
"path": "res://ressources/scripts/creatures/ra.gd"
|
||||
|
@ -50,12 +95,21 @@ _global_script_classes=[ {
|
|||
"path": "res://scenes/interfaces/focus_reticle.gd"
|
||||
} ]
|
||||
_global_script_class_icons={
|
||||
"Cloth": "",
|
||||
"Creature": "",
|
||||
"CreatureOld": "",
|
||||
"Creature_old": "",
|
||||
"Data": "",
|
||||
"Equipment": "",
|
||||
"Equippable": "",
|
||||
"Human": "",
|
||||
"Inventory": "",
|
||||
"Item": "",
|
||||
"Item_old": "",
|
||||
"JSONBeautifier": "",
|
||||
"Mannequiny": "",
|
||||
"PickupItem": "",
|
||||
"ProxyData": "",
|
||||
"Ra": "",
|
||||
"focus_reticle": ""
|
||||
}
|
||||
|
@ -75,12 +129,12 @@ enable_audio_input=true
|
|||
[autoload]
|
||||
|
||||
Config="*res://ressources/scripts/config/config.gd"
|
||||
Creatures="*res://ressources/scripts/creatures_old.gd"
|
||||
Creatures="res://ressources/scripts/creatures_old.gd"
|
||||
MusicManager="*res://scenes/interfaces/music_manager/music_manager.tscn"
|
||||
Connection="*res://scenes/connection/connection.tscn"
|
||||
Globals="*res://ressources/scripts/global.gd"
|
||||
Datas="*res://ressources/scripts/datas/data.gd"
|
||||
GeneratorMap="*res://scenes/game/generate_map.gd"
|
||||
GeneratorMap="res://scenes/game/generate_map.gd"
|
||||
|
||||
[debug]
|
||||
|
||||
|
|
|
@ -4,7 +4,8 @@ extends Node
|
|||
# $HOME/.local/share/godot/app_userdata/Khanat
|
||||
var font_size = 14
|
||||
var SettingsFile = "user://settings.cfg"
|
||||
var screen_number = 0
|
||||
var screen_number_default = OS.current_screen
|
||||
var screen_number = OS.current_screen
|
||||
var screen_orientation = 0
|
||||
var window_maximized:bool = false
|
||||
var video_default:bool = true
|
||||
|
@ -161,7 +162,7 @@ func enable_window_default():
|
|||
num = 6
|
||||
OS.set_screen_orientation(num)
|
||||
OS.set_window_maximized(window_maximized)
|
||||
OS.current_screen = screen_number
|
||||
OS.current_screen = screen_number_default
|
||||
# display/window/size/always_on_top
|
||||
if ProjectSettings.has_setting( "display/window/size/always_on_top" ):
|
||||
OS.set_window_always_on_top( ProjectSettings.get_setting( "display/window/size/always_on_top" ) )
|
||||
|
|
28
ressources/scripts/creatures/creature.gd
Normal file
28
ressources/scripts/creatures/creature.gd
Normal file
|
@ -0,0 +1,28 @@
|
|||
class_name CreatureOld
|
||||
# Main creature class
|
||||
|
||||
#05. signals
|
||||
#06. enums
|
||||
#07. constants
|
||||
#08. exported variables
|
||||
#09. public variables
|
||||
#10. private variables
|
||||
var type: String
|
||||
var pseudonym: String
|
||||
var inventory = null
|
||||
|
||||
#11. onready variables
|
||||
#12. optional built-in virtual _init method
|
||||
#13. built-in virtual _ready method
|
||||
#14. remaining built-in virtual methods
|
||||
#15. public methods
|
||||
func _init( p_pseudonym = "Creature", p_type = "creature" ):
|
||||
self.type = p_type
|
||||
self.pseudonym = p_pseudonym
|
||||
self.inventory = null
|
||||
|
||||
func from_dict( _datas ):
|
||||
pass
|
||||
|
||||
#16. private methods
|
||||
|
|
@ -5,5 +5,5 @@ class_name Creature_old
|
|||
|
||||
|
||||
func from_dict( datas ):
|
||||
pass
|
||||
|
||||
pass
|
||||
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
extends "res://ressources/scripts/creatures/creature_old.gd"
|
||||
class_name Ra
|
||||
extends "res://ressources/scripts/creatures/creature.gd"
|
||||
# Class for creature Ra with all param only use for Ra
|
||||
|
||||
var inventory = null
|
||||
|
||||
|
||||
func _init( p_pseudonym = "Creature" ):
|
||||
._init( p_pseudonym, "Ra" )
|
||||
pass
|
||||
|
||||
func from_dict( datas ):
|
||||
.from_dict( datas )
|
||||
var new_inventory = Inventory.new()
|
||||
new_inventory.from_dict( datas.get( "inventory", [] ) )
|
||||
self.inventory = new_inventory
|
||||
.from_dict( datas )
|
||||
var new_inventory = Inventory.new()
|
||||
new_inventory.from_dict( datas.get( "inventory", [] ) )
|
||||
self.inventory = new_inventory
|
||||
|
|
34
ressources/scripts/datas/cloth.gd
Normal file
34
ressources/scripts/datas/cloth.gd
Normal file
|
@ -0,0 +1,34 @@
|
|||
tool
|
||||
class_name Cloth
|
||||
extends Equipment
|
||||
#
|
||||
|
||||
#05. signals
|
||||
#06. enums
|
||||
enum LIMB {
|
||||
head,
|
||||
torso,
|
||||
left_upper_arm,
|
||||
right_upper_arm,
|
||||
left_lower_arm,
|
||||
right_lower_arm,
|
||||
left_hand,
|
||||
right_hand,
|
||||
left_upper_leg,
|
||||
right_upper_leg,
|
||||
left_lower_leg,
|
||||
right_lower_leg,
|
||||
left_feet,
|
||||
right_feet
|
||||
}
|
||||
|
||||
#07. constants
|
||||
#08. exported variables
|
||||
#09. public variables
|
||||
#10. private variables
|
||||
#11. onready variables
|
||||
#12. optional built-in virtual _init method
|
||||
#13. built-in virtual _ready method
|
||||
#14. remaining built-in virtual methods
|
||||
#15. public methods
|
||||
#16. private methods
|
41
ressources/scripts/datas/creature.gd
Normal file
41
ressources/scripts/datas/creature.gd
Normal file
|
@ -0,0 +1,41 @@
|
|||
class_name Creature
|
||||
extends Data
|
||||
#
|
||||
|
||||
#05. signals
|
||||
#06. enums
|
||||
#07. constants
|
||||
#08. exported variables
|
||||
#09. public variables
|
||||
#10. private variables
|
||||
#11. onready variables
|
||||
#12. optional built-in virtual _init method
|
||||
#13. built-in virtual _ready method
|
||||
#14. remaining built-in virtual methods
|
||||
#15. public methods
|
||||
func _init( p_name = null ).( p_name ):
|
||||
self.set_data( "race", null )
|
||||
self.set_data( "pseudonym", null )
|
||||
# Caracteristiques.
|
||||
self.set_data( "strength", 5 )
|
||||
self.set_data( "perception", 5 )
|
||||
self.set_data( "endurance", 5 )
|
||||
self.set_data( "constitution", 5 )
|
||||
self.set_data( "agility", 5 )
|
||||
self.set_data( "current_life", self.get_max_life() )
|
||||
self.set_data( "current_stamina", self.get_max_stamina() )
|
||||
# inventaire.
|
||||
self.set_data( "inventory", [] )
|
||||
|
||||
func get_filename():
|
||||
if not self.get_data( "name", null ):
|
||||
return "unknow.creature"
|
||||
return self.get_data( "name" )+".creature"
|
||||
|
||||
func get_max_life():
|
||||
return self.get_data( "constitution", 5 ) * 1000
|
||||
|
||||
func get_max_stamina():
|
||||
return self.get_data( "endurance", 5 ) * 1000
|
||||
|
||||
#16. private methods
|
|
@ -1,307 +1,46 @@
|
|||
tool
|
||||
extends Node
|
||||
class_name Data
|
||||
extends Object
|
||||
# Main creature class
|
||||
|
||||
var JSONBeautifier = preload( "res://ressources/scripts/json_beautifier/json_beautifier.gd" )
|
||||
#05. signals
|
||||
#06. enums
|
||||
#07. constants
|
||||
#08. exported variables
|
||||
#09. public variables
|
||||
var datas = {}
|
||||
|
||||
class Data:
|
||||
var datas = {}
|
||||
|
||||
func _init( p_name = null ):
|
||||
self.set_data( "name", p_name )
|
||||
|
||||
func get_data( p_key, p_default_value = null ):
|
||||
return self.datas.get( p_key, p_default_value )
|
||||
|
||||
func set_data( p_key, p_value ):
|
||||
self.datas[ p_key ] = p_value
|
||||
|
||||
func get_filename():
|
||||
if not self.get_data( "name", null ):
|
||||
return "unknow.data"
|
||||
if self.get_data( "name" ).get_extension():
|
||||
return self.get_data( "name" )
|
||||
return self.get_data( "name" ) + ".data"
|
||||
|
||||
func save( p_emplacement = "res"):
|
||||
var filename = self.get_filename()
|
||||
var ext = filename.get_extension()
|
||||
var file = File.new()
|
||||
|
||||
if p_emplacement == "res":
|
||||
if file.open("res://ressources/files/"+ext+"s/"+filename, File.WRITE) == OK:
|
||||
file.store_line( JSONBeautifier.beautify_json( to_json(self.datas), 4 ) )
|
||||
file.close()
|
||||
elif p_emplacement == "user":
|
||||
var dir = Directory.new()
|
||||
if not dir.dir_exists( "user://saves/save_temp/ressources/files/"+ext+"s/" ):
|
||||
dir .make_dir_recursive( "user://saves/save_temp/ressources/files/"+ext+"s/" )
|
||||
|
||||
if file.open("user://saves/save_temp/ressources/files/"+ext+"s/"+filename, File.WRITE) == OK:
|
||||
file.store_line( JSONBeautifier.beautify_json( to_json(self.datas), 4 ) )
|
||||
file.close()
|
||||
elif p_emplacement == "pc":
|
||||
var dir = Directory.new()
|
||||
if not dir.dir_exists( "user://saves/save_temp/ressources/files/"+ext+"s/pc/" ):
|
||||
dir .make_dir_recursive( "user://saves/save_temp/ressources/files/"+ext+"s/pc/" )
|
||||
|
||||
if file.open("user://saves/save_temp/ressources/files/"+ext+"s/pc/"+filename, File.WRITE) == OK:
|
||||
file.store_line( JSONBeautifier.beautify_json( to_json(self.datas), 4 ) )
|
||||
file.close()
|
||||
|
||||
|
||||
func load( p_path = null, p_emplacement = null ):
|
||||
|
||||
var dict = null
|
||||
|
||||
if not p_path:
|
||||
var filename = self.get_filename()
|
||||
var ext = filename.get_extension()
|
||||
var file = File.new()
|
||||
if not p_emplacement:
|
||||
if file.open("user://saves/save_temp/ressources/files/"+ext+"s/"+filename, File.READ) == OK or file.open("res://ressources/files/"+ext+"s/"+filename, File.READ) == OK:
|
||||
dict = JSON.parse(file.get_as_text()).get_result()
|
||||
else:
|
||||
var path = "res://ressources/files/"+ext+"s/"+filename
|
||||
if p_emplacement == "usr":
|
||||
path = "user://saves/save_temp/ressources/files/"+ext+"s/"+filename
|
||||
elif p_emplacement == "pc":
|
||||
path = "user://saves/save_temp/ressources/files/"+ext+"s/pc/"+filename
|
||||
|
||||
if file.open(path, File.READ) == OK:
|
||||
dict = JSON.parse(file.get_as_text()).get_result()
|
||||
file.close()
|
||||
|
||||
else:
|
||||
var file = File.new()
|
||||
if file.open(p_path, File.READ) == OK:
|
||||
dict = JSON.parse(file.get_as_text()).get_result()
|
||||
file.close()
|
||||
|
||||
if dict:
|
||||
for key in dict.keys():
|
||||
self.set_data( key, dict[key] )
|
||||
|
||||
class ProxyData extends Data:
|
||||
|
||||
var data = null
|
||||
|
||||
func _init( p_data_filename, p_data = null ):
|
||||
.set_data( "item_filename", p_data_filename )
|
||||
.set_data( "modified_values", {} )
|
||||
#10. private variables
|
||||
#11. onready variables
|
||||
#12. optional built-in virtual _init method
|
||||
#13. built-in virtual _ready method
|
||||
#14. remaining built-in virtual methods
|
||||
#15. public methods
|
||||
|
||||
var ref_data = Data.new()
|
||||
ref_data.set_data( "name", .get_data( "item_filename" ) )
|
||||
ref_data.load()
|
||||
if ref_data and ref_data is Data:
|
||||
self.data = ref_data
|
||||
var modified_values = {}
|
||||
for data_name in self.data.datas.keys():
|
||||
if self.data and p_data and not self.data.get_data( data_name ) == p_data.get_data( data_name ):
|
||||
modified_values[ data_name ] = p_data.get_data( data_name )
|
||||
.set_data( "modified_values", modified_values )
|
||||
func _init( p_name = null ):
|
||||
set_data( "name", p_name )
|
||||
|
||||
func get_data( p_key, p_default_value = null ):
|
||||
return datas.get( p_key, p_default_value )
|
||||
|
||||
func set_data( p_data_name, p_value ):
|
||||
if not .get_data( "modified_values" ):
|
||||
.set_data( "modified_values", {} )
|
||||
|
||||
var new_modified_value = .get_data( "modified_values" )
|
||||
new_modified_value[ p_data_name ] = p_value
|
||||
.set_data( "modified_values", new_modified_value )
|
||||
func set_data( p_key, p_value ):
|
||||
datas[ p_key ] = p_value
|
||||
|
||||
func get_data( p_key, p_default_value = null ):
|
||||
if .get_data( "modified_values" ) and p_key in .get_data( "modified_values" ):
|
||||
return .get_data( "modified_values" )[ p_key ]
|
||||
elif self.data:
|
||||
return self.data.get_data( p_key, p_default_value )
|
||||
return p_default_value
|
||||
func save( filename ):
|
||||
var file = File.new()
|
||||
if file.file_exists( filename ):
|
||||
file.open( filename, File.READ )
|
||||
datas = JSON.parse(file.get_as_text()).get_result()
|
||||
file.close()
|
||||
|
||||
func save( p_emplacement = "usr"):
|
||||
.save( p_emplacement )
|
||||
func load( filename ):
|
||||
var file = File.new()
|
||||
if file.file_exists( filename ):
|
||||
file.open( filename, File.READ )
|
||||
datas = JSON.parse(file.get_as_text()).get_result()
|
||||
file.close()
|
||||
|
||||
func load( p_path = null, p_emplacement = "usr" ):
|
||||
.load( p_path, p_emplacement )
|
||||
|
||||
class Creature extends Data:
|
||||
func _init( p_name = null ).( p_name ):
|
||||
self.set_data( "race", null )
|
||||
# Caracteristiques.
|
||||
self.set_data( "strength", 5 )
|
||||
self.set_data( "perception", 5 )
|
||||
self.set_data( "endurance", 5 )
|
||||
self.set_data( "constitution", 5 )
|
||||
self.set_data( "agility", 5 )
|
||||
self.set_data( "current_life", self.get_max_life() )
|
||||
self.set_data( "current_stamina", self.get_max_stamina() )
|
||||
# inventaire.
|
||||
self.set_data( "inventory", [] )
|
||||
|
||||
func get_filename():
|
||||
if not self.get_data( "name", null ):
|
||||
return "unknow.creature"
|
||||
return self.get_data( "name" )+".creature"
|
||||
|
||||
func get_max_life():
|
||||
return self.get_data( "constitution", 5 ) * 1000
|
||||
func get_max_stamina():
|
||||
return self.get_data( "endurance", 5 ) * 1000
|
||||
|
||||
class Human extends Creature:
|
||||
func _init( p_name = null ).( p_name ):
|
||||
self.set_data( "first_name", null )
|
||||
self.set_data( "last_name", null )
|
||||
# Aspect.
|
||||
self.set_data( "caucasian", 0.0 )
|
||||
self.set_data( "african", 0.0 )
|
||||
self.set_data( "asian", 0.0 )
|
||||
self.set_data( "size", 1.0 )
|
||||
self.set_data( "fat", 0.0 )
|
||||
self.set_data( "muscles", 0.0 )
|
||||
self.set_data( "proportion", 0.0 )
|
||||
self.set_data( "breast", 0.0 )
|
||||
self.set_data( "pregnancy", 0.0 )
|
||||
self.set_data( "skin_tone", 0.0 )
|
||||
self.set_data( "hair", 0 )
|
||||
self.set_data( "hair_color", Color.white )
|
||||
self.set_data( "cleft_chin", 0.0 )
|
||||
self.set_data( "chin_angle", 0.0 )
|
||||
self.set_data( "mouth_horiz", 0.0 )
|
||||
self.set_data( "mouth_vert", 0.0 )
|
||||
self.set_data( "nose_galbe", 0.0 )
|
||||
self.set_data( "nose_grec", 0.0 )
|
||||
self.set_data( "nose_horiz", 0.0 )
|
||||
self.set_data( "nose_depth", 0.0 )
|
||||
self.set_data( "eyes_vert", 0.0 )
|
||||
self.set_data( "eyes_gap", 0.0 )
|
||||
self.set_data( "earlobes", 0.0 )
|
||||
self.set_data( "ears_wing", 0.0 )
|
||||
self.set_data( "lips_up_shape", 0.0 )
|
||||
self.set_data( "lips_up_shape_2", 0.0 )
|
||||
func from_dictionary( dictionary ):
|
||||
datas = dictionary
|
||||
|
||||
|
||||
func get_filename():
|
||||
if not self.get_data( "first_name" ) and not self.get_data( "last_name" ):
|
||||
return "unknow.creature"
|
||||
elif not self.get_data( "last_name" ):
|
||||
return self.get_data( "first_name" ) + ".creature"
|
||||
elif not self.get_data( "first_name" ):
|
||||
return self.get_data( "last_name" ) + ".creature"
|
||||
return self.get_data( "first_name" ) + "_" + self.get_data( "last_name" ) + ".creature"
|
||||
|
||||
|
||||
|
||||
class Item extends Data:
|
||||
func _init( p_name = null ).( p_name ):
|
||||
self.set_data( "model", null )
|
||||
self.set_data( "label", "" )
|
||||
self.set_data( "description", "" )
|
||||
self.set_data( "icon", null )
|
||||
self.set_data( "stack", 1 )
|
||||
self.set_data( "default_num_given", 1 )
|
||||
self.set_data( "pickable", true )
|
||||
self.set_data( "dropable", true )
|
||||
self.set_data( "hit_points", -1 )
|
||||
|
||||
func get_filename():
|
||||
if not self.get_data( "name", null ):
|
||||
return "unknow.item"
|
||||
return self.get_data( "name" )+".item"
|
||||
|
||||
class Equipment extends Item:
|
||||
|
||||
enum SLOT {
|
||||
cloth_hand,
|
||||
cloth_face,
|
||||
cloth_head,
|
||||
cloth_torso,
|
||||
cloth_legs,
|
||||
cloth_feet,
|
||||
cloth_back,
|
||||
weapon_hand_right,
|
||||
weapon_hand_left,
|
||||
weapon_hands,
|
||||
weapon_hip_right,
|
||||
weapon_hip_left,
|
||||
weapon_back_right,
|
||||
weapon_back_left,
|
||||
weapon_holster_right,
|
||||
weapon_holster_left
|
||||
}
|
||||
|
||||
func _init( p_name = null ).( p_name ):
|
||||
self.set_data( "slots", [SLOT.weapon_hand_right] )
|
||||
self.set_data( "default_slot", SLOT.weapon_hand_right )
|
||||
self.set_data( "model_equiped", null )
|
||||
self.set_data( "attachment", "attachment_hand_R" )
|
||||
self.set_data( "attachment_equiped", "attachment_hand_R" )
|
||||
|
||||
func get_filename():
|
||||
if not self.get_data( "name", null ):
|
||||
return "unknow.equipment"
|
||||
return self.get_data( "name" )+".equipment"
|
||||
|
||||
class Cloth extends Equipment:
|
||||
|
||||
enum LIMB {
|
||||
head,
|
||||
torso,
|
||||
left_upper_arm,
|
||||
right_upper_arm,
|
||||
left_lower_arm,
|
||||
right_lower_arm,
|
||||
left_hand,
|
||||
right_hand,
|
||||
left_upper_leg,
|
||||
right_upper_leg,
|
||||
left_lower_leg,
|
||||
right_lower_leg,
|
||||
left_feet,
|
||||
right_feet
|
||||
}
|
||||
|
||||
func _init( p_name = null ).( p_name ):
|
||||
self.set_data( "protection", 0 )
|
||||
self.set_data( "protected_limbs", [] )
|
||||
self.set_data( "texture", null )
|
||||
|
||||
func get_filename():
|
||||
if not self.get_data( "name", null ):
|
||||
return "unknow.cloth"
|
||||
return self.get_data( "name" )+".cloth"
|
||||
|
||||
class Weapon extends Equipment:
|
||||
|
||||
enum TYPE {
|
||||
melee,
|
||||
ranged,
|
||||
throwed
|
||||
}
|
||||
|
||||
func _init( p_name = null ).( p_name ):
|
||||
self.set_data( "damage", 0.0 )
|
||||
self.set_data( "reload_needed", 0 )
|
||||
self.set_data( "range", 1.0 )
|
||||
self.set_data( "type", TYPE.melee )
|
||||
self.set_data( "attack_delay", 1.0 )
|
||||
|
||||
func get_filename():
|
||||
if not self.get_data( "name", null ):
|
||||
return "unknow.weapon"
|
||||
return self.get_data( "name" )+".weapon"
|
||||
|
||||
|
||||
class InventoryItem extends ProxyData:
|
||||
|
||||
func _init( p_item_filename, p_number = 1, p_item = null ).( p_item_filename, p_item ):
|
||||
self.set_data( "number", p_number )
|
||||
|
||||
class PickupItem extends ProxyData:
|
||||
|
||||
func _init( p_item_filename, p_global_transform, p_item = null ).( p_item_filename, p_item ):
|
||||
self.set_data( "global_transform", p_global_transform )
|
||||
|
||||
#
|
||||
#class Character extends ProxyData:
|
||||
# func _init( p_item_filename, p_item = null ).( p_item_filename, p_item ):
|
||||
# self.set_data( "current_life", self.get_data( "constitution", 5 )*1000 )
|
||||
# self.set_data( "current_stamina", self.get_data( "endurance", 5 )*1000 )
|
||||
#16. private methods
|
||||
|
|
36
ressources/scripts/datas/equipment.gd
Normal file
36
ressources/scripts/datas/equipment.gd
Normal file
|
@ -0,0 +1,36 @@
|
|||
tool
|
||||
class_name Equipment
|
||||
extends Item
|
||||
#
|
||||
|
||||
#05. signals
|
||||
#06. enums
|
||||
enum SLOT {
|
||||
cloth_hand,
|
||||
cloth_face,
|
||||
cloth_head,
|
||||
cloth_torso,
|
||||
cloth_legs,
|
||||
cloth_feet,
|
||||
cloth_back,
|
||||
weapon_hand_right,
|
||||
weapon_hand_left,
|
||||
weapon_hands,
|
||||
weapon_hip_right,
|
||||
weapon_hip_left,
|
||||
weapon_back_right,
|
||||
weapon_back_left,
|
||||
weapon_holster_right,
|
||||
weapon_holster_left
|
||||
}
|
||||
|
||||
#07. constants
|
||||
#08. exported variables
|
||||
#09. public variables
|
||||
#10. private variables
|
||||
#11. onready variables
|
||||
#12. optional built-in virtual _init method
|
||||
#13. built-in virtual _ready method
|
||||
#14. remaining built-in virtual methods
|
||||
#15. public methods
|
||||
#16. private methods
|
58
ressources/scripts/datas/human.gd
Normal file
58
ressources/scripts/datas/human.gd
Normal file
|
@ -0,0 +1,58 @@
|
|||
class_name Human
|
||||
extends Creature
|
||||
#
|
||||
|
||||
#05. signals
|
||||
#06. enums
|
||||
#07. constants
|
||||
#08. exported variables
|
||||
#09. public variables
|
||||
#10. private variables
|
||||
#11. onready variables
|
||||
#12. optional built-in virtual _init method
|
||||
#13. built-in virtual _ready method
|
||||
#14. remaining built-in virtual methods
|
||||
#15. public methods
|
||||
|
||||
func _init( p_name = null ).( p_name ):
|
||||
self.set_data( "first_name", null )
|
||||
self.set_data( "last_name", null )
|
||||
# Aspect.
|
||||
self.set_data( "caucasian", 0.0 )
|
||||
self.set_data( "african", 0.0 )
|
||||
self.set_data( "asian", 0.0 )
|
||||
self.set_data( "size", 1.0 )
|
||||
self.set_data( "fat", 0.0 )
|
||||
self.set_data( "muscles", 0.0 )
|
||||
self.set_data( "proportion", 0.0 )
|
||||
self.set_data( "breast", 0.0 )
|
||||
self.set_data( "pregnancy", 0.0 )
|
||||
self.set_data( "skin_tone", 0.0 )
|
||||
self.set_data( "hair", 0 )
|
||||
self.set_data( "hair_color", Color.white )
|
||||
self.set_data( "cleft_chin", 0.0 )
|
||||
self.set_data( "chin_angle", 0.0 )
|
||||
self.set_data( "mouth_horiz", 0.0 )
|
||||
self.set_data( "mouth_vert", 0.0 )
|
||||
self.set_data( "nose_galbe", 0.0 )
|
||||
self.set_data( "nose_grec", 0.0 )
|
||||
self.set_data( "nose_horiz", 0.0 )
|
||||
self.set_data( "nose_depth", 0.0 )
|
||||
self.set_data( "eyes_vert", 0.0 )
|
||||
self.set_data( "eyes_gap", 0.0 )
|
||||
self.set_data( "earlobes", 0.0 )
|
||||
self.set_data( "ears_wing", 0.0 )
|
||||
self.set_data( "lips_up_shape", 0.0 )
|
||||
self.set_data( "lips_up_shape_2", 0.0 )
|
||||
|
||||
|
||||
func get_filename():
|
||||
if not self.get_data( "first_name" ) and not self.get_data( "last_name" ):
|
||||
return "unknow.creature"
|
||||
elif not self.get_data( "last_name" ):
|
||||
return self.get_data( "first_name" ) + ".creature"
|
||||
elif not self.get_data( "first_name" ):
|
||||
return self.get_data( "last_name" ) + ".creature"
|
||||
return self.get_data( "first_name" ) + "_" + self.get_data( "last_name" ) + ".creature"
|
||||
|
||||
#16. private methods
|
33
ressources/scripts/datas/item.gd
Normal file
33
ressources/scripts/datas/item.gd
Normal file
|
@ -0,0 +1,33 @@
|
|||
tool
|
||||
class_name Item
|
||||
extends Data
|
||||
#
|
||||
|
||||
#05. signals
|
||||
#06. enums
|
||||
#07. constants
|
||||
#08. exported variables
|
||||
#09. public variables
|
||||
#10. private variables
|
||||
#11. onready variables
|
||||
#12. optional built-in virtual _init method
|
||||
#13. built-in virtual _ready method
|
||||
#14. remaining built-in virtual methods
|
||||
#15. public methods
|
||||
func _init( p_name = null ).( p_name ):
|
||||
self.set_data( "model", null )
|
||||
self.set_data( "label", "" )
|
||||
self.set_data( "description", "" )
|
||||
self.set_data( "icon", null )
|
||||
self.set_data( "stack", 1 )
|
||||
self.set_data( "default_num_given", 1 )
|
||||
self.set_data( "pickable", true )
|
||||
self.set_data( "dropable", true )
|
||||
self.set_data( "hit_points", -1 )
|
||||
|
||||
func get_filename():
|
||||
if not self.get_data( "name", null ):
|
||||
return "unknow.item"
|
||||
return self.get_data( "name" )+".item"
|
||||
|
||||
#16. private methods
|
19
ressources/scripts/datas/pickup_item.gd
Normal file
19
ressources/scripts/datas/pickup_item.gd
Normal file
|
@ -0,0 +1,19 @@
|
|||
class_name PickupItem
|
||||
extends ProxyData
|
||||
#
|
||||
|
||||
#05. signals
|
||||
#06. enums
|
||||
#07. constants
|
||||
#08. exported variables
|
||||
#09. public variables
|
||||
#10. private variables
|
||||
#11. onready variables
|
||||
#12. optional built-in virtual _init method
|
||||
#13. built-in virtual _ready method
|
||||
#14. remaining built-in virtual methods
|
||||
#15. public methods
|
||||
func _init( p_item_filename, p_global_transform, p_item = null ).( p_item_filename, p_item ):
|
||||
self.set_data( "global_transform", p_global_transform )
|
||||
|
||||
#16. private methods
|
52
ressources/scripts/datas/proxy_data.gd
Normal file
52
ressources/scripts/datas/proxy_data.gd
Normal file
|
@ -0,0 +1,52 @@
|
|||
class_name ProxyData
|
||||
extends Data
|
||||
#
|
||||
|
||||
#05. signals
|
||||
#06. enums
|
||||
#07. constants
|
||||
#08. exported variables
|
||||
#09. public variables
|
||||
#10. private variables
|
||||
#11. onready variables
|
||||
#12. optional built-in virtual _init method
|
||||
#13. built-in virtual _ready method
|
||||
#14. remaining built-in virtual methods
|
||||
#15. public methods
|
||||
|
||||
func _init( p_data_filename, p_data = null ):
|
||||
.set_data( "item_filename", p_data_filename )
|
||||
.set_data( "modified_values", {} )
|
||||
|
||||
var ref_data = Data.new()
|
||||
ref_data.set_data( "name", .get_data( "item_filename" ) )
|
||||
ref_data.load()
|
||||
if ref_data and ref_data is Data:
|
||||
self.data = ref_data
|
||||
var modified_values = {}
|
||||
for data_name in self.data.datas.keys():
|
||||
if self.data and p_data and not self.data.get_data( data_name ) == p_data.get_data( data_name ):
|
||||
modified_values[ data_name ] = p_data.get_data( data_name )
|
||||
.set_data( "modified_values", modified_values )
|
||||
|
||||
func set_data( p_data_name, p_value ):
|
||||
if not .get_data( "modified_values" ):
|
||||
.set_data( "modified_values", {} )
|
||||
var new_modified_value = .get_data( "modified_values" )
|
||||
new_modified_value[ p_data_name ] = p_value
|
||||
.set_data( "modified_values", new_modified_value )
|
||||
|
||||
func get_data( p_key, p_default_value = null ):
|
||||
if .get_data( "modified_values" ) and p_key in .get_data( "modified_values" ):
|
||||
return .get_data( "modified_values" )[ p_key ]
|
||||
elif self.data:
|
||||
return self.data.get_data( p_key, p_default_value )
|
||||
return p_default_value
|
||||
|
||||
#func save( p_emplacement = "usr"):
|
||||
# .save( p_emplacement )
|
||||
#
|
||||
#func load( p_path = null, p_emplacement = "usr" ):
|
||||
# .load( p_path, p_emplacement )
|
||||
|
||||
#16. private methods
|
|
@ -7,17 +7,20 @@ var player_name = null
|
|||
var ressource_queue = preload("res://ressources/scripts/resource_queue.gd").new()
|
||||
|
||||
enum RACE {
|
||||
arche,
|
||||
human
|
||||
}
|
||||
var race_label = [ "Humain" ]
|
||||
var race_label = [ "Arche", "Humain" ]
|
||||
func get_race_id( p_label ):
|
||||
return race_label.find( p_label )
|
||||
|
||||
enum SEX {
|
||||
female,
|
||||
male
|
||||
male,
|
||||
hermaphroditism,
|
||||
asexual
|
||||
}
|
||||
var sex_label = [ "Femme", "Homme" ]
|
||||
var sex_label = [ "Female", "Male", "Hermaphroditism", "Asexual" ]
|
||||
func get_sex_id( p_label ):
|
||||
return race_label.find( p_label )
|
||||
|
||||
|
|
|
@ -14,116 +14,116 @@ class_name JSONBeautifier
|
|||
# 'validade_json()' method) and a number of spaces for indentation (default is
|
||||
# '0', in which it will use tabs instead), returning properly formatted JSON.
|
||||
static func beautify_json(json: String, spaces := 0) -> String:
|
||||
var error_message: String = validate_json(json)
|
||||
if not error_message.empty():
|
||||
return error_message
|
||||
var error_message: String = validate_json(json)
|
||||
if not error_message.empty():
|
||||
return error_message
|
||||
|
||||
var indentation := ""
|
||||
if spaces > 0:
|
||||
for i in spaces:
|
||||
indentation += " "
|
||||
else:
|
||||
indentation = "\t"
|
||||
var indentation := ""
|
||||
if spaces > 0:
|
||||
for i in spaces:
|
||||
indentation += " "
|
||||
else:
|
||||
indentation = "\t"
|
||||
|
||||
var quotation_start := -1
|
||||
var char_position := 0
|
||||
for i in json:
|
||||
# Avoid formating inside strings.
|
||||
if i == "\"":
|
||||
if quotation_start == -1:
|
||||
quotation_start = char_position
|
||||
elif json[char_position - 1] != "\\":
|
||||
quotation_start = -1
|
||||
var quotation_start := -1
|
||||
var char_position := 0
|
||||
for i in json:
|
||||
# Avoid formating inside strings.
|
||||
if i == "\"":
|
||||
if quotation_start == -1:
|
||||
quotation_start = char_position
|
||||
elif json[char_position - 1] != "\\":
|
||||
quotation_start = -1
|
||||
|
||||
char_position += 1
|
||||
char_position += 1
|
||||
|
||||
continue
|
||||
elif quotation_start != -1:
|
||||
char_position += 1
|
||||
continue
|
||||
elif quotation_start != -1:
|
||||
char_position += 1
|
||||
|
||||
continue
|
||||
continue
|
||||
|
||||
match i:
|
||||
# Remove pre-existing formatting.
|
||||
" ", "\n", "\t":
|
||||
json[char_position] = ""
|
||||
char_position -= 1
|
||||
match i:
|
||||
# Remove pre-existing formatting.
|
||||
" ", "\n", "\t":
|
||||
json[char_position] = ""
|
||||
char_position -= 1
|
||||
|
||||
"{", "[", ",":
|
||||
if json[char_position + 1] != "}" and\
|
||||
json[char_position + 1] != "]":
|
||||
json = json.insert(char_position + 1, "\n")
|
||||
char_position += 1
|
||||
"}", "]":
|
||||
if json[char_position - 1] != "{" and\
|
||||
json[char_position - 1] != "[":
|
||||
json = json.insert(char_position, "\n")
|
||||
char_position += 1
|
||||
":":
|
||||
json = json.insert(char_position + 1, " ")
|
||||
char_position += 1
|
||||
|
||||
char_position += 1
|
||||
"{", "[", ",":
|
||||
if json[char_position + 1] != "}" and\
|
||||
json[char_position + 1] != "]":
|
||||
json = json.insert(char_position + 1, "\n")
|
||||
char_position += 1
|
||||
"}", "]":
|
||||
if json[char_position - 1] != "{" and\
|
||||
json[char_position - 1] != "[":
|
||||
json = json.insert(char_position, "\n")
|
||||
char_position += 1
|
||||
":":
|
||||
json = json.insert(char_position + 1, " ")
|
||||
char_position += 1
|
||||
|
||||
char_position += 1
|
||||
|
||||
for i in [["{", "}"], ["[", "]"]]:
|
||||
var bracket_start: int = json.find(i[0])
|
||||
while bracket_start != -1:
|
||||
var bracket_end: int = json.find("\n", bracket_start)
|
||||
var bracket_count := 0
|
||||
while bracket_end != - 1:
|
||||
if json[bracket_end - 1] == i[0]:
|
||||
bracket_count += 1
|
||||
elif json[bracket_end + 1] == i[1]:
|
||||
bracket_count -= 1
|
||||
for i in [["{", "}"], ["[", "]"]]:
|
||||
var bracket_start: int = json.find(i[0])
|
||||
while bracket_start != -1:
|
||||
var bracket_end: int = json.find("\n", bracket_start)
|
||||
var bracket_count := 0
|
||||
while bracket_end != - 1:
|
||||
if json[bracket_end - 1] == i[0]:
|
||||
bracket_count += 1
|
||||
elif json[bracket_end + 1] == i[1]:
|
||||
bracket_count -= 1
|
||||
|
||||
# Move through the indentation to see if there is a match.
|
||||
while json[bracket_end + 1] == indentation:
|
||||
bracket_end += 1
|
||||
# Move through the indentation to see if there is a match.
|
||||
while json[bracket_end + 1] == indentation:
|
||||
bracket_end += 1
|
||||
|
||||
if json[bracket_end + 1] == i[1]:
|
||||
bracket_count -= 1
|
||||
if json[bracket_end + 1] == i[1]:
|
||||
bracket_count -= 1
|
||||
|
||||
if bracket_count <= 0:
|
||||
break
|
||||
if bracket_count <= 0:
|
||||
break
|
||||
|
||||
bracket_end = json.find("\n", bracket_end + 1)
|
||||
bracket_end = json.find("\n", bracket_end + 1)
|
||||
|
||||
# Skip one newline so the end bracket doesn't get indented.
|
||||
bracket_end = json.rfind("\n", json.rfind("\n", bracket_end) - 1)
|
||||
while bracket_end > bracket_start:
|
||||
json = json.insert(bracket_end + 1, indentation)
|
||||
bracket_end = json.rfind("\n", bracket_end - 1)
|
||||
# Skip one newline so the end bracket doesn't get indented.
|
||||
bracket_end = json.rfind("\n", json.rfind("\n", bracket_end) - 1)
|
||||
while bracket_end > bracket_start:
|
||||
json = json.insert(bracket_end + 1, indentation)
|
||||
bracket_end = json.rfind("\n", bracket_end - 1)
|
||||
|
||||
bracket_start = json.find(i[0], bracket_start + 1)
|
||||
bracket_start = json.find(i[0], bracket_start + 1)
|
||||
|
||||
return json
|
||||
return json
|
||||
|
||||
|
||||
# Takes valid JSON (if invalid, it will return a error according with Godot's
|
||||
# 'validade_json()' method), returning JSON in a single line.
|
||||
static func uglify_json(json: String) -> String:
|
||||
var quotation_start := -1
|
||||
var char_position := 0
|
||||
for i in json:
|
||||
# Avoid formating inside strings.
|
||||
if i == "\"":
|
||||
if quotation_start == -1:
|
||||
quotation_start = char_position
|
||||
elif json[char_position - 1] != "\\":
|
||||
quotation_start = -1
|
||||
var quotation_start := -1
|
||||
var char_position := 0
|
||||
for i in json:
|
||||
# Avoid formating inside strings.
|
||||
if i == "\"":
|
||||
if quotation_start == -1:
|
||||
quotation_start = char_position
|
||||
elif json[char_position - 1] != "\\":
|
||||
quotation_start = -1
|
||||
|
||||
char_position += 1
|
||||
char_position += 1
|
||||
|
||||
continue
|
||||
elif quotation_start != -1:
|
||||
char_position += 1
|
||||
continue
|
||||
elif quotation_start != -1:
|
||||
char_position += 1
|
||||
|
||||
continue
|
||||
continue
|
||||
|
||||
if i == " " or i == "\n" or i == "\t":
|
||||
json[char_position] = ""
|
||||
char_position -= 1
|
||||
if i == " " or i == "\n" or i == "\t":
|
||||
json[char_position] = ""
|
||||
char_position -= 1
|
||||
|
||||
char_position += 1
|
||||
char_position += 1
|
||||
|
||||
return json
|
||||
return json
|
||||
|
|
520
ressources/themes/creature_creation.tres
Normal file
520
ressources/themes/creature_creation.tres
Normal file
|
@ -0,0 +1,520 @@
|
|||
[gd_resource type="Theme" load_steps=17 format=2]
|
||||
|
||||
[ext_resource path="res://assets/interfaces/creatures_creation/creature_creation.png" type="Texture" id=1]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id=1]
|
||||
bg_color = Color( 0.0823529, 0.0666667, 0.258824, 1 )
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id=2]
|
||||
bg_color = Color( 0.27451, 0.239216, 0.862745, 1 )
|
||||
border_width_left = 5
|
||||
border_width_top = 5
|
||||
border_width_right = 5
|
||||
border_width_bottom = 5
|
||||
border_color = Color( 0.0235294, 0.054902, 0.313726, 1 )
|
||||
border_blend = true
|
||||
corner_radius_top_left = 5
|
||||
corner_radius_top_right = 5
|
||||
corner_radius_bottom_right = 5
|
||||
corner_radius_bottom_left = 5
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id=3]
|
||||
bg_color = Color( 0.164706, 0.121569, 0.87451, 1 )
|
||||
border_width_left = 5
|
||||
border_width_top = 5
|
||||
border_width_right = 5
|
||||
border_width_bottom = 5
|
||||
border_color = Color( 0.141176, 0.109804, 0.513726, 1 )
|
||||
border_blend = true
|
||||
corner_radius_top_left = 5
|
||||
corner_radius_top_right = 5
|
||||
corner_radius_bottom_right = 5
|
||||
corner_radius_bottom_left = 5
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id=4]
|
||||
bg_color = Color( 0.129412, 0.0980392, 0.690196, 1 )
|
||||
border_width_left = 5
|
||||
border_width_top = 5
|
||||
border_width_right = 5
|
||||
border_width_bottom = 5
|
||||
border_color = Color( 0.0509804, 0.0352941, 0.266667, 1 )
|
||||
border_blend = true
|
||||
corner_radius_top_left = 5
|
||||
corner_radius_top_right = 5
|
||||
corner_radius_bottom_right = 5
|
||||
corner_radius_bottom_left = 5
|
||||
shadow_color = Color( 0.101961, 0.0862745, 0.411765, 0.717647 )
|
||||
shadow_size = 2
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id=5]
|
||||
bg_color = Color( 0.0823529, 0.0392157, 0.784314, 1 )
|
||||
corner_detail = 1
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id=6]
|
||||
bg_color = Color( 0.109804, 0.0784314, 0.619608, 1 )
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id=7]
|
||||
bg_color = Color( 0.0941176, 0.0666667, 0.501961, 1 )
|
||||
|
||||
[sub_resource type="StyleBoxTexture" id=8]
|
||||
texture = ExtResource( 1 )
|
||||
region_rect = Rect2( 0, 0, 451, 450 )
|
||||
margin_left = 41.9886
|
||||
margin_right = 42.0
|
||||
margin_top = 42.0
|
||||
margin_bottom = 42.0
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id=9]
|
||||
bg_color = Color( 0.0823529, 0.0392157, 0.784314, 1 )
|
||||
border_width_top = 1
|
||||
border_color = Color( 0.0431373, 0.0588235, 0.266667, 1 )
|
||||
border_blend = true
|
||||
corner_radius_top_left = 1
|
||||
corner_radius_top_right = 1
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id=10]
|
||||
bg_color = Color( 0.109804, 0.0784314, 0.619608, 1 )
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id=11]
|
||||
bg_color = Color( 0.0941176, 0.0666667, 0.501961, 1 )
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id=12]
|
||||
bg_color = Color( 0.164706, 0.121569, 0.87451, 1 )
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id=13]
|
||||
bg_color = Color( 0.0823529, 0.0392157, 0.784314, 1 )
|
||||
|
||||
[sub_resource type="StyleBoxTexture" id=14]
|
||||
texture = ExtResource( 1 )
|
||||
region_rect = Rect2( 0, 0, 451, 450 )
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id=15]
|
||||
bg_color = Color( 0.0941176, 0.0666667, 0.501961, 1 )
|
||||
|
||||
[resource]
|
||||
Button/colors/font_color = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
Button/colors/font_color_disabled = Color( 0.384314, 0.231373, 0.0392157, 1 )
|
||||
Button/colors/font_color_hover = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
Button/colors/font_color_pressed = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
Button/constants/hseparation = 2
|
||||
Button/fonts/font = null
|
||||
Button/styles/disabled = SubResource( 1 )
|
||||
Button/styles/focus = null
|
||||
Button/styles/hover = SubResource( 2 )
|
||||
Button/styles/normal = SubResource( 3 )
|
||||
Button/styles/pressed = SubResource( 4 )
|
||||
CheckBox/colors/font_color = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
CheckBox/colors/font_color_disabled = Color( 0.384314, 0.231373, 0.0392157, 1 )
|
||||
CheckBox/colors/font_color_hover = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
CheckBox/colors/font_color_hover_pressed = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
CheckBox/colors/font_color_pressed = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
CheckBox/constants/check_vadjust = 0
|
||||
CheckBox/constants/hseparation = 4
|
||||
CheckBox/fonts/font = null
|
||||
CheckBox/icons/checked = null
|
||||
CheckBox/icons/radio_checked = null
|
||||
CheckBox/icons/radio_unchecked = null
|
||||
CheckBox/icons/unchecked = null
|
||||
CheckBox/styles/disabled = null
|
||||
CheckBox/styles/focus = null
|
||||
CheckBox/styles/hover = null
|
||||
CheckBox/styles/hover_pressed = null
|
||||
CheckBox/styles/normal = null
|
||||
CheckBox/styles/pressed = null
|
||||
CheckButton/colors/font_color = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
CheckButton/colors/font_color_disabled = Color( 0.384314, 0.231373, 0.0392157, 1 )
|
||||
CheckButton/colors/font_color_hover = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
CheckButton/colors/font_color_hover_pressed = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
CheckButton/colors/font_color_pressed = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
CheckButton/constants/check_vadjust = 0
|
||||
CheckButton/constants/hseparation = 4
|
||||
CheckButton/fonts/font = null
|
||||
CheckButton/icons/off = null
|
||||
CheckButton/icons/off_disabled = null
|
||||
CheckButton/icons/on = null
|
||||
CheckButton/icons/on_disabled = null
|
||||
CheckButton/styles/disabled = null
|
||||
CheckButton/styles/focus = null
|
||||
CheckButton/styles/hover = null
|
||||
CheckButton/styles/hover_pressed = null
|
||||
CheckButton/styles/normal = null
|
||||
CheckButton/styles/pressed = null
|
||||
ColorPicker/constants/h_width = 30
|
||||
ColorPicker/constants/label_width = 10
|
||||
ColorPicker/constants/margin = 4
|
||||
ColorPicker/constants/sv_height = 256
|
||||
ColorPicker/constants/sv_width = 256
|
||||
ColorPicker/icons/add_preset = null
|
||||
ColorPicker/icons/color_hue = null
|
||||
ColorPicker/icons/color_sample = null
|
||||
ColorPicker/icons/overbright_indicator = null
|
||||
ColorPicker/icons/preset_bg = null
|
||||
ColorPicker/icons/screen_picker = null
|
||||
ColorPickerButton/colors/font_color = Color( 0, 0, 0, 1 )
|
||||
ColorPickerButton/colors/font_color_disabled = Color( 0, 0, 0, 1 )
|
||||
ColorPickerButton/colors/font_color_hover = Color( 0, 0, 0, 1 )
|
||||
ColorPickerButton/colors/font_color_pressed = Color( 0, 0, 0, 1 )
|
||||
ColorPickerButton/constants/hseparation = 2
|
||||
ColorPickerButton/fonts/font = null
|
||||
ColorPickerButton/icons/bg = null
|
||||
ColorPickerButton/styles/disabled = null
|
||||
ColorPickerButton/styles/focus = null
|
||||
ColorPickerButton/styles/hover = null
|
||||
ColorPickerButton/styles/normal = null
|
||||
ColorPickerButton/styles/pressed = null
|
||||
Dialogs/constants/button_margin = 32
|
||||
Dialogs/constants/margin = 8
|
||||
FileDialog/colors/file_icon_modulate = Color( 0, 0, 0, 1 )
|
||||
FileDialog/colors/files_disabled = Color( 0, 0, 0, 1 )
|
||||
FileDialog/colors/folder_icon_modulate = Color( 0, 0, 0, 1 )
|
||||
FileDialog/icons/file = null
|
||||
FileDialog/icons/folder = null
|
||||
FileDialog/icons/parent_folder = null
|
||||
FileDialog/icons/reload = null
|
||||
FileDialog/icons/toggle_hidden = null
|
||||
Fonts/fonts/large = null
|
||||
Fonts/fonts/normal = null
|
||||
GraphEdit/colors/activity = Color( 0, 0, 0, 1 )
|
||||
GraphEdit/colors/grid_major = Color( 0, 0, 0, 1 )
|
||||
GraphEdit/colors/grid_minor = Color( 0, 0, 0, 1 )
|
||||
GraphEdit/colors/selection_fill = Color( 0, 0, 0, 1 )
|
||||
GraphEdit/colors/selection_stroke = Color( 0, 0, 0, 1 )
|
||||
GraphEdit/constants/bezier_len_neg = 160
|
||||
GraphEdit/constants/bezier_len_pos = 80
|
||||
GraphEdit/constants/port_grab_distance_horizontal = 48
|
||||
GraphEdit/constants/port_grab_distance_vertical = 6
|
||||
GraphEdit/icons/minimap = null
|
||||
GraphEdit/icons/minus = null
|
||||
GraphEdit/icons/more = null
|
||||
GraphEdit/icons/reset = null
|
||||
GraphEdit/icons/snap = null
|
||||
GraphEdit/styles/bg = null
|
||||
GraphEditMinimap/colors/resizer_color = Color( 0, 0, 0, 1 )
|
||||
GraphEditMinimap/icons/resizer = null
|
||||
GraphEditMinimap/styles/bg = null
|
||||
GraphEditMinimap/styles/camera = null
|
||||
GraphEditMinimap/styles/node = null
|
||||
GraphNode/colors/close_color = Color( 0, 0, 0, 1 )
|
||||
GraphNode/colors/resizer_color = Color( 0, 0, 0, 1 )
|
||||
GraphNode/colors/title_color = Color( 0, 0, 0, 1 )
|
||||
GraphNode/constants/close_offset = 18
|
||||
GraphNode/constants/port_offset = 3
|
||||
GraphNode/constants/separation = 1
|
||||
GraphNode/constants/title_offset = 20
|
||||
GraphNode/fonts/title_font = null
|
||||
GraphNode/icons/close = null
|
||||
GraphNode/icons/port = null
|
||||
GraphNode/icons/resizer = null
|
||||
GraphNode/styles/breakpoint = null
|
||||
GraphNode/styles/comment = null
|
||||
GraphNode/styles/commentfocus = null
|
||||
GraphNode/styles/defaultfocus = null
|
||||
GraphNode/styles/defaultframe = null
|
||||
GraphNode/styles/frame = null
|
||||
GraphNode/styles/position = null
|
||||
GraphNode/styles/selectedframe = null
|
||||
GridContainer/constants/hseparation = 4
|
||||
GridContainer/constants/vseparation = 4
|
||||
HBoxContainer/constants/separation = 4
|
||||
HScrollBar/icons/decrement = null
|
||||
HScrollBar/icons/decrement_highlight = null
|
||||
HScrollBar/icons/increment = null
|
||||
HScrollBar/icons/increment_highlight = null
|
||||
HScrollBar/styles/grabber = null
|
||||
HScrollBar/styles/grabber_highlight = null
|
||||
HScrollBar/styles/grabber_pressed = null
|
||||
HScrollBar/styles/scroll = null
|
||||
HScrollBar/styles/scroll_focus = null
|
||||
HSeparator/constants/separation = 4
|
||||
HSeparator/styles/separator = null
|
||||
HSlider/icons/grabber = null
|
||||
HSlider/icons/grabber_disabled = null
|
||||
HSlider/icons/grabber_highlight = null
|
||||
HSlider/icons/tick = null
|
||||
HSlider/styles/grabber_area = null
|
||||
HSlider/styles/grabber_area_highlight = null
|
||||
HSlider/styles/slider = null
|
||||
HSplitContainer/constants/autohide = 1
|
||||
HSplitContainer/constants/separation = 12
|
||||
HSplitContainer/icons/grabber = null
|
||||
HSplitContainer/styles/bg = null
|
||||
Icons/icons/close = null
|
||||
ItemList/colors/font_color = Color( 0, 0, 0, 1 )
|
||||
ItemList/colors/font_color_selected = Color( 0, 0, 0, 1 )
|
||||
ItemList/colors/guide_color = Color( 0, 0, 0, 1 )
|
||||
ItemList/constants/hseparation = 4
|
||||
ItemList/constants/icon_margin = 4
|
||||
ItemList/constants/line_separation = 2
|
||||
ItemList/constants/vseparation = 2
|
||||
ItemList/fonts/font = null
|
||||
ItemList/styles/bg = null
|
||||
ItemList/styles/bg_focus = null
|
||||
ItemList/styles/cursor = null
|
||||
ItemList/styles/cursor_unfocused = null
|
||||
ItemList/styles/selected = null
|
||||
ItemList/styles/selected_focus = null
|
||||
Label/colors/font_color = Color( 0.87451, 0.611765, 0.219608, 1 )
|
||||
Label/colors/font_color_shadow = Color( 0.305882, 0.215686, 0.105882, 1 )
|
||||
Label/colors/font_outline_modulate = Color( 0, 0, 0, 1 )
|
||||
Label/constants/line_spacing = 3
|
||||
Label/constants/shadow_as_outline = 0
|
||||
Label/constants/shadow_offset_x = 1
|
||||
Label/constants/shadow_offset_y = 1
|
||||
Label/fonts/font = null
|
||||
Label/styles/normal = null
|
||||
LineEdit/colors/clear_button_color = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
LineEdit/colors/clear_button_color_pressed = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
LineEdit/colors/cursor_color = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
LineEdit/colors/font_color = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
LineEdit/colors/font_color_selected = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
LineEdit/colors/font_color_uneditable = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
LineEdit/colors/selection_color = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
LineEdit/constants/minimum_spaces = 12
|
||||
LineEdit/fonts/font = null
|
||||
LineEdit/icons/clear = null
|
||||
LineEdit/styles/focus = SubResource( 5 )
|
||||
LineEdit/styles/normal = SubResource( 6 )
|
||||
LineEdit/styles/read_only = SubResource( 7 )
|
||||
LinkButton/colors/font_color = Color( 0, 0, 0, 1 )
|
||||
LinkButton/colors/font_color_hover = Color( 0, 0, 0, 1 )
|
||||
LinkButton/colors/font_color_pressed = Color( 0, 0, 0, 1 )
|
||||
LinkButton/constants/underline_spacing = 2
|
||||
LinkButton/fonts/font = null
|
||||
LinkButton/styles/focus = null
|
||||
MarginContainer/constants/margin_bottom = 0
|
||||
MarginContainer/constants/margin_left = 0
|
||||
MarginContainer/constants/margin_right = 0
|
||||
MarginContainer/constants/margin_top = 0
|
||||
MenuButton/colors/font_color = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
MenuButton/colors/font_color_disabled = Color( 0.384314, 0.231373, 0.0392157, 1 )
|
||||
MenuButton/colors/font_color_hover = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
MenuButton/colors/font_color_pressed = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
MenuButton/constants/hseparation = 3
|
||||
MenuButton/fonts/font = null
|
||||
MenuButton/styles/disabled = null
|
||||
MenuButton/styles/focus = null
|
||||
MenuButton/styles/hover = null
|
||||
MenuButton/styles/normal = null
|
||||
MenuButton/styles/pressed = null
|
||||
OptionButton/colors/font_color = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
OptionButton/colors/font_color_disabled = Color( 0.384314, 0.231373, 0.0392157, 1 )
|
||||
OptionButton/colors/font_color_hover = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
OptionButton/colors/font_color_pressed = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
OptionButton/constants/arrow_margin = 2
|
||||
OptionButton/constants/hseparation = 2
|
||||
OptionButton/fonts/font = null
|
||||
OptionButton/icons/arrow = null
|
||||
OptionButton/styles/disabled = null
|
||||
OptionButton/styles/focus = null
|
||||
OptionButton/styles/hover = null
|
||||
OptionButton/styles/normal = null
|
||||
OptionButton/styles/pressed = null
|
||||
Panel/styles/panel = SubResource( 8 )
|
||||
PanelContainer/styles/panel = null
|
||||
PopupDialog/styles/panel = null
|
||||
PopupMenu/colors/font_color = Color( 0, 0, 0, 1 )
|
||||
PopupMenu/colors/font_color_accel = Color( 0, 0, 0, 1 )
|
||||
PopupMenu/colors/font_color_disabled = Color( 0, 0, 0, 1 )
|
||||
PopupMenu/colors/font_color_hover = Color( 0, 0, 0, 1 )
|
||||
PopupMenu/colors/font_color_separator = Color( 0, 0, 0, 1 )
|
||||
PopupMenu/constants/hseparation = 4
|
||||
PopupMenu/constants/vseparation = 4
|
||||
PopupMenu/fonts/font = null
|
||||
PopupMenu/icons/checked = null
|
||||
PopupMenu/icons/radio_checked = null
|
||||
PopupMenu/icons/radio_unchecked = null
|
||||
PopupMenu/icons/submenu = null
|
||||
PopupMenu/icons/unchecked = null
|
||||
PopupMenu/styles/hover = null
|
||||
PopupMenu/styles/labeled_separator_left = null
|
||||
PopupMenu/styles/labeled_separator_right = null
|
||||
PopupMenu/styles/panel = null
|
||||
PopupMenu/styles/panel_disabled = null
|
||||
PopupMenu/styles/separator = null
|
||||
PopupPanel/styles/panel = null
|
||||
ProgressBar/colors/font_color = Color( 0, 0, 0, 1 )
|
||||
ProgressBar/colors/font_color_shadow = Color( 0, 0, 0, 1 )
|
||||
ProgressBar/fonts/font = null
|
||||
ProgressBar/styles/bg = null
|
||||
ProgressBar/styles/fg = null
|
||||
RichTextLabel/colors/default_color = Color( 0, 0, 0, 1 )
|
||||
RichTextLabel/colors/font_color_selected = Color( 0, 0, 0, 1 )
|
||||
RichTextLabel/colors/font_color_shadow = Color( 0, 0, 0, 1 )
|
||||
RichTextLabel/colors/selection_color = Color( 0, 0, 0, 1 )
|
||||
RichTextLabel/constants/line_separation = 1
|
||||
RichTextLabel/constants/shadow_as_outline = 0
|
||||
RichTextLabel/constants/shadow_offset_x = 1
|
||||
RichTextLabel/constants/shadow_offset_y = 1
|
||||
RichTextLabel/constants/table_hseparation = 3
|
||||
RichTextLabel/constants/table_vseparation = 3
|
||||
RichTextLabel/fonts/bold_font = null
|
||||
RichTextLabel/fonts/bold_italics_font = null
|
||||
RichTextLabel/fonts/italics_font = null
|
||||
RichTextLabel/fonts/mono_font = null
|
||||
RichTextLabel/fonts/normal_font = null
|
||||
RichTextLabel/styles/focus = null
|
||||
RichTextLabel/styles/normal = null
|
||||
ScrollContainer/styles/bg = null
|
||||
SpinBox/icons/updown = null
|
||||
TabContainer/colors/font_color_bg = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
TabContainer/colors/font_color_disabled = Color( 0.384314, 0.231373, 0.0392157, 1 )
|
||||
TabContainer/colors/font_color_fg = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
TabContainer/constants/hseparation = 4
|
||||
TabContainer/constants/label_valign_bg = 2
|
||||
TabContainer/constants/label_valign_fg = 0
|
||||
TabContainer/constants/side_margin = 8
|
||||
TabContainer/constants/top_margin = 24
|
||||
TabContainer/fonts/font = null
|
||||
TabContainer/icons/decrement = null
|
||||
TabContainer/icons/decrement_highlight = null
|
||||
TabContainer/icons/increment = null
|
||||
TabContainer/icons/increment_highlight = null
|
||||
TabContainer/icons/menu = null
|
||||
TabContainer/icons/menu_highlight = null
|
||||
TabContainer/styles/panel = SubResource( 9 )
|
||||
TabContainer/styles/tab_bg = SubResource( 10 )
|
||||
TabContainer/styles/tab_disabled = SubResource( 11 )
|
||||
TabContainer/styles/tab_fg = SubResource( 12 )
|
||||
Tabs/colors/font_color_bg = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
Tabs/colors/font_color_disabled = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
Tabs/colors/font_color_fg = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
Tabs/constants/hseparation = 4
|
||||
Tabs/constants/label_valign_bg = 2
|
||||
Tabs/constants/label_valign_fg = 0
|
||||
Tabs/constants/top_margin = 24
|
||||
Tabs/fonts/font = null
|
||||
Tabs/icons/close = null
|
||||
Tabs/icons/decrement = null
|
||||
Tabs/icons/decrement_highlight = null
|
||||
Tabs/icons/increment = null
|
||||
Tabs/icons/increment_highlight = null
|
||||
Tabs/styles/button = null
|
||||
Tabs/styles/button_pressed = null
|
||||
Tabs/styles/panel = null
|
||||
Tabs/styles/tab_bg = null
|
||||
Tabs/styles/tab_disabled = null
|
||||
Tabs/styles/tab_fg = null
|
||||
TextEdit/colors/background_color = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
TextEdit/colors/bookmark_color = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
TextEdit/colors/brace_mismatch_color = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
TextEdit/colors/breakpoint_color = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
TextEdit/colors/caret_background_color = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
TextEdit/colors/caret_color = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
TextEdit/colors/code_folding_color = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
TextEdit/colors/completion_background_color = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
TextEdit/colors/completion_existing_color = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
TextEdit/colors/completion_font_color = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
TextEdit/colors/completion_scroll_color = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
TextEdit/colors/completion_selected_color = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
TextEdit/colors/current_line_color = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
TextEdit/colors/executing_line_color = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
TextEdit/colors/font_color = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
TextEdit/colors/font_color_readonly = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
TextEdit/colors/font_color_selected = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
TextEdit/colors/function_color = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
TextEdit/colors/line_number_color = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
TextEdit/colors/mark_color = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
TextEdit/colors/member_variable_color = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
TextEdit/colors/number_color = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
TextEdit/colors/safe_line_number_color = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
TextEdit/colors/selection_color = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
TextEdit/colors/symbol_color = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
TextEdit/colors/word_highlighted_color = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
TextEdit/constants/completion_lines = 7
|
||||
TextEdit/constants/completion_max_width = 50
|
||||
TextEdit/constants/completion_scroll_width = 3
|
||||
TextEdit/constants/line_spacing = 4
|
||||
TextEdit/fonts/font = null
|
||||
TextEdit/icons/fold = null
|
||||
TextEdit/icons/folded = null
|
||||
TextEdit/icons/space = null
|
||||
TextEdit/icons/tab = null
|
||||
TextEdit/styles/completion = null
|
||||
TextEdit/styles/focus = null
|
||||
TextEdit/styles/normal = SubResource( 13 )
|
||||
TextEdit/styles/read_only = null
|
||||
ToolButton/colors/font_color = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
ToolButton/colors/font_color_disabled = Color( 0.384314, 0.231373, 0.0392157, 1 )
|
||||
ToolButton/colors/font_color_hover = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
ToolButton/colors/font_color_pressed = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
ToolButton/constants/hseparation = 3
|
||||
ToolButton/fonts/font = null
|
||||
ToolButton/styles/disabled = null
|
||||
ToolButton/styles/focus = null
|
||||
ToolButton/styles/hover = null
|
||||
ToolButton/styles/normal = null
|
||||
ToolButton/styles/pressed = null
|
||||
TooltipLabel/colors/font_color = Color( 0, 0, 0, 1 )
|
||||
TooltipLabel/colors/font_color_shadow = Color( 0, 0, 0, 1 )
|
||||
TooltipLabel/constants/shadow_offset_x = 1
|
||||
TooltipLabel/constants/shadow_offset_y = 1
|
||||
TooltipLabel/fonts/font = null
|
||||
TooltipPanel/styles/panel = SubResource( 14 )
|
||||
Tree/colors/custom_button_font_highlight = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
Tree/colors/drop_position_color = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
Tree/colors/font_color = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
Tree/colors/font_color_selected = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
Tree/colors/guide_color = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
Tree/colors/relationship_line_color = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
Tree/colors/title_button_color = Color( 0.878431, 0.529412, 0.0784314, 1 )
|
||||
Tree/constants/button_margin = 4
|
||||
Tree/constants/draw_guides = 1
|
||||
Tree/constants/draw_relationship_lines = 0
|
||||
Tree/constants/hseparation = 4
|
||||
Tree/constants/item_margin = 12
|
||||
Tree/constants/scroll_border = 4
|
||||
Tree/constants/scroll_speed = 12
|
||||
Tree/constants/vseparation = 4
|
||||
Tree/fonts/font = null
|
||||
Tree/fonts/title_button_font = null
|
||||
Tree/icons/arrow = null
|
||||
Tree/icons/arrow_collapsed = null
|
||||
Tree/icons/checked = null
|
||||
Tree/icons/select_arrow = null
|
||||
Tree/icons/unchecked = null
|
||||
Tree/icons/updown = null
|
||||
Tree/styles/bg = SubResource( 15 )
|
||||
Tree/styles/bg_focus = null
|
||||
Tree/styles/button_pressed = null
|
||||
Tree/styles/cursor = null
|
||||
Tree/styles/cursor_unfocused = null
|
||||
Tree/styles/custom_button = null
|
||||
Tree/styles/custom_button_hover = null
|
||||
Tree/styles/custom_button_pressed = null
|
||||
Tree/styles/selected = null
|
||||
Tree/styles/selected_focus = null
|
||||
Tree/styles/title_button_hover = null
|
||||
Tree/styles/title_button_normal = null
|
||||
Tree/styles/title_button_pressed = null
|
||||
VBoxContainer/constants/separation = 4
|
||||
VScrollBar/icons/decrement = null
|
||||
VScrollBar/icons/decrement_highlight = null
|
||||
VScrollBar/icons/increment = null
|
||||
VScrollBar/icons/increment_highlight = null
|
||||
VScrollBar/styles/grabber = null
|
||||
VScrollBar/styles/grabber_highlight = null
|
||||
VScrollBar/styles/grabber_pressed = null
|
||||
VScrollBar/styles/scroll = null
|
||||
VScrollBar/styles/scroll_focus = null
|
||||
VSeparator/constants/separation = 4
|
||||
VSeparator/styles/separator = null
|
||||
VSlider/icons/grabber = null
|
||||
VSlider/icons/grabber_disabled = null
|
||||
VSlider/icons/grabber_highlight = null
|
||||
VSlider/icons/tick = null
|
||||
VSlider/styles/grabber_area = null
|
||||
VSlider/styles/grabber_area_highlight = null
|
||||
VSlider/styles/slider = null
|
||||
VSplitContainer/constants/autohide = 1
|
||||
VSplitContainer/constants/separation = 12
|
||||
VSplitContainer/icons/grabber = null
|
||||
VSplitContainer/styles/bg = null
|
||||
WindowDialog/colors/title_color = Color( 0, 0, 0, 1 )
|
||||
WindowDialog/constants/close_h_ofs = 18
|
||||
WindowDialog/constants/close_v_ofs = 18
|
||||
WindowDialog/constants/scaleborder_size = 4
|
||||
WindowDialog/constants/title_height = 20
|
||||
WindowDialog/fonts/title_font = null
|
||||
WindowDialog/icons/close = null
|
||||
WindowDialog/icons/close_highlight = null
|
||||
WindowDialog/styles/panel = null
|
Binary file not shown.
8
scenes/creature_creation/arche.tscn
Normal file
8
scenes/creature_creation/arche.tscn
Normal file
|
@ -0,0 +1,8 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://assets/creatures/arche/arche.tscn" type="PackedScene" id=1]
|
||||
|
||||
[node name="spatial" type="Spatial"]
|
||||
|
||||
[node name="creature" parent="." instance=ExtResource( 1 )]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )
|
35
scenes/creature_creation/creature.gd
Normal file
35
scenes/creature_creation/creature.gd
Normal file
|
@ -0,0 +1,35 @@
|
|||
extends Spatial
|
||||
|
||||
var direction = Vector3.ZERO
|
||||
var rotation_speed_factor = 0.01
|
||||
var orientation = 0.0
|
||||
|
||||
|
||||
func _process2( delta ):
|
||||
#var forwards: Vector3 = $look_at.global_transform.basis.z * direction.z
|
||||
#var right: Vector3 = $look_at.global_transform.basis.x * direction.x
|
||||
#if forwards:
|
||||
# right = Vector3.ZERO
|
||||
# var move_direction: = forwards + right
|
||||
# if move_direction.length() > 1.0:
|
||||
# move_direction = move_direction.normalized()
|
||||
# move_direction.y = 0
|
||||
|
||||
#Config.msg_debug("delta:" + str(delta))
|
||||
# Rotation.
|
||||
# if (self.has_node( "creature" ) and $creature.can_turn()) or self.is_readying_weapon or self.is_weapon_ready:
|
||||
# self.rotate_y( rotation_speed_factor * orientation )
|
||||
|
||||
# Animation.
|
||||
#if self.has_node( "creature" ):
|
||||
# Config.msg_debug("delta:" + str(delta))
|
||||
for i in self.get_children():
|
||||
# print("> " + i.get_name())
|
||||
for ii in i.get_children():
|
||||
# print(">> " + ii.get_name())
|
||||
if ii.get_name() == "AnimationPlayer":
|
||||
ii.play( "idle" )
|
||||
# for iii in ii.get_children():
|
||||
# print(">>> " + iii.get_name())
|
||||
#$creature.AnimationPlayer.play( "idle" )
|
||||
#$creature.play( "idle" )
|
7
scenes/creature_creation/creature.tscn
Normal file
7
scenes/creature_creation/creature.tscn
Normal file
|
@ -0,0 +1,7 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://assets/creatures/arche/arche.tscn" type="PackedScene" id=1]
|
||||
|
||||
[node name="spatial" type="Spatial"]
|
||||
|
||||
[node name="arche" parent="." instance=ExtResource( 1 )]
|
125
scenes/creature_creation/creature_creation.gd
Normal file
125
scenes/creature_creation/creature_creation.gd
Normal file
|
@ -0,0 +1,125 @@
|
|||
extends Spatial
|
||||
|
||||
|
||||
var animation_object = null
|
||||
var orientation = 0.0
|
||||
var blend_shapes = {}
|
||||
|
||||
|
||||
func search_animation( obj ) -> bool:
|
||||
var ret:bool = false
|
||||
for i in obj.get_children():
|
||||
if i.get_name() == "AnimationPlayer":
|
||||
animation_object = i
|
||||
return true
|
||||
else:
|
||||
ret = search_animation(i)
|
||||
if ret == true:
|
||||
return ret
|
||||
return false
|
||||
|
||||
|
||||
func list_child( obj, father = "" ):
|
||||
for i in obj.get_children():
|
||||
var root = father + "." + str(i.name)
|
||||
Config.msg_debug(root)
|
||||
if i is MeshInstance:
|
||||
Config.msg_debug(root + " -> MeshInstance")
|
||||
for key in i.get_property_list():
|
||||
Config.msg_debug( "property:" + str(key))
|
||||
list_child( i, root)
|
||||
|
||||
|
||||
|
||||
func list_blend_shapes( obj, father = "" ) -> Array:
|
||||
var ret:Array
|
||||
for i in obj.get_children():
|
||||
var root = father + "." + str(i.name)
|
||||
if i is MeshInstance:
|
||||
for key in i.get_property_list():
|
||||
if key.name.substr(0, 13) == "blend_shapes/":
|
||||
# Config.msg_debug( father + "." + i.name + " - " + key.name.substr(13) )
|
||||
ret.append(key.name.substr(13))
|
||||
list_blend_shapes( i, root)
|
||||
return ret
|
||||
|
||||
func update_blend_shapes_step( obj, father = "" ):
|
||||
for i in obj.get_children():
|
||||
var root = father + str(i.name) + "."
|
||||
if i is MeshInstance:
|
||||
for key in i.get_property_list():
|
||||
if key.name.substr(0, 13) == "blend_shapes/":
|
||||
var blend = key.name.substr(13)
|
||||
# Config.msg_debug( father + i.name + " - " + key.name.substr(13) )
|
||||
if not blend_shapes.has(blend):
|
||||
blend_shapes[blend] = []
|
||||
blend_shapes[blend].append(i)
|
||||
update_blend_shapes_step( i, root)
|
||||
|
||||
|
||||
func update_blend_shapes( obj ):
|
||||
blend_shapes = {}
|
||||
update_blend_shapes_step(obj, "")
|
||||
# for key in blend_shapes:
|
||||
# Config.msg_debug("key:" + key + " = " + str(blend_shapes[key]))
|
||||
$control.update_property(blend_shapes)
|
||||
|
||||
|
||||
func _ready():
|
||||
$control.connect("update_blend" , self, "_on_update_property")
|
||||
$control.connect( "select_race", self, "_on_select_race" )
|
||||
self.change_creature( "res://scenes/creature_creation/arche.tscn" )
|
||||
search_animation(self)
|
||||
update_blend_shapes($creature)
|
||||
|
||||
|
||||
func _process( delta ):
|
||||
animation_object.play( "idle" )
|
||||
|
||||
|
||||
func _input( event ):
|
||||
# Config.msg_debug(str(event))
|
||||
if event is InputEventMouseMotion and Input.is_mouse_button_pressed( 2 ):
|
||||
if $creature:
|
||||
$creature.rotate_y( event.relative.x *0.01 )
|
||||
|
||||
|
||||
func change_creature( new_model_path ):
|
||||
if $creature:
|
||||
var old_model = $creature
|
||||
self.remove_child( old_model )
|
||||
old_model.queue_free()
|
||||
var new_model = load( new_model_path )
|
||||
if new_model:
|
||||
new_model = new_model.instance()
|
||||
new_model.name = "creature"
|
||||
self.add_child( new_model )
|
||||
#new_model.connect( "animation_finished", self, "_on_creature_animation_finished" )
|
||||
#new_model.duplicate_meshes()
|
||||
|
||||
|
||||
func _on_select_race( race ):
|
||||
Config.msg_debug(race)
|
||||
match race:
|
||||
"arche":
|
||||
self.change_creature( "res://scenes/creature_creation/arche.tscn" )
|
||||
"isidor":
|
||||
self.change_creature( "res://scenes/creature_creation/isidor.tscn" )
|
||||
_:
|
||||
self.change_creature( "res://scenes/creature_creation/arche.tscn" )
|
||||
search_animation(self)
|
||||
update_blend_shapes($creature)
|
||||
# for child in $creature.get_children():
|
||||
# Config.msg_debug("Child / name:" + child.name)
|
||||
# list_child($creature)
|
||||
# var skeleton = child.get_node( "skeleton" )
|
||||
# for node in skeleton.get_children():
|
||||
# if node is MeshInstance:
|
||||
# Config.msg_debug("Node / name:" + node.name)
|
||||
# #node.set( "blend_shapes/"+p_blend_shape_name, p_value )
|
||||
|
||||
|
||||
func _on_update_property(name_property, value):
|
||||
Config.msg_debug( name_property + ": " + str(value) )
|
||||
for i in blend_shapes[name_property]:
|
||||
i.set( "blend_shapes/"+name_property, value )
|
26
scenes/creature_creation/creature_creation.tscn
Normal file
26
scenes/creature_creation/creature_creation.tscn
Normal file
|
@ -0,0 +1,26 @@
|
|||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://scenes/creature_creation/creature_creation_menu.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://scenes/creature_creation/creature.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://scenes/creature_creation/creature.gd" type="Script" id=3]
|
||||
[ext_resource path="res://scenes/creature_creation/creature_creation.gd" type="Script" id=4]
|
||||
|
||||
[node name="creature_creation" type="Spatial"]
|
||||
script = ExtResource( 4 )
|
||||
|
||||
[node name="control" parent="." instance=ExtResource( 1 )]
|
||||
size_flags_horizontal = 1
|
||||
size_flags_vertical = 1
|
||||
|
||||
[node name="camera" type="Camera" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -1.57491, 1.49725, 3 )
|
||||
projection = 1
|
||||
current = true
|
||||
size = 4.0
|
||||
|
||||
[node name="directional_light" type="DirectionalLight" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.20866, 2.21448 )
|
||||
light_energy = 2.0
|
||||
|
||||
[node name="creature" parent="." instance=ExtResource( 2 )]
|
||||
script = ExtResource( 3 )
|
166
scenes/creature_creation/creature_creation_menu.gd
Normal file
166
scenes/creature_creation/creature_creation_menu.gd
Normal file
|
@ -0,0 +1,166 @@
|
|||
extends Control
|
||||
|
||||
|
||||
signal select_race(race)
|
||||
signal update_blend(name_property, value)
|
||||
|
||||
var rng = RandomNumberGenerator.new()
|
||||
var current_race = "arche"
|
||||
|
||||
const syllabe = ["ba", "be", "bi", "bo", "bu", "bou",
|
||||
"ca", "ce", "ci", "co", "cu", "cou",
|
||||
"da", "de", "di", "do", "du", "dou",
|
||||
"fa", "fe", "fi", "fo", "fu", "fou",
|
||||
"ga", "ge", "gi", "go", "gu", "gou",
|
||||
"ha", "he", "hi", "ho", "hu", "hou",
|
||||
"ja", "je", "ji", "jo", "ju", "jou",
|
||||
"ka", "ke", "ki", "ko", "ku", "kou",
|
||||
"la", "le", "li", "lo", "lu", "lou",
|
||||
"ma", "me", "mi", "mo", "mu", "mou",
|
||||
"na", "ne", "ni", "no", "nu", "nou",
|
||||
"ma", "me", "mi", "mo", "mu", "mou",
|
||||
"pa", "pe", "pi", "po", "pu", "pou",
|
||||
"ra", "re", "ri", "ro", "ru", "rou",
|
||||
"sa", "se", "si", "so", "su", "sou",
|
||||
"ta", "te", "ti", "to", "tu", "tou",
|
||||
"va", "ve", "vi", "vo", "vu", "vou"
|
||||
]
|
||||
|
||||
func _ready():
|
||||
rng.randomize()
|
||||
$create/diplay/panel_left/margin/property.hide()
|
||||
$create/diplay/panel_left/margin/name.hide()
|
||||
$create/diplay/panel_left/margin/race.show()
|
||||
|
||||
|
||||
func _on_arche_pressed():
|
||||
current_race = "arche"
|
||||
emit_signal("select_race", current_race)
|
||||
|
||||
|
||||
func _on_isidor_pressed():
|
||||
current_race = "isidor"
|
||||
emit_signal("select_race", current_race)
|
||||
|
||||
|
||||
func _on_quit_pressed():
|
||||
Config.msg_debug("Quit")
|
||||
# emit_signal( "quit_pressed" )
|
||||
Globals.goto_scene( "res://scenes/interfaces/creatures_menu/creatures_menu_ui.tscn" )
|
||||
|
||||
|
||||
func _on_race_next_pressed():
|
||||
$create/diplay/panel_left/margin/race.hide()
|
||||
$create/diplay/panel_left/margin/property.hide()
|
||||
$create/diplay/panel_left/margin/name.show()
|
||||
|
||||
|
||||
func _on_name_previous_pressed():
|
||||
$create/diplay/panel_left/margin/property.hide()
|
||||
$create/diplay/panel_left/margin/name.hide()
|
||||
$create/diplay/panel_left/margin/race.show()
|
||||
|
||||
|
||||
func _on_name_next_pressed():
|
||||
$create/diplay/panel_left/margin/race.hide()
|
||||
$create/diplay/panel_left/margin/name.hide()
|
||||
$create/diplay/panel_left/margin/property.show()
|
||||
|
||||
|
||||
func _on_property_previous_pressed():
|
||||
$create/diplay/panel_left/margin/property.hide()
|
||||
$create/diplay/panel_left/margin/race.hide()
|
||||
$create/diplay/panel_left/margin/name.show()
|
||||
|
||||
|
||||
func _on_property_next_pressed():
|
||||
Config.msg_debug("First name: " + $create/diplay/panel_left/margin/name/v_box_container/FirstName/line_edit.text)
|
||||
Config.msg_debug("Last name: " + $create/diplay/panel_left/margin/name/v_box_container/LastName/line_edit.text)
|
||||
for key in $create/diplay/panel_left/margin/property/panel/blend_shape/list.get_children():
|
||||
for pop in key.get_children():
|
||||
if pop is HBoxContainer:
|
||||
Config.msg_debug( str(pop.name_property) + ": " + str(pop.get_node("property").value) )
|
||||
|
||||
|
||||
func generate_name_key(minsyllabe:int, maxsyllabe:int, start:Array = [], end:Array = []) -> String:
|
||||
var nbsyllabe = rng.randi_range(minsyllabe, maxsyllabe)
|
||||
var last = rng.randi_range(0, end.size()-1)
|
||||
var ret = ""
|
||||
for _i in range(0, nbsyllabe):
|
||||
var x = rng.randi_range(0, syllabe.size()-1)
|
||||
ret += syllabe[x]
|
||||
if end.size() > 0:
|
||||
ret += end[last]
|
||||
return ret
|
||||
|
||||
|
||||
func generate_name():
|
||||
var first_name: String = ""
|
||||
var last_name: String = ""
|
||||
match current_race:
|
||||
"arche":
|
||||
first_name = generate_name_key(1, 3, [], ["par", "tar", "lar", "nar", "var", "xar", "rar", "sar"])
|
||||
last_name = generate_name_key(2, 5)
|
||||
"isidor":
|
||||
first_name = generate_name_key(1, 3, [], ["por", "tor", "lor", "nor"])
|
||||
last_name = generate_name_key(2, 5)
|
||||
_:
|
||||
first_name = "paf"
|
||||
last_name = "pouf"
|
||||
$create/diplay/panel_left/margin/name/v_box_container/FirstName/line_edit.text = first_name
|
||||
$create/diplay/panel_left/margin/name/v_box_container/LastName/line_edit.text = last_name
|
||||
|
||||
func update_property( blend_shapes ):
|
||||
#Config.msg_debug("")
|
||||
for child in $create/diplay/panel_left/margin/property/panel/blend_shape/list.get_children():
|
||||
$create/diplay/panel_left/margin/property/panel/blend_shape/list.remove_child(child)
|
||||
# var list_group:Array = []
|
||||
var list:Dictionary = {}
|
||||
var tab:PoolStringArray
|
||||
var global_box = preload( "res://scenes/creature_creation/property_label.tscn" ).instance()
|
||||
global_box.get_node("label" ).text = "General"
|
||||
$create/diplay/panel_left/margin/property/panel/blend_shape/list.add_child(global_box)
|
||||
list["General"] = global_box
|
||||
for key in blend_shapes:
|
||||
tab = key.split("/", true, 1)
|
||||
#Config.msg_debug(key + " : " + str(tab.size()) )
|
||||
if tab.size() == 2:
|
||||
if not list.has(tab[0]):
|
||||
var property_label_box = preload( "res://scenes/creature_creation/property_label.tscn" ).instance()
|
||||
property_label_box.get_node("label" ).text = tab[0]
|
||||
$create/diplay/panel_left/margin/property/panel/blend_shape/list.add_child(property_label_box)
|
||||
list[tab[0]] = property_label_box
|
||||
for key in blend_shapes:
|
||||
var blend_shapes_box = preload( "res://scenes/creature_creation/property_box.tscn" ).instance()
|
||||
var name_prop = key
|
||||
tab = key.split("/", true, 1)
|
||||
if tab.size() == 2:
|
||||
name_prop = tab[1]
|
||||
blend_shapes_box.name_property = key
|
||||
blend_shapes_box.get_node( "label" ).text = name_prop
|
||||
blend_shapes_box.get_node( "property" ).min_value = 0.0
|
||||
blend_shapes_box.get_node( "property" ).max_value = 1.0
|
||||
blend_shapes_box.get_node( "property" ).step = 0.01
|
||||
blend_shapes_box.get_node( "property" ).value = 0.0
|
||||
blend_shapes_box.connect( "changed", self, "_on_creature_update_property" )
|
||||
tab = key.split("/", true, 1)
|
||||
if tab.size() == 2:
|
||||
list[tab[0]].add_child(blend_shapes_box)
|
||||
else:
|
||||
list["General"].add_child(blend_shapes_box)
|
||||
for key in list:
|
||||
for i in list[key].get_children():
|
||||
if i.has_node("property"):
|
||||
var vf = rng.randf_range(0.0, 100.0) / 100.0
|
||||
Config.msg_debug("de:" + str(vf))
|
||||
i.get_node( "property" ).value = vf
|
||||
generate_name()
|
||||
|
||||
|
||||
func _on_creature_update_property(key, name_property):
|
||||
Config.msg_debug( name_property + ": " + str(key))
|
||||
emit_signal( "update_blend", name_property, key )
|
||||
|
||||
|
||||
func _on_generate_name_pressed():
|
||||
generate_name()
|
286
scenes/creature_creation/creature_creation_menu.tscn
Normal file
286
scenes/creature_creation/creature_creation_menu.tscn
Normal file
|
@ -0,0 +1,286 @@
|
|||
[gd_scene load_steps=6 format=2]
|
||||
|
||||
[ext_resource path="res://scenes/creature_creation/creature_creation_menu.gd" type="Script" id=1]
|
||||
[ext_resource path="res://ressources/themes/creature_creation.tres" type="Theme" id=2]
|
||||
[ext_resource path="res://assets/interfaces/next.png" type="Texture" id=3]
|
||||
[ext_resource path="res://assets/interfaces/rollback.png" type="Texture" id=4]
|
||||
[ext_resource path="res://assets/interfaces/previous.png" type="Texture" id=5]
|
||||
|
||||
[node name="control" type="Control"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
theme = ExtResource( 2 )
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="create" type="MarginContainer" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
custom_constants/margin_right = 50
|
||||
custom_constants/margin_top = 50
|
||||
custom_constants/margin_left = 50
|
||||
custom_constants/margin_bottom = 50
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="diplay" type="HBoxContainer" parent="create"]
|
||||
margin_left = 50.0
|
||||
margin_top = 50.0
|
||||
margin_right = 1230.0
|
||||
margin_bottom = 670.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="panel_left" type="Panel" parent="create/diplay"]
|
||||
margin_right = 588.0
|
||||
margin_bottom = 620.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="margin" type="MarginContainer" parent="create/diplay/panel_left"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_top = 1.49829
|
||||
margin_bottom = 1.49829
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
custom_constants/margin_right = 50
|
||||
custom_constants/margin_top = 50
|
||||
custom_constants/margin_left = 50
|
||||
custom_constants/margin_bottom = 50
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="race" type="VBoxContainer" parent="create/diplay/panel_left/margin"]
|
||||
visible = false
|
||||
margin_left = 50.0
|
||||
margin_top = 50.0
|
||||
margin_right = 538.0
|
||||
margin_bottom = 570.0
|
||||
|
||||
[node name="creature_creation" type="VBoxContainer" parent="create/diplay/panel_left/margin/race"]
|
||||
margin_right = 488.0
|
||||
margin_bottom = 106.0
|
||||
|
||||
[node name="label" type="Label" parent="create/diplay/panel_left/margin/race/creature_creation"]
|
||||
margin_right = 488.0
|
||||
margin_bottom = 14.0
|
||||
size_flags_horizontal = 5
|
||||
text = "CREATURE_CREATION_CHOICE_RACE"
|
||||
align = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="label_2" type="Label" parent="create/diplay/panel_left/margin/race/creature_creation"]
|
||||
margin_top = 18.0
|
||||
margin_right = 488.0
|
||||
margin_bottom = 32.0
|
||||
text = " "
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="arche" type="Button" parent="create/diplay/panel_left/margin/race/creature_creation"]
|
||||
margin_top = 36.0
|
||||
margin_right = 488.0
|
||||
margin_bottom = 60.0
|
||||
text = "Arche"
|
||||
|
||||
[node name="label_3" type="Label" parent="create/diplay/panel_left/margin/race/creature_creation"]
|
||||
margin_top = 64.0
|
||||
margin_right = 488.0
|
||||
margin_bottom = 78.0
|
||||
|
||||
[node name="isidor" type="Button" parent="create/diplay/panel_left/margin/race/creature_creation"]
|
||||
margin_top = 82.0
|
||||
margin_right = 488.0
|
||||
margin_bottom = 106.0
|
||||
text = "Isidor"
|
||||
|
||||
[node name="h_box_container" type="HBoxContainer" parent="create/diplay/panel_left/margin/race"]
|
||||
margin_top = 488.0
|
||||
margin_right = 488.0
|
||||
margin_bottom = 520.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 10
|
||||
|
||||
[node name="quit" type="TextureButton" parent="create/diplay/panel_left/margin/race/h_box_container"]
|
||||
margin_right = 32.0
|
||||
margin_bottom = 32.0
|
||||
texture_normal = ExtResource( 4 )
|
||||
|
||||
[node name="next" type="TextureButton" parent="create/diplay/panel_left/margin/race/h_box_container"]
|
||||
margin_left = 456.0
|
||||
margin_right = 488.0
|
||||
margin_bottom = 32.0
|
||||
size_flags_horizontal = 10
|
||||
texture_normal = ExtResource( 3 )
|
||||
|
||||
[node name="name" type="VBoxContainer" parent="create/diplay/panel_left/margin"]
|
||||
margin_left = 50.0
|
||||
margin_top = 50.0
|
||||
margin_right = 538.0
|
||||
margin_bottom = 570.0
|
||||
|
||||
[node name="v_box_container" type="VBoxContainer" parent="create/diplay/panel_left/margin/name"]
|
||||
margin_top = 203.0
|
||||
margin_right = 488.0
|
||||
margin_bottom = 281.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 6
|
||||
|
||||
[node name="generate_name" type="Button" parent="create/diplay/panel_left/margin/name/v_box_container"]
|
||||
margin_left = 114.0
|
||||
margin_right = 374.0
|
||||
margin_bottom = 24.0
|
||||
size_flags_horizontal = 4
|
||||
text = "CREATURE_CREATION_GENERATE_NAME"
|
||||
|
||||
[node name="label" type="Label" parent="create/diplay/panel_left/margin/name/v_box_container"]
|
||||
margin_top = 28.0
|
||||
margin_right = 488.0
|
||||
margin_bottom = 42.0
|
||||
|
||||
[node name="FirstName" type="HBoxContainer" parent="create/diplay/panel_left/margin/name/v_box_container"]
|
||||
margin_top = 46.0
|
||||
margin_right = 488.0
|
||||
margin_bottom = 60.0
|
||||
|
||||
[node name="label" type="Label" parent="create/diplay/panel_left/margin/name/v_box_container/FirstName"]
|
||||
margin_left = 23.0
|
||||
margin_right = 242.0
|
||||
margin_bottom = 14.0
|
||||
size_flags_horizontal = 10
|
||||
text = "CREATURE_CREATION_FIRST_NAME"
|
||||
|
||||
[node name="line_edit" type="LineEdit" parent="create/diplay/panel_left/margin/name/v_box_container/FirstName"]
|
||||
margin_left = 246.0
|
||||
margin_right = 488.0
|
||||
margin_bottom = 14.0
|
||||
size_flags_horizontal = 3
|
||||
placeholder_text = "FIRST_NAME"
|
||||
|
||||
[node name="LastName" type="HBoxContainer" parent="create/diplay/panel_left/margin/name/v_box_container"]
|
||||
margin_top = 64.0
|
||||
margin_right = 488.0
|
||||
margin_bottom = 78.0
|
||||
|
||||
[node name="label" type="Label" parent="create/diplay/panel_left/margin/name/v_box_container/LastName"]
|
||||
margin_left = 27.0
|
||||
margin_right = 242.0
|
||||
margin_bottom = 14.0
|
||||
size_flags_horizontal = 10
|
||||
text = "CREATURE_CREATION_LAST_NAME"
|
||||
|
||||
[node name="line_edit" type="LineEdit" parent="create/diplay/panel_left/margin/name/v_box_container/LastName"]
|
||||
margin_left = 246.0
|
||||
margin_right = 488.0
|
||||
margin_bottom = 14.0
|
||||
size_flags_horizontal = 3
|
||||
placeholder_text = "LAST_NAME"
|
||||
|
||||
[node name="h_box_container" type="HBoxContainer" parent="create/diplay/panel_left/margin/name"]
|
||||
margin_top = 488.0
|
||||
margin_right = 488.0
|
||||
margin_bottom = 520.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="previous" type="TextureButton" parent="create/diplay/panel_left/margin/name/h_box_container"]
|
||||
margin_right = 32.0
|
||||
margin_bottom = 32.0
|
||||
texture_normal = ExtResource( 5 )
|
||||
|
||||
[node name="next" type="TextureButton" parent="create/diplay/panel_left/margin/name/h_box_container"]
|
||||
margin_left = 456.0
|
||||
margin_right = 488.0
|
||||
margin_bottom = 32.0
|
||||
size_flags_horizontal = 10
|
||||
texture_normal = ExtResource( 3 )
|
||||
|
||||
[node name="property" type="VBoxContainer" parent="create/diplay/panel_left/margin"]
|
||||
margin_left = 50.0
|
||||
margin_top = 50.0
|
||||
margin_right = 538.0
|
||||
margin_bottom = 570.0
|
||||
|
||||
[node name="panel" type="VBoxContainer" parent="create/diplay/panel_left/margin/property"]
|
||||
margin_right = 488.0
|
||||
margin_bottom = 484.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="label" type="Label" parent="create/diplay/panel_left/margin/property/panel"]
|
||||
margin_left = 135.0
|
||||
margin_right = 352.0
|
||||
margin_bottom = 14.0
|
||||
size_flags_horizontal = 6
|
||||
text = "CREATURE_CREATION_PROPERTIES"
|
||||
|
||||
[node name="blend_shape" type="ScrollContainer" parent="create/diplay/panel_left/margin/property/panel"]
|
||||
margin_top = 18.0
|
||||
margin_right = 488.0
|
||||
margin_bottom = 484.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="list" type="VBoxContainer" parent="create/diplay/panel_left/margin/property/panel/blend_shape"]
|
||||
margin_right = 488.0
|
||||
margin_bottom = 466.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="h_box_container" type="HBoxContainer" parent="create/diplay/panel_left/margin/property"]
|
||||
margin_top = 488.0
|
||||
margin_right = 488.0
|
||||
margin_bottom = 520.0
|
||||
size_flags_vertical = 8
|
||||
|
||||
[node name="previous" type="TextureButton" parent="create/diplay/panel_left/margin/property/h_box_container"]
|
||||
margin_right = 32.0
|
||||
margin_bottom = 32.0
|
||||
texture_normal = ExtResource( 5 )
|
||||
|
||||
[node name="next" type="TextureButton" parent="create/diplay/panel_left/margin/property/h_box_container"]
|
||||
margin_left = 456.0
|
||||
margin_right = 488.0
|
||||
margin_bottom = 32.0
|
||||
size_flags_horizontal = 10
|
||||
texture_normal = ExtResource( 3 )
|
||||
|
||||
[node name="panel_right" type="HBoxContainer" parent="create/diplay"]
|
||||
margin_left = 592.0
|
||||
margin_right = 1180.0
|
||||
margin_bottom = 620.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="displayo" type="VBoxContainer" parent="create"]
|
||||
visible = false
|
||||
margin_left = 50.0
|
||||
margin_top = 50.0
|
||||
margin_right = 1230.0
|
||||
margin_bottom = 670.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[connection signal="pressed" from="create/diplay/panel_left/margin/race/creature_creation/arche" to="." method="_on_arche_pressed"]
|
||||
[connection signal="pressed" from="create/diplay/panel_left/margin/race/creature_creation/isidor" to="." method="_on_isidor_pressed"]
|
||||
[connection signal="pressed" from="create/diplay/panel_left/margin/race/h_box_container/quit" to="." method="_on_quit_pressed"]
|
||||
[connection signal="pressed" from="create/diplay/panel_left/margin/race/h_box_container/next" to="." method="_on_race_next_pressed"]
|
||||
[connection signal="pressed" from="create/diplay/panel_left/margin/name/v_box_container/generate_name" to="." method="_on_generate_name_pressed"]
|
||||
[connection signal="pressed" from="create/diplay/panel_left/margin/name/h_box_container/previous" to="." method="_on_name_previous_pressed"]
|
||||
[connection signal="pressed" from="create/diplay/panel_left/margin/name/h_box_container/next" to="." method="_on_name_next_pressed"]
|
||||
[connection signal="pressed" from="create/diplay/panel_left/margin/property/h_box_container/previous" to="." method="_on_property_previous_pressed"]
|
||||
[connection signal="pressed" from="create/diplay/panel_left/margin/property/h_box_container/next" to="." method="_on_property_next_pressed"]
|
8
scenes/creature_creation/isidor.tscn
Normal file
8
scenes/creature_creation/isidor.tscn
Normal file
|
@ -0,0 +1,8 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://assets/creatures/isidor/isidor.tscn" type="PackedScene" id=1]
|
||||
|
||||
[node name="spatial" type="Spatial"]
|
||||
|
||||
[node name="isidor" parent="." instance=ExtResource( 1 )]
|
||||
transform = Transform( -4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 0, 0, 0 )
|
9
scenes/creature_creation/property_box.gd
Normal file
9
scenes/creature_creation/property_box.gd
Normal file
|
@ -0,0 +1,9 @@
|
|||
extends HBoxContainer
|
||||
|
||||
signal changed(value, name)
|
||||
|
||||
var name_property: String = ""
|
||||
|
||||
func _on_property_value_changed(value):
|
||||
Config.msg_debug("")
|
||||
emit_signal( "changed" , value, name_property)
|
31
scenes/creature_creation/property_box.tscn
Normal file
31
scenes/creature_creation/property_box.tscn
Normal file
|
@ -0,0 +1,31 @@
|
|||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://scenes/creature_creation/property_box.gd" type="Script" id=1]
|
||||
[ext_resource path="res://ressources/themes/creature_creation.tres" type="Theme" id=2]
|
||||
|
||||
[node name="control" type="HBoxContainer"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 0
|
||||
theme = ExtResource( 2 )
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="label" type="Label" parent="."]
|
||||
margin_right = 54.0
|
||||
margin_bottom = 14.0
|
||||
size_flags_horizontal = 9
|
||||
size_flags_vertical = 0
|
||||
text = "Property"
|
||||
|
||||
[node name="property" type="HSlider" parent="."]
|
||||
margin_left = 58.0
|
||||
margin_right = 1280.0
|
||||
margin_bottom = 16.0
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[connection signal="changed" from="property" to="." method="_on_property_changed"]
|
||||
[connection signal="value_changed" from="property" to="." method="_on_property_value_changed"]
|
22
scenes/creature_creation/property_label.tscn
Normal file
22
scenes/creature_creation/property_label.tscn
Normal file
|
@ -0,0 +1,22 @@
|
|||
[gd_scene format=2]
|
||||
|
||||
[node name="property" type="VBoxContainer"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
size_flags_horizontal = 7
|
||||
size_flags_vertical = 3
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="empty" type="Label" parent="."]
|
||||
margin_right = 1280.0
|
||||
margin_bottom = 14.0
|
||||
|
||||
[node name="label" type="Label" parent="."]
|
||||
margin_top = 18.0
|
||||
margin_right = 1280.0
|
||||
margin_bottom = 32.0
|
||||
size_flags_horizontal = 7
|
||||
text = "Label"
|
||||
align = 1
|
|
@ -5,7 +5,12 @@ signal equip( p_slot, p_item )
|
|||
signal unequip( p_slot )
|
||||
signal is_dead
|
||||
|
||||
var creature = Datas.Human.new()
|
||||
var Human = load("res://ressources/scripts/datas/human.gd")
|
||||
var Equipment = load("res://ressources/scripts/datas/equipment.gd")
|
||||
var PickupItem = load("res://ressources/scripts/datas/pickup_item.gd")
|
||||
var Cloth = load("res://ressources/scripts/datas/cloth.gd")
|
||||
|
||||
var creature = Human.new()
|
||||
|
||||
var eye_color_list = [ "blue_eye", "bluegreen_eye","brown_eye","deepblue_eye","green_eye","grey_eye","ice_eye","lightblue_eye" ]
|
||||
|
||||
|
@ -16,22 +21,22 @@ class Slot:
|
|||
func _init( p_attachment = null ):
|
||||
self.attachment = p_attachment
|
||||
|
||||
var slots = { Datas.Equipment.SLOT.cloth_hand: Slot.new( "cloths" )\
|
||||
, Datas.Equipment.SLOT.cloth_face: Slot.new( "cloths" )\
|
||||
, Datas.Equipment.SLOT.cloth_head: Slot.new( "cloths" )\
|
||||
, Datas.Equipment.SLOT.cloth_torso: Slot.new( "cloths" )\
|
||||
, Datas.Equipment.SLOT.cloth_legs: Slot.new( "cloths" )\
|
||||
, Datas.Equipment.SLOT.cloth_feet: Slot.new( "cloths" )\
|
||||
, Datas.Equipment.SLOT.cloth_back: Slot.new( "cloths" )\
|
||||
, Datas.Equipment.SLOT.weapon_hand_right: Slot.new( "attachment_hand_R" )\
|
||||
, Datas.Equipment.SLOT.weapon_hand_left: Slot.new( "attachment_hand_L" )\
|
||||
, Datas.Equipment.SLOT.weapon_hands: Slot.new( "attachment_hand_R" )\
|
||||
, Datas.Equipment.SLOT.weapon_hip_right: Slot.new( "attachment_hips_R" )\
|
||||
, Datas.Equipment.SLOT.weapon_hip_left: Slot.new( "attachment_hips_L" )\
|
||||
, Datas.Equipment.SLOT.weapon_back_right: Slot.new()\
|
||||
, Datas.Equipment.SLOT.weapon_back_left: Slot.new()\
|
||||
, Datas.Equipment.SLOT.weapon_holster_right: Slot.new()\
|
||||
, Datas.Equipment.SLOT.weapon_holster_left: Slot.new() }
|
||||
var slots = { Equipment.SLOT.cloth_hand: Slot.new( "cloths" )\
|
||||
, Equipment.SLOT.cloth_face: Slot.new( "cloths" )\
|
||||
, Equipment.SLOT.cloth_head: Slot.new( "cloths" )\
|
||||
, Equipment.SLOT.cloth_torso: Slot.new( "cloths" )\
|
||||
, Equipment.SLOT.cloth_legs: Slot.new( "cloths" )\
|
||||
, Equipment.SLOT.cloth_feet: Slot.new( "cloths" )\
|
||||
, Equipment.SLOT.cloth_back: Slot.new( "cloths" )\
|
||||
, Equipment.SLOT.weapon_hand_right: Slot.new( "attachment_hand_R" )\
|
||||
, Equipment.SLOT.weapon_hand_left: Slot.new( "attachment_hand_L" )\
|
||||
, Equipment.SLOT.weapon_hands: Slot.new( "attachment_hand_R" )\
|
||||
, Equipment.SLOT.weapon_hip_right: Slot.new( "attachment_hips_R" )\
|
||||
, Equipment.SLOT.weapon_hip_left: Slot.new( "attachment_hips_L" )\
|
||||
, Equipment.SLOT.weapon_back_right: Slot.new()\
|
||||
, Equipment.SLOT.weapon_back_left: Slot.new()\
|
||||
, Equipment.SLOT.weapon_holster_right: Slot.new()\
|
||||
, Equipment.SLOT.weapon_holster_left: Slot.new() }
|
||||
|
||||
|
||||
func _ready():
|
||||
|
@ -64,9 +69,11 @@ func duplicate_meshes():
|
|||
|
||||
func set_blend_shape( p_blend_shape_name, p_value ):
|
||||
for child in $body_parts.get_children():
|
||||
Config.msg_debug("Child / name:" + child.name)
|
||||
var skeleton = child.get_node( "skeleton" )
|
||||
for node in skeleton.get_children():
|
||||
if node is MeshInstance:
|
||||
Config.msg_debug("Node / name:" + node.name)
|
||||
node.set( "blend_shapes/"+p_blend_shape_name, p_value )
|
||||
for child in $hair_parts.get_children():
|
||||
var skeleton = child.get_node( "skeleton" )
|
||||
|
@ -80,7 +87,7 @@ func set_blend_shape( p_blend_shape_name, p_value ):
|
|||
node.set( "blend_shapes/"+p_blend_shape_name, p_value )
|
||||
|
||||
func load_from_name( p_name, p_emplacement = "usr" ):
|
||||
var new_creature = Datas.Human.new()
|
||||
var new_creature = Human.new()
|
||||
var name_split = p_name.split( "_" )
|
||||
new_creature.set_data( "first_name", name_split[0] )
|
||||
new_creature.set_data( "last_name", name_split[1] )
|
||||
|
@ -398,7 +405,7 @@ func drop_item( p_item ):
|
|||
pickup_item_node.item_filename = p_item.get_filename()
|
||||
pickup_item_node.global_transform = $drop_point.global_transform
|
||||
|
||||
var pickup_item = Datas.PickupItem.new( p_item.get_filename(), $drop_point.global_transform, p_item )
|
||||
var pickup_item = PickupItem.new( p_item.get_filename(), $drop_point.global_transform, p_item )
|
||||
pickup_item_node.item = pickup_item
|
||||
|
||||
if self.get_tree().get_root().has_node( "main/scene/game" ):
|
||||
|
@ -410,7 +417,7 @@ func _on_body_animation_finished( anim_name ):
|
|||
|
||||
func _on_body_limb_body_entered(limb, body):
|
||||
if body.is_in_group( "bullet" ):
|
||||
if limb == Datas.Cloth.LIMB.head:
|
||||
if limb == Cloth.LIMB.head:
|
||||
var blood_particle = preload( "res://scenes/fx/blood_particles.tscn" ).instance()
|
||||
$body_parts/body/skeleton/limb_head.add_child( blood_particle )
|
||||
blood_particle.emit()
|
||||
|
|
|
@ -18,6 +18,7 @@ var max_caracteristiques_points = 5*5 + 5
|
|||
|
||||
func _ready():
|
||||
# Race.
|
||||
race_popup.add_item( Globals.race_label[ Globals.RACE.arche ] )
|
||||
race_popup.add_item( Globals.race_label[ Globals.RACE.human ] )
|
||||
race_popup.connect("id_pressed", self, "_on_race_id_pressed")
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -3,15 +3,18 @@ extends Spatial
|
|||
onready var character = $character
|
||||
var is_over_ui = false
|
||||
|
||||
var Creature = load("res://ressources/scripts/datas/creature.gd")
|
||||
var Human = load("res://ressources/scripts/datas/human.gd")
|
||||
|
||||
func _ready():
|
||||
|
||||
$creature_creation_menu._on_race_id_pressed( 0 )
|
||||
$creature_creation_menu._on_sex_id_pressed( 0 )
|
||||
|
||||
if Globals.creatures_editor_mode == Globals.CREATURES_EDITOR_MODE.player:
|
||||
$creature_creation_menu/margin_box/window_box/content_box/tabs_box/definition/race.hide()
|
||||
elif Globals.creatures_editor_mode == Globals.CREATURES_EDITOR_MODE.npc:
|
||||
#if Globals.creatures_editor_mode == Globals.CREATURES_EDITOR_MODE.player:
|
||||
# $creature_creation_menu/margin_box/window_box/content_box/tabs_box/definition/race.hide()
|
||||
#elif Globals.creatures_editor_mode == Globals.CREATURES_EDITOR_MODE.npc:
|
||||
if Globals.creatures_editor_mode == Globals.CREATURES_EDITOR_MODE.npc:
|
||||
$creature_creation_menu.max_caracteristiques_points = 999
|
||||
$creature_creation_menu/margin_box/window_box/tools_box/buttons_box/choose.hide()
|
||||
|
||||
|
@ -92,9 +95,9 @@ func load_creature( p_name = null ):
|
|||
|
||||
var race = Globals.get_race_id( $creature_creation_menu/margin_box/window_box/content_box/tabs_box/definition/race/value.text )
|
||||
if race == Globals.RACE.human:
|
||||
creature = Datas.Human.new()
|
||||
creature = Human.new()
|
||||
else:
|
||||
creature = Datas.Creature.new()
|
||||
creature = Creature.new()
|
||||
var filename = $creature_creation_menu/margin_box/window_box/content_box/tabs_box/definition/name/value/first_name.text + "_" + $creature_creation_menu/margin_box/window_box/content_box/tabs_box/definition/name/value/last_name.text+".creature"
|
||||
if p_name:
|
||||
filename = p_name + ".creature"
|
||||
|
|
|
@ -47,6 +47,7 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.98872, 2.59328 )
|
|||
light_specular = 0.1
|
||||
|
||||
[node name="root" type="Spatial" parent="."]
|
||||
visible = false
|
||||
|
||||
[node name="Cube" type="MeshInstance" parent="root"]
|
||||
mesh = SubResource( 1 )
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
[ext_resource path="res://scenes/creatures/creature.gd" type="Script" id=2]
|
||||
[ext_resource path="res://scenes/creatures/human/mh_human_male_hair.tscn" type="PackedScene" id=6]
|
||||
|
||||
|
||||
[sub_resource type="CapsuleShape" id=1]
|
||||
radius = 0.448335
|
||||
height = 0.810096
|
||||
|
@ -26,4 +25,5 @@ transform = Transform( 1, 0, 0, 0, -1.62921e-07, 1, 0, -1, -1.62921e-07, 0, 0, 0
|
|||
|
||||
[node name="cloths" type="Spatial" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, -1.62921e-07, 1, 0, -1, -1.62921e-07, 0, 0, 0.852 )
|
||||
|
||||
[connection signal="animation_finished" from="body_parts/body" to="." method="_on_body_animation_finished"]
|
||||
|
|
|
@ -14,32 +14,34 @@ script/source = "extends Spatial
|
|||
signal animation_finished( anim_name )
|
||||
signal limb_body_entered( limb, body )
|
||||
|
||||
var Cloth = load(\"res://ressources/scripts/datas/cloth.gd\")
|
||||
|
||||
func _on_AnimationPlayer_animation_finished(anim_name):
|
||||
emit_signal( \"animation_finished\", anim_name )
|
||||
|
||||
|
||||
func _on_limb_head_area_body_entered(body):
|
||||
emit_signal( \"limb_body_entered\", Datas.Cloth.LIMB.head, body )
|
||||
emit_signal( \"limb_body_entered\", Cloth.LIMB.head, body )
|
||||
|
||||
func _on_limb_tosro_1_body_entered(body):
|
||||
emit_signal( \"limb_body_entered\", Datas.Cloth.LIMB.torso, body )
|
||||
emit_signal( \"limb_body_entered\", Cloth.LIMB.torso, body )
|
||||
|
||||
func _on_limb_torso_2_body_entered(body):
|
||||
emit_signal( \"limb_body_entered\", Datas.Cloth.LIMB.torso, body )
|
||||
emit_signal( \"limb_body_entered\", Cloth.LIMB.torso, body )
|
||||
|
||||
func _on_limb_torso_3_body_entered(body):
|
||||
emit_signal( \"limb_body_entered\", Datas.Cloth.LIMB.torso, body )
|
||||
emit_signal( \"limb_body_entered\", Cloth.LIMB.torso, body )
|
||||
|
||||
func _on_limb_torso_4_body_entered(body):
|
||||
emit_signal( \"limb_body_entered\", Datas.Cloth.LIMB.torso, body )
|
||||
emit_signal( \"limb_body_entered\", Cloth.LIMB.torso, body )
|
||||
|
||||
|
||||
func _on_limb_torso_5_body_entered(body):
|
||||
emit_signal( \"limb_body_entered\", Datas.Cloth.LIMB.torso, body )
|
||||
emit_signal( \"limb_body_entered\", Cloth.LIMB.torso, body )
|
||||
|
||||
|
||||
func _on_limb_upper_arm_left_body_entered(body):
|
||||
emit_signal( \"limb_body_entered\", Datas.Cloth.LIMB.left_upper_arm, body )
|
||||
emit_signal( \"limb_body_entered\", Cloth.LIMB.left_upper_arm, body )
|
||||
|
||||
|
||||
"
|
||||
|
@ -86,7 +88,7 @@ material/0 = ExtResource( 6 )
|
|||
material/0 = ExtResource( 2 )
|
||||
|
||||
[node name="limb_head" type="BoneAttachment" parent="skeleton" index="7"]
|
||||
transform = Transform( 1, 0, 0, 0, 0.0523112, -0.998451, 0, 0.99863, 0.0523236, 0, 0.631645, 0.0409583 )
|
||||
transform = Transform( 1, 0, 0, 0, 0.0523111, -0.998451, 0, 0.99863, 0.0523234, 0, 0.629455, 0.0158642 )
|
||||
bone_name = "head"
|
||||
|
||||
[node name="area" type="Area" parent="skeleton/limb_head" index="0"]
|
||||
|
@ -96,7 +98,7 @@ transform = Transform( 1, 0, 0, 0, 0.999999, -7.45058e-09, 0, 7.45058e-09, 1, 0,
|
|||
shape = SubResource( 2 )
|
||||
|
||||
[node name="limb_torso_1" type="BoneAttachment" parent="skeleton" index="8"]
|
||||
transform = Transform( 1, 0, 0, 0, 0.0981498, -0.994991, 0, 0.99517, 0.0981703, 0, 0.383938, 0.01275 )
|
||||
transform = Transform( 1, 0, 0, 0, 0.182603, -0.983004, 0, 0.98318, 0.182639, 0, 0.383466, -0.000238065 )
|
||||
bone_name = "spine01"
|
||||
|
||||
[node name="area" type="Area" parent="skeleton/limb_torso_1" index="0"]
|
||||
|
@ -107,7 +109,7 @@ transform = Transform( -1.62921e-07, 0, 0.999999, 0, 0.999999, 0, -0.999999, 0,
|
|||
shape = SubResource( 3 )
|
||||
|
||||
[node name="limb_torso_2" type="BoneAttachment" parent="skeleton" index="9"]
|
||||
transform = Transform( 1, 0, 0, 0, -0.00632599, -0.999801, 0, 0.99998, -0.00632417, 0, 0.231632, 0.0117867 )
|
||||
transform = Transform( 1, 0, 0, 0, 0.0789178, -0.996701, 0, 0.99688, 0.0789349, 0, 0.231632, 0.0117867 )
|
||||
bone_name = "spine02"
|
||||
|
||||
[node name="area" type="Area" parent="skeleton/limb_torso_2" index="0"]
|
||||
|
@ -117,7 +119,7 @@ transform = Transform( -1.62921e-07, 0, 0.999999, 0, 0.999999, 0, -0.999999, 0,
|
|||
shape = SubResource( 4 )
|
||||
|
||||
[node name="limb_torso_3" type="BoneAttachment" parent="skeleton" index="10"]
|
||||
transform = Transform( 1, 0, 0, 0, -0.13324, -0.990902, 0, 0.991081, -0.133261, 0, 0.141423, -0.000345033 )
|
||||
transform = Transform( 1, 0, 0, 0, -0.13324, -0.990903, 0, 0.991081, -0.133261, 0, 0.141423, -0.000345025 )
|
||||
bone_name = "spine03"
|
||||
|
||||
[node name="area" type="Area" parent="skeleton/limb_torso_3" index="0"]
|
||||
|
@ -127,7 +129,7 @@ transform = Transform( -1.62921e-07, 0, 0.999999, 0, 0.999999, 0, -0.999999, 0,
|
|||
shape = SubResource( 4 )
|
||||
|
||||
[node name="limb_torso_4" type="BoneAttachment" parent="skeleton" index="11"]
|
||||
transform = Transform( 1, 0, 0, 0, -0.32935, -0.944017, 0, 0.944188, -0.329407, 0, 0.0787433, -0.0222167 )
|
||||
transform = Transform( 1, 0, 0, 0, -0.329351, -0.944018, 0, 0.944188, -0.329407, 0, 0.0787433, -0.0222167 )
|
||||
bone_name = "spine04"
|
||||
|
||||
[node name="area" type="Area" parent="skeleton/limb_torso_4" index="0"]
|
||||
|
@ -138,7 +140,7 @@ transform = Transform( -1.62921e-07, 0, 0.999999, 0, 0.999999, 0, -0.999999, 0,
|
|||
shape = SubResource( 5 )
|
||||
|
||||
[node name="limb_torso_5" type="BoneAttachment" parent="skeleton" index="12"]
|
||||
transform = Transform( 1, 0, 0, 0, 0.534014, -0.845263, 0, 0.845413, 0.534112, 0, 0.0066183, 0.0233583 )
|
||||
transform = Transform( 1, 0, 0, 0, 0.534014, -0.845263, 0, 0.845413, 0.534112, 0, 0.00661829, 0.0233583 )
|
||||
bone_name = "spine05"
|
||||
|
||||
[node name="area" type="Area" parent="skeleton/limb_torso_5" index="0"]
|
||||
|
@ -149,7 +151,7 @@ transform = Transform( -1.62921e-07, 0, 0.999999, 0, 0.999999, 0, -0.999999, 0,
|
|||
shape = SubResource( 5 )
|
||||
|
||||
[node name="limb_upper_arm_left" type="BoneAttachment" parent="skeleton" index="13"]
|
||||
transform = Transform( -0.745066, -0.0134922, -0.666855, -0.666773, 0.03218, 0.744323, 0.0114208, 0.999391, -0.0329804, 0.208593, 0.385909, 0.019574 )
|
||||
transform = Transform( -0.970824, 0.133984, -0.198431, -0.20868, -0.0676765, 0.975425, 0.117262, 0.988696, 0.0936781, 0.170717, 0.366623, -0.00909948 )
|
||||
bone_name = "upperarm02.L"
|
||||
|
||||
[node name="area" type="Area" parent="skeleton/limb_upper_arm_left" index="0"]
|
||||
|
@ -160,21 +162,21 @@ transform = Transform( -1.62921e-07, 0, 0.999999, 0, 0.999999, 0, -0.999999, 0,
|
|||
shape = SubResource( 6 )
|
||||
|
||||
[node name="attachment_hand_R" type="BoneAttachment" parent="skeleton" index="14"]
|
||||
transform = Transform( 0.587628, 0.647439, 0.485299, 0.412693, -0.755596, 0.508329, 0.695927, -0.0984435, -0.711334, -0.440104, 0.124054, 0.17144 )
|
||||
transform = Transform( 0.439623, 0.845161, 0.303632, 0.0253603, -0.349546, 0.936193, 0.897875, -0.404187, -0.175111, -0.243995, -0.0185078, 0.0149495 )
|
||||
bone_name = "metacarpal3.R"
|
||||
|
||||
[node name="handle" type="Spatial" parent="skeleton/attachment_hand_R" index="0"]
|
||||
transform = Transform( -0.0511686, 0.991695, -0.116549, 0.320607, -0.0942135, -0.942455, -0.946104, -0.0855632, -0.313081, 0.0258782, 0.0285175, -0.0395434 )
|
||||
|
||||
[node name="attachment_hand_L" type="BoneAttachment" parent="skeleton" index="15"]
|
||||
transform = Transform( 0.587628, -0.647439, -0.485299, -0.412693, -0.755596, 0.508329, -0.695927, -0.0984435, -0.711334, 0.440104, 0.124054, 0.17144 )
|
||||
transform = Transform( 0.439623, -0.845161, -0.303633, -0.0253602, -0.349546, 0.936193, -0.897875, -0.404187, -0.175111, 0.243995, -0.0185078, 0.0149495 )
|
||||
bone_name = "metacarpal3.L"
|
||||
|
||||
[node name="handle" type="Spatial" parent="skeleton/attachment_hand_L" index="0"]
|
||||
transform = Transform( 0.248711, -0.966789, 0.0577959, -0.32067, -0.138623, -0.937039, 0.914105, 0.214413, -0.344196, -0.0963456, 0.0583696, -0.12191 )
|
||||
|
||||
[node name="attachment_hips_R" type="BoneAttachment" parent="skeleton" index="16"]
|
||||
transform = Transform( -0.0959694, 0.091845, 0.991138, 0.312981, -0.942256, 0.11762, 0.944878, 0.321558, 0.0616928, 0, 0.0066183, 0.0233583 )
|
||||
transform = Transform( -0.0959694, 0.091845, 0.991138, 0.312981, -0.942256, 0.11762, 0.944878, 0.321558, 0.0616928, -1.00505e-09, 0.0066183, 0.0233583 )
|
||||
bone_name = "pelvis.R"
|
||||
|
||||
[node name="handle" type="Spatial" parent="skeleton/attachment_hips_R" index="0"]
|
||||
|
|
|
@ -3,4 +3,4 @@ extends Spatial
|
|||
signal animation_finished( anim_name )
|
||||
|
||||
func _on_AnimationPlayer_animation_finished(anim_name):
|
||||
emit_signal( "animation_finished", anim_name )
|
||||
emit_signal( "animation_finished", anim_name )
|
||||
|
|
Binary file not shown.
|
@ -24,8 +24,8 @@ noise = SubResource( 1 )
|
|||
[sub_resource type="ShaderMaterial" id=3]
|
||||
resource_local_to_scene = true
|
||||
shader = ExtResource( 5 )
|
||||
shader_param/iTime = 4.27346
|
||||
shader_param/iFrame = 402
|
||||
shader_param/iTime = 101.769
|
||||
shader_param/iFrame = 5732
|
||||
shader_param/COVERAGE = 0.5
|
||||
shader_param/THICKNESS = 25.0
|
||||
shader_param/ABSORPTION = 1.031
|
||||
|
@ -173,6 +173,7 @@ margin_left = 908.654
|
|||
margin_top = 51.8173
|
||||
margin_right = -115.346
|
||||
margin_bottom = -412.183
|
||||
|
||||
[connection signal="douleur_minus_pressed" from="debug_window" to="." method="_on_debug_window_douleur_minus_pressed"]
|
||||
[connection signal="douleur_plus_pressed" from="debug_window" to="." method="_on_debug_window_douleur_plus_pressed"]
|
||||
[connection signal="mist_level_changed" from="debug_window" to="." method="_on_debug_window_mist_level_changed"]
|
||||
|
|
142
scenes/game/generate_map.gd
Normal file
142
scenes/game/generate_map.gd
Normal file
|
@ -0,0 +1,142 @@
|
|||
extends Node
|
||||
|
||||
# Cache : ~/.cache/godot/
|
||||
|
||||
|
||||
func GenerateMap(filemap:String, longitude:int, latitude:int):
|
||||
Config.msg_debug("GenerateMap => Start")
|
||||
Config.msg_debug(" [" + filemap + "] longitude:" + str(longitude) + " latitude:" + str(latitude))
|
||||
var image = Image.new()
|
||||
var arr = []
|
||||
var mesh = ArrayMesh.new()
|
||||
|
||||
arr.resize(Mesh.ARRAY_MAX)
|
||||
# Set up the PoolVectorXArrays.
|
||||
var verts = PoolVector3Array()
|
||||
var uvs = PoolVector2Array()
|
||||
var normals = PoolVector3Array()
|
||||
var indices = PoolIntArray()
|
||||
|
||||
# Vertex indices.
|
||||
var thisrow = 0
|
||||
var prevrow = 0
|
||||
var point = 0
|
||||
image.load(filemap)
|
||||
var width = image.get_width()
|
||||
var height = image.get_height()
|
||||
image.lock()
|
||||
Config.msg_debug("width:" + str(width) + " , height:" + str(height))
|
||||
var lvl = image.get_pixel(0,0).v
|
||||
Config.msg_debug("level:" + str(lvl))
|
||||
Config.msg_debug("a:" + str(image.get_pixel(0,0).a))
|
||||
Config.msg_debug("r:" + str(image.get_pixel(0,0).r))
|
||||
Config.msg_debug("v:" + str(image.get_pixel(0,0).v))
|
||||
Config.msg_debug("b:" + str(image.get_pixel(0,0).b))
|
||||
var txt
|
||||
# y => height, x => width
|
||||
for y in range(height):
|
||||
for x in range(width):
|
||||
var z = int(image.get_pixel(x,y).v * 500)
|
||||
var vert = Vector3(x, z, y)
|
||||
Config.msg_debug("x:" + str(x) + " , y:" + str(y) + " , z:" + str(z))
|
||||
verts.append(vert)
|
||||
normals.append(vert.normalized())
|
||||
uvs.append(Vector2(x, y))
|
||||
point += 1
|
||||
if x > 0 and y > 0:
|
||||
indices.append(prevrow + x - 1)
|
||||
indices.append(prevrow + x)
|
||||
indices.append(thisrow + x - 1)
|
||||
indices.append(prevrow + x)
|
||||
indices.append(thisrow + x)
|
||||
indices.append(thisrow + x - 1)
|
||||
if y > 0:
|
||||
indices.append(prevrow + width - 1)
|
||||
indices.append(prevrow)
|
||||
indices.append(thisrow + width - 1)
|
||||
indices.append(prevrow)
|
||||
indices.append(prevrow + width)
|
||||
indices.append(thisrow + width - 1)
|
||||
prevrow = thisrow
|
||||
thisrow = point
|
||||
|
||||
arr[Mesh.ARRAY_VERTEX] = verts
|
||||
arr[Mesh.ARRAY_TEX_UV] = uvs
|
||||
arr[Mesh.ARRAY_NORMAL] = normals
|
||||
arr[Mesh.ARRAY_INDEX] = indices
|
||||
image.unlock()
|
||||
# Create mesh surface from mesh array.
|
||||
mesh.add_surface_from_arrays(Mesh.PRIMITIVE_TRIANGLES, arr) # No blendshapes or compression used.
|
||||
# Commit to the ArrayMesh.
|
||||
ResourceSaver.save("res://map" + str(longitude) + "-" + str(latitude) + ".tres", mesh, 32)
|
||||
Config.msg_debug("GenerateMap => End")
|
||||
|
||||
|
||||
func GenerateSphere(rings:int = 50, radial_segments:int = 50, height:int = 1, radius:int = 1):
|
||||
Config.msg_debug("GenerateSphere => Start")
|
||||
var arr = []
|
||||
var mesh = ArrayMesh.new()
|
||||
|
||||
arr.resize(Mesh.ARRAY_MAX)
|
||||
# Set up the PoolVectorXArrays.
|
||||
var verts = PoolVector3Array()
|
||||
var uvs = PoolVector2Array()
|
||||
var normals = PoolVector3Array()
|
||||
var indices = PoolIntArray()
|
||||
|
||||
# Vertex indices.
|
||||
var thisrow = 0
|
||||
var prevrow = 0
|
||||
var point = 0
|
||||
|
||||
# Loop over rings.
|
||||
for i in range(rings + 1):
|
||||
var v = float(i) / rings
|
||||
var w = sin(PI * v)
|
||||
var y = cos(PI * v)
|
||||
|
||||
# Loop over segments in ring.
|
||||
for j in range(radial_segments):
|
||||
var u = float(j) / radial_segments
|
||||
var x = sin(u * PI * 2.0)
|
||||
var z = cos(u * PI * 2.0)
|
||||
var vert = Vector3(x * radius * w, y, z * radius * w)
|
||||
verts.append(vert)
|
||||
normals.append(vert.normalized())
|
||||
uvs.append(Vector2(u, v))
|
||||
point += 1
|
||||
|
||||
# Create triangles in ring using indices.
|
||||
if i > 0 and j > 0:
|
||||
indices.append(prevrow + j - 1)
|
||||
indices.append(prevrow + j)
|
||||
indices.append(thisrow + j - 1)
|
||||
|
||||
indices.append(prevrow + j)
|
||||
indices.append(thisrow + j)
|
||||
indices.append(thisrow + j - 1)
|
||||
|
||||
if i > 0:
|
||||
indices.append(prevrow + radial_segments - 1)
|
||||
indices.append(prevrow)
|
||||
indices.append(thisrow + radial_segments - 1)
|
||||
|
||||
indices.append(prevrow)
|
||||
indices.append(prevrow + radial_segments)
|
||||
indices.append(thisrow + radial_segments - 1)
|
||||
|
||||
prevrow = thisrow
|
||||
thisrow = point
|
||||
|
||||
# Assign arrays to mesh array.
|
||||
arr[Mesh.ARRAY_VERTEX] = verts
|
||||
arr[Mesh.ARRAY_TEX_UV] = uvs
|
||||
arr[Mesh.ARRAY_NORMAL] = normals
|
||||
arr[Mesh.ARRAY_INDEX] = indices
|
||||
|
||||
# Create mesh surface from mesh array.
|
||||
mesh.add_surface_from_arrays(Mesh.PRIMITIVE_TRIANGLES, arr) # No blendshapes or compression used.
|
||||
|
||||
# Commit to the ArrayMesh.
|
||||
ResourceSaver.save("user://sphere.tres", mesh, 32)
|
||||
Config.msg_debug("GenerateSphere => End")
|
|
@ -25,30 +25,32 @@ func _ready():
|
|||
for file in files:
|
||||
var creature_box = preload( "res://scenes/interfaces/creatures_menu/creature_box.tscn" ).instance()
|
||||
creature_box.get_node( "label" ).text = file
|
||||
creature_box.slot = self.slots_number
|
||||
creature_box.slot = slots_number
|
||||
creature_box.creature_filename = file
|
||||
creature_box.connect( "select_pressed", self, "_on_creature_box_select_pressed" )
|
||||
creature_box.connect( "delete_pressed", self, "_on_creature_box_delete_pressed" )
|
||||
$screen_box/scroll_container/v_box_container/creatures_box.add_child( creature_box )
|
||||
self.slots[ self.slots_number ] = creature_box
|
||||
self.slots_number += 1
|
||||
|
||||
var creature = Creatures.Ra_old2.new()
|
||||
creature.from_file( file )
|
||||
creature_box.get_node( "label" ).text = creature.pseudonym
|
||||
slots[ slots_number ] = creature_box
|
||||
slots_number += 1
|
||||
|
||||
#var creature = Creatures.Ra_old2.new()
|
||||
var creature = Data.new()
|
||||
Config.msg_debug( "File:" + file )
|
||||
creature.load( file )
|
||||
creature_box.get_node( "label" ).text = creature.get_data("pseudonym", "No name")
|
||||
|
||||
|
||||
func _on_new_pressed():
|
||||
emit_signal( "new_pressed", self.slots_number )
|
||||
emit_signal( "new_pressed", slots_number )
|
||||
|
||||
func _on_cancel_pressed():
|
||||
emit_signal( "cancel_pressed" )
|
||||
|
||||
func _on_creature_box_select_pressed( slot ):
|
||||
emit_signal( "select_pressed", self.slots[ slot ].creature_filename )
|
||||
|
||||
emit_signal( "select_pressed", slots[ slot ].creature_filename )
|
||||
|
||||
func _on_creature_box_delete_pressed( slot ):
|
||||
if self.slots[ slot ].creature_filename:
|
||||
if slots[ slot ].creature_filename:
|
||||
var dir = Directory.new()
|
||||
dir.remove( "user://creatures/" + self.slots[ slot ].creature_filename )
|
||||
self.slots[ slot ].queue_free()
|
||||
dir.remove( "user://creatures/" + slots[ slot ].creature_filename )
|
||||
slots[ slot ].queue_free()
|
||||
|
|
|
@ -143,8 +143,9 @@ func _on_main_menu_play_pressed():
|
|||
|
||||
func _on_creatures_menu_ui_new_pressed( slot ):
|
||||
self.creature_selected_slot = slot
|
||||
# Globals.goto_scene( "res://scenes/interfaces/creatures_editor/creatures_editor_ui.tscn" )
|
||||
Globals.goto_scene( "res://scenes/creatures/creatures_creation.tscn" )
|
||||
# Globals.goto_scene( "res://scenes/interfaces/creatures_editor/creatures_editor_ui.tscn" )
|
||||
#Globals.goto_scene( "res://scenes/creatures/creatures_creation.tscn" )
|
||||
Globals.goto_scene( "res://scenes/creature_creation/creature_creation.tscn" )
|
||||
|
||||
|
||||
func _on_creatures_menu_ui_cancel_pressed():
|
||||
|
|
Loading…
Reference in a new issue