adding icon jukebox

This commit is contained in:
AleaJactaEst 2021-06-22 18:22:58 +02:00
parent 500b4bc2e0
commit 8e5fad8d89
22 changed files with 1010 additions and 891 deletions

View file

@ -29,3 +29,8 @@
6) Correction du menu de selection de la langue
7) Activer la sortie audio en fonction de la selection dans le menu option
8) Ajouter un icon JukeBox dans la page de démarrage
9) A l'ouverture du JukeBox, il retaille la fenetre afin de ne pas avoir du scrolling (si possible)

View file

@ -0,0 +1,15 @@
1/ To check error on
Impossible de charger le script de lextension depuis le chemin : «res://addons/kh_window/kh_window_plugin.gd». Cela peut être dû à une erreur de programmation dans ce script.
2/
17/06/2021 | 21:49:01 Zatalyz: pour les nouveautés : il faudrait que le texte ne demande pas de scroll horizontal, qu'il s'adapte à la largeur de cette fenêtre. 80 caractères si tu cherche la meilleure taille pour ce morceau :)
dépend de la taille du texte, si trop grand ..., mais bonne remarque je note
17/06/2021 | 21:52:17 Zatalyz: ha, un détail : quand on choisit "tête", c'est pas mal de zoomer sur la tête
17/06/2021 | 21:52:47 Zatalyz: Ha oui, le nom commence par M, donc ça l'a fait apparaitre... je dirais : pas de raccourci sur cet écran :D
17/06/2021 | 21:53:07 Zatalyz: (zoomer automatiquement... j'ai trouvé le zoom sinon)
3/ je note ajouter un icon pour juke box

View file

@ -4,7 +4,7 @@ extends EditorPlugin
func _enter_tree():
# Initialization of the plugin goes here
# Add the new type with a name, a parent type, a script and an icon
add_custom_type("kh_window", "MarginContainer", preload("kh_window.gd"), preload("icon.png"))
add_custom_type("kh_window", "MarginContainer", preload("res://addons/kh_window/kh_window.gd"), preload("res://addons/kh_window/icon.png"))
func _exit_tree():
# Clean-up of the plugin goes here

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 545 B

After

Width:  |  Height:  |  Size: 11 KiB

View file

@ -65,6 +65,7 @@ _global_script_class_icons={
config/name="Khanat"
run/main_scene="res://scenes/main/main.tscn"
boot_splash/image="res://assets/interfaces/new_launcher_bg_0-1.png"
boot_splash/bg_color=Color( 0.12549, 0.145098, 0.192157, 1 )
config/icon="res://icon.png"
[audio]
@ -79,12 +80,18 @@ 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"
[debug]
settings/stdout/verbose_stdout=true
gdscript/completion/autocomplete_setters_and_getters=true
gdscript/warnings/unused_class_variable=true
gdscript/warnings/return_value_discarded=false
gdscript/warnings/unsafe_property_access=true
gdscript/warnings/unsafe_method_access=true
gdscript/warnings/unsafe_cast=true
gdscript/warnings/unsafe_call_argument=true
[display]

View file

@ -4,301 +4,301 @@ extends Node
var JSONBeautifier = preload( "res://ressources/scripts/json_beautifier/json_beautifier.gd" )
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] )
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", {} )
var data = null
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 )
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 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 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 save( p_emplacement = "usr"):
.save( p_emplacement )
func load( p_path = null, p_emplacement = "usr" ):
.load( p_path, p_emplacement )
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
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 _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"
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"
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" )
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"
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 )
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"
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"
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 )
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 )
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:

View file

@ -35,268 +35,268 @@ var direction = Vector3.ZERO
var orientation = 0.0
enum PLAYER_RELATION {
neutre,
friend,
ennemy
neutre,
friend,
ennemy
}
export( PLAYER_RELATION ) var player_relation = PLAYER_RELATION.neutre
export( String ) var creature_filename = null setget set_creature_filename
func set_creature_filename( p_filename ):
creature_filename = p_filename
self.load_from_name( p_filename )
creature_filename = p_filename
self.load_from_name( p_filename )
func _process( delta ):
# Calculate a move direction vector relative to the camera
# The basis stores the (right, up, -forwards) vectors of our camera.
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
# 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 )
# Calculate a move direction vector relative to the camera
# The basis stores the (right, up, -forwards) vectors of our camera.
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
# 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 )
# Movement.
velocity = self.calculate_velocity(velocity, move_direction, delta)
if not self.is_readying_weapon and not self.is_weapon_ready:
if not self.is_jumping and not self.is_jump_started and not self.is_falling:
velocity = self.move_and_slide_with_snap(velocity, Vector3.DOWN, Vector3.UP, true)
else:
velocity = self.move_and_slide(velocity, Vector3.UP, true)
# Animation.
if self.has_node( "creature" ):
if self.is_dead:
$creature.play( "dead_loop" )
elif self.is_dying:
$creature.play( "dying", 2.0 )
elif self.is_readying_weapon:
$creature.play( "1h_pistol_ready_start" )
elif self.is_weapon_ready:
$creature.play( "1h_pistol_ready_loop" )
elif direction and not self.is_jump_started and not self.is_jumping and not self.is_falling:
if direction.z < 0.0:
if self.is_running:
$creature.play( "run" , 2.0 )
else:
$creature.play( "walk" )
elif direction.z > 0.0:
if self.is_running:
$creature.play_backwards( "run", 2.0 )
else:
$creature.play_backwards( "walk" )
elif direction.x > 0.0:
$creature.play( "strafe_right" )
elif direction.x < 0.0:
$creature.play( "strafe_left" )
elif self.is_jump_started and not self.is_jumping:
$creature.play( "jump_start" )
elif self.is_jumping or self.is_falling:
if not self.is_on_ground:
$creature.play( "jump_loop" )
else:
$creature.play( "jump_end", 2 )
elif not self.orientation == 0.0:
if self.orientation < 0.0:
$creature.play( "turn_right", 2.0 )
elif self.orientation > 0.0:
$creature.play( "turn_left", 2.0 )
else:
$creature.play( "idle" )
# Movement.
velocity = self.calculate_velocity(velocity, move_direction, delta)
if not self.is_readying_weapon and not self.is_weapon_ready:
if not self.is_jumping and not self.is_jump_started and not self.is_falling:
velocity = self.move_and_slide_with_snap(velocity, Vector3.DOWN, Vector3.UP, true)
else:
velocity = self.move_and_slide(velocity, Vector3.UP, true)
# Animation.
if self.has_node( "creature" ):
if self.is_dead:
$creature.play( "dead_loop" )
elif self.is_dying:
$creature.play( "dying", 2.0 )
elif self.is_readying_weapon:
$creature.play( "1h_pistol_ready_start" )
elif self.is_weapon_ready:
$creature.play( "1h_pistol_ready_loop" )
elif direction and not self.is_jump_started and not self.is_jumping and not self.is_falling:
if direction.z < 0.0:
if self.is_running:
$creature.play( "run" , 2.0 )
else:
$creature.play( "walk" )
elif direction.z > 0.0:
if self.is_running:
$creature.play_backwards( "run", 2.0 )
else:
$creature.play_backwards( "walk" )
elif direction.x > 0.0:
$creature.play( "strafe_right" )
elif direction.x < 0.0:
$creature.play( "strafe_left" )
elif self.is_jump_started and not self.is_jumping:
$creature.play( "jump_start" )
elif self.is_jumping or self.is_falling:
if not self.is_on_ground:
$creature.play( "jump_loop" )
else:
$creature.play( "jump_end", 2 )
elif not self.orientation == 0.0:
if self.orientation < 0.0:
$creature.play( "turn_right", 2.0 )
elif self.orientation > 0.0:
$creature.play( "turn_left", 2.0 )
else:
$creature.play( "idle" )
func calculate_velocity(
velocity_current: Vector3,
move_direction: Vector3,
delta: float
) -> Vector3:
velocity_current: Vector3,
move_direction: Vector3,
delta: float
) -> Vector3:
# var velocity_new := move_direction
var velocity_new = Vector3.ZERO
if not self.is_jump_started:
velocity_new = move_direction
if self.is_running:
velocity_new *= run_speed
else:
velocity_new *= move_speed
if velocity_new.length() > max_speed:
velocity_new = velocity_new.normalized() * max_speed
velocity_new.y = velocity_current.y + gravity * delta
if self.is_jumping:
velocity_new.y += self.jump_strength * delta
self.is_jumping = false
self.is_falling = true
if self.is_falling:
velocity_new.x *= 2.0
velocity_new.z *= 2.0
return velocity_new
var velocity_new = Vector3.ZERO
if not self.is_jump_started:
velocity_new = move_direction
if self.is_running:
velocity_new *= run_speed
else:
velocity_new *= move_speed
if velocity_new.length() > max_speed:
velocity_new = velocity_new.normalized() * max_speed
velocity_new.y = velocity_current.y + gravity * delta
if self.is_jumping:
velocity_new.y += self.jump_strength * delta
self.is_jumping = false
self.is_falling = true
if self.is_falling:
velocity_new.x *= 2.0
velocity_new.z *= 2.0
return velocity_new
func load_from_name( p_name, p_emplacement = null ):
var creature = Datas.Creature.new()
creature.set_data( "name", p_name )
creature.load( null, p_emplacement )
if creature.get_data( "race" ) == Globals.RACE.human:
if creature.get_data( "sex" ) == Globals.SEX.female:
self.change_creature( "res://scenes/creatures/human/human_female.tscn" )
elif creature.get_data( "sex" ) == Globals.SEX.male:
self.change_creature( "res://scenes/creatures/human/human_male.tscn" )
if $creature:
$creature.load_from_name( p_name, p_emplacement )
var creature = Datas.Creature.new()
creature.set_data( "name", p_name )
creature.load( null, p_emplacement )
if creature.get_data( "race" ) == Globals.RACE.human:
if creature.get_data( "sex" ) == Globals.SEX.female:
self.change_creature( "res://scenes/creatures/human/human_female.tscn" )
elif creature.get_data( "sex" ) == Globals.SEX.male:
self.change_creature( "res://scenes/creatures/human/human_male.tscn" )
if $creature:
$creature.load_from_name( p_name, p_emplacement )
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()
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 set_blend_shape( p_blend_shape_name, p_value ):
$creature.set_blend_shape( p_blend_shape_name, p_value )
$creature.set_blend_shape( p_blend_shape_name, p_value )
func _on_ground_area_body_entered(body):
if not body == self:
self.ground_contacts += 1
if self.ground_contacts > 0:
if not body == self:
self.ground_contacts += 1
if self.ground_contacts > 0:
# self.is_falling = false
self.is_on_ground = true
self.is_on_ground = true
func _on_ground_area_body_exited(body):
if not body == self:
self.ground_contacts -= 1
if self.ground_contacts <= 0:
self.is_falling = true
self.is_on_ground = false
if not body == self:
self.ground_contacts -= 1
if self.ground_contacts <= 0:
self.is_falling = true
self.is_on_ground = false
func _on_creature_animation_finished(anim_name):
if anim_name == "jump_start":
self.is_jump_started = false
self.is_jumping = true
elif anim_name == "jump_end":
self.is_falling = false
elif anim_name == "turn_right":
self.can_turn = false
elif anim_name == "turn_left":
self.can_turn = false
elif anim_name == "1h_pistol_ready_start":
self.is_readying_weapon = false
self.is_weapon_ready = true
elif anim_name == "dying":
self.is_dying = false
self.is_dead = true
if anim_name == "jump_start":
self.is_jump_started = false
self.is_jumping = true
elif anim_name == "jump_end":
self.is_falling = false
elif anim_name == "turn_right":
self.can_turn = false
elif anim_name == "turn_left":
self.can_turn = false
elif anim_name == "1h_pistol_ready_start":
self.is_readying_weapon = false
self.is_weapon_ready = true
elif anim_name == "dying":
self.is_dying = false
self.is_dead = true
func set_focus( p_focus = true ):
if p_focus:
$focus.show()
if self.player_relation == PLAYER_RELATION.neutre:
$focus.get_surface_material( 0 ).albedo_color = Color.white
elif self.player_relation == PLAYER_RELATION.friend:
$focus.get_surface_material( 0 ).albedo_color = Color.green
elif self.player_relation == PLAYER_RELATION.ennemy:
$focus.get_surface_material( 0 ).albedo_color = Color.red
else:
$focus.hide()
if p_focus:
$focus.show()
if self.player_relation == PLAYER_RELATION.neutre:
$focus.get_surface_material( 0 ).albedo_color = Color.white
elif self.player_relation == PLAYER_RELATION.friend:
$focus.get_surface_material( 0 ).albedo_color = Color.green
elif self.player_relation == PLAYER_RELATION.ennemy:
$focus.get_surface_material( 0 ).albedo_color = Color.red
else:
$focus.hide()
func get_weapons():
var weapons = []
if Datas.Equipment.SLOT.weapon_hands in $creature.slots:
if $creature.slots[ Datas.Equipment.SLOT.weapon_hands ].item:
weapons.push_back( $creature.slots[ Datas.Equipment.SLOT.weapon_hands ].item )
var weapons = []
if Datas.Equipment.SLOT.weapon_hands in $creature.slots:
if $creature.slots[ Datas.Equipment.SLOT.weapon_hands ].item:
weapons.push_back( $creature.slots[ Datas.Equipment.SLOT.weapon_hands ].item )
if not weapons.size() > 0:
if Datas.Equipment.SLOT.weapon_hand_right in $creature.slots:
if $creature.slots[ Datas.Equipment.SLOT.weapon_hand_right ].item:
weapons.push_back( $creature.slots[ Datas.Equipment.SLOT.weapon_hand_right ].item )
if Datas.Equipment.SLOT.weapon_hand_left in $creature.slots:
if $creature.slots[ Datas.Equipment.SLOT.weapon_hand_left ].item:
weapons.push_back( $creature.slots[ Datas.Equipment.SLOT.weapon_hand_left ].item )
return weapons
if not weapons.size() > 0:
if Datas.Equipment.SLOT.weapon_hand_right in $creature.slots:
if $creature.slots[ Datas.Equipment.SLOT.weapon_hand_right ].item:
weapons.push_back( $creature.slots[ Datas.Equipment.SLOT.weapon_hand_right ].item )
if Datas.Equipment.SLOT.weapon_hand_left in $creature.slots:
if $creature.slots[ Datas.Equipment.SLOT.weapon_hand_left ].item:
weapons.push_back( $creature.slots[ Datas.Equipment.SLOT.weapon_hand_left ].item )
return weapons
func get_main_weapon_node():
var weapon = null
if Datas.Equipment.SLOT.weapon_hands in $creature.slots:
if $creature.slots[ Datas.Equipment.SLOT.weapon_hands ].item:
if $creature/body_parts/body/skeleton/attachment_hand_R/handle.get_children().size() > 0:
weapon = $creature/body_parts/body/skeleton/attachment_hand_R/handle.get_children()[0]
if not weapon and Datas.Equipment.SLOT.weapon_hand_right in $creature.slots:
if $creature.slots[ Datas.Equipment.SLOT.weapon_hand_right ].item:
if $creature/body_parts/body/skeleton/attachment_hand_R/handle.get_children().size() > 0:
weapon = $creature/body_parts/body/skeleton/attachment_hand_R/handle.get_children()[0]
if not weapon and Datas.Equipment.SLOT.weapon_hand_left in $creature.slots:
if $creature.slots[ Datas.Equipment.SLOT.weapon_hand_left ].item:
if $creature/body_parts/body/skeleton/attachment_hand_L/handle.get_children().size() > 0:
weapon = $creature/body_parts/body/skeleton/attachment_hand_R/handle.get_children()[0]
return weapon
var weapon = null
if Datas.Equipment.SLOT.weapon_hands in $creature.slots:
if $creature.slots[ Datas.Equipment.SLOT.weapon_hands ].item:
if $creature/body_parts/body/skeleton/attachment_hand_R/handle.get_children().size() > 0:
weapon = $creature/body_parts/body/skeleton/attachment_hand_R/handle.get_children()[0]
if not weapon and Datas.Equipment.SLOT.weapon_hand_right in $creature.slots:
if $creature.slots[ Datas.Equipment.SLOT.weapon_hand_right ].item:
if $creature/body_parts/body/skeleton/attachment_hand_R/handle.get_children().size() > 0:
weapon = $creature/body_parts/body/skeleton/attachment_hand_R/handle.get_children()[0]
if not weapon and Datas.Equipment.SLOT.weapon_hand_left in $creature.slots:
if $creature.slots[ Datas.Equipment.SLOT.weapon_hand_left ].item:
if $creature/body_parts/body/skeleton/attachment_hand_L/handle.get_children().size() > 0:
weapon = $creature/body_parts/body/skeleton/attachment_hand_R/handle.get_children()[0]
return weapon
func attack():
if self.can_attack:
var weapon = null
var attachment = null
weapon = $creature.slots[ Datas.Equipment.SLOT.weapon_hand_right ].item
attachment = $creature.slots[ Datas.Equipment.SLOT.weapon_hand_right ].attachment
if not weapon:
weapon = $creature.slots[ Datas.Equipment.SLOT.weapon_hand_left ].item
attachment = $creature.slots[ Datas.Equipment.SLOT.weapon_hand_left ].attachment
if not weapon:
weapon = $creature.slots[ Datas.Equipment.SLOT.weapon_hands ].item
attachment = $creature.slots[ Datas.Equipment.SLOT.weapon_hands ].attachment
if weapon:
print( "pan " + str(weapon.get_data( "damage" )) )
if self.can_attack:
var weapon = null
var attachment = null
weapon = $creature.slots[ Datas.Equipment.SLOT.weapon_hand_right ].item
attachment = $creature.slots[ Datas.Equipment.SLOT.weapon_hand_right ].attachment
if not weapon:
weapon = $creature.slots[ Datas.Equipment.SLOT.weapon_hand_left ].item
attachment = $creature.slots[ Datas.Equipment.SLOT.weapon_hand_left ].attachment
if not weapon:
weapon = $creature.slots[ Datas.Equipment.SLOT.weapon_hands ].item
attachment = $creature.slots[ Datas.Equipment.SLOT.weapon_hands ].attachment
if weapon:
print( "pan " + str(weapon.get_data( "damage" )) )
var weapon_node = $creature/body_parts/body/skeleton.get_node( attachment )
if weapon_node:
weapon_node = weapon_node.get_node( "handle" ).get_children()[0]
var weapon_node = $creature/body_parts/body/skeleton.get_node( attachment )
if weapon_node:
weapon_node = weapon_node.get_node( "handle" ).get_children()[0]
# if weapon_node is preload( "res://scenes/items/equipments/weapons/firearm.gd" ):
# weapon_node.fire( self, [self] )
#
self.can_attack = false
$attack_delay.start()
self.can_attack = false
$attack_delay.start()
func hit( p_damage, p_from = null ):
$creature.creature.set_data( "current_life", $creature.creature.get_data( "current_life" )-p_damage )
$head_infos_viewport/head_infos/bars/life.max_value = $creature.creature.get_max_life()
$head_infos_viewport/head_infos/bars/life.value = $creature.creature.get_data( "current_life", 0 )
$creature.creature.set_data( "current_life", $creature.creature.get_data( "current_life" )-p_damage )
$head_infos_viewport/head_infos/bars/life.max_value = $creature.creature.get_max_life()
$head_infos_viewport/head_infos/bars/life.value = $creature.creature.get_data( "current_life", 0 )
func die():
self.is_dying = true
self.is_dying = true
func _on_creature_equip(p_slot, p_item):
var weapons = self.get_weapons()
if weapons.size() > 0:
var max_delay = null
for weapon in weapons:
if not max_delay:
max_delay = weapon.get_data( "attack_delay" )
else:
max_delay = max( max_delay, weapon.get_data( "attack_delay" ) )
$attack_delay.wait_time = max_delay
emit_signal( "equip", p_slot, p_item )
var weapons = self.get_weapons()
if weapons.size() > 0:
var max_delay = null
for weapon in weapons:
if not max_delay:
max_delay = weapon.get_data( "attack_delay" )
else:
max_delay = max( max_delay, weapon.get_data( "attack_delay" ) )
$attack_delay.wait_time = max_delay
emit_signal( "equip", p_slot, p_item )
func _on_creature_unequip(p_slot):
emit_signal( "unequip", p_slot )
emit_signal( "unequip", p_slot )
func _on_attack_delay_timeout():
self.can_attack = true
self.can_attack = true
func _on_creature_is_dead():
self.die()
self.die()

View file

@ -85,6 +85,7 @@ size = Vector2( 1, 1.5 )
[node name="attack_delay" type="Timer" parent="."]
one_shot = true
[connection signal="animation_finished" from="creature" to="." method="_on_creature_animation_finished"]
[connection signal="equip" from="creature" to="." method="_on_creature_equip"]
[connection signal="is_dead" from="creature" to="." method="_on_creature_is_dead"]

View file

@ -11,407 +11,412 @@ var eye_color_list = [ "blue_eye", "bluegreen_eye","brown_eye","deepblue_eye","g
class Slot:
var item = null
var attachment = null
func _init( p_attachment = null ):
self.attachment = p_attachment
var item = null
var attachment = null
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() }
, 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() }
func _ready():
self.duplicate_meshes()
self.duplicate_meshes()
func duplicate_meshes():
for body in $body_parts.get_children():
for mesh in body.get_node( "skeleton" ).get_children():
if mesh is MeshInstance:
var new_mat = mesh.get( "material/0" ).duplicate()
var new_mesh = mesh.mesh.duplicate()
mesh.mesh = new_mesh
mesh.set( "material/0", new_mat )
for body in $hair_parts.get_children():
for mesh in body.get_node( "skeleton" ).get_children():
if mesh is MeshInstance:
var new_mat = mesh.get( "material/0" ).duplicate()
var new_mesh = mesh.mesh.duplicate()
mesh.mesh = new_mesh
mesh.set( "material/0", new_mat )
for body in $cloths.get_children():
for mesh in body.get_node( "skeleton" ).get_children():
if mesh is MeshInstance:
var new_mat = mesh.get( "material/0" ).duplicate()
var new_mesh = mesh.mesh.duplicate()
mesh.mesh = new_mesh
mesh.set( "material/0", new_mat )
self.update()
for body in $body_parts.get_children():
for mesh in body.get_node( "skeleton" ).get_children():
if mesh is MeshInstance:
var new_mat = mesh.get( "material/0" ).duplicate()
var new_mesh = mesh.mesh.duplicate()
mesh.mesh = new_mesh
mesh.set( "material/0", new_mat )
for body in $hair_parts.get_children():
for mesh in body.get_node( "skeleton" ).get_children():
if mesh is MeshInstance:
var new_mat = mesh.get( "material/0" ).duplicate()
var new_mesh = mesh.mesh.duplicate()
mesh.mesh = new_mesh
mesh.set( "material/0", new_mat )
for body in $cloths.get_children():
for mesh in body.get_node( "skeleton" ).get_children():
if mesh is MeshInstance:
var new_mat = mesh.get( "material/0" ).duplicate()
var new_mesh = mesh.mesh.duplicate()
mesh.mesh = new_mesh
mesh.set( "material/0", new_mat )
self.update()
func set_blend_shape( p_blend_shape_name, p_value ):
for child in $body_parts.get_children():
var skeleton = child.get_node( "skeleton" )
for node in skeleton.get_children():
if node is MeshInstance:
node.set( "blend_shapes/"+p_blend_shape_name, p_value )
for child in $hair_parts.get_children():
var skeleton = child.get_node( "skeleton" )
for node in skeleton.get_children():
if node is MeshInstance:
node.set( "blend_shapes/"+p_blend_shape_name, p_value )
for child in $cloths.get_children():
var skeleton = child.get_node( "skeleton" )
for node in skeleton.get_children():
if node is MeshInstance:
node.set( "blend_shapes/"+p_blend_shape_name, p_value )
for child in $body_parts.get_children():
var skeleton = child.get_node( "skeleton" )
for node in skeleton.get_children():
if node is MeshInstance:
node.set( "blend_shapes/"+p_blend_shape_name, p_value )
for child in $hair_parts.get_children():
var skeleton = child.get_node( "skeleton" )
for node in skeleton.get_children():
if node is MeshInstance:
node.set( "blend_shapes/"+p_blend_shape_name, p_value )
for child in $cloths.get_children():
var skeleton = child.get_node( "skeleton" )
for node in skeleton.get_children():
if node is MeshInstance:
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 name_split = p_name.split( "_" )
new_creature.set_data( "first_name", name_split[0] )
new_creature.set_data( "last_name", name_split[1] )
new_creature.load( null, p_emplacement )
self.creature = new_creature
self.update()
var new_creature = Datas.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] )
new_creature.load( null, p_emplacement )
self.creature = new_creature
self.update()
func update():
if self.creature:
self.scale = Vector3( self.creature.get_data( "size" ), self.creature.get_data( "size" ), self.creature.get_data( "size" ) )
self.set_blend_shape( "caucasian", self.creature.get_data( "caucasian" ) )
self.set_blend_shape( "african", self.creature.get_data( "african" ) )
self.set_blend_shape( "asian", self.creature.get_data( "asian" ) )
if self.creature.get_data( "sex" ) == Globals.SEX.female:
if self.creature.get_data( "skin" ) == 0:
self.get_node( "body_parts/body/skeleton/body" ).get_surface_material( 0 ).set_shader_param( "texture_albedo", preload( "res://assets/creatures/human/textures/young_lightskinned_female_diffuse.png" ) )
elif self.creature.get_data( "skin" ) == 1:
self.get_node( "body_parts/body/skeleton/body" ).get_surface_material( 0 ).set_shader_param( "texture_albedo", preload( "res://assets/creatures/human/textures/young_lightskinned_female_diffuse3.png" ) )
elif self.creature.get_data( "skin" ) == 2:
self.get_node( "body_parts/body/skeleton/body" ).get_surface_material( 0 ).set_shader_param( "texture_albedo", preload( "res://assets/creatures/human/textures/young_darkskinned_female_diffuse.png" ) )
elif self.creature.get_data( "sex" ) == Globals.SEX.male:
if self.creature.get_data( "skin" ) == 0:
self.get_node( "body_parts/body/skeleton/body" ).get_surface_material( 0 ).set_shader_param( "texture_albedo", preload( "res://assets/creatures/human/textures/young_lightskinned_male_diffuse2.png" ) )
elif self.creature.get_data( "skin" ) == 1:
self.get_node( "body_parts/body/skeleton/body" ).get_surface_material( 0 ).set_shader_param( "texture_albedo", preload( "res://assets/creatures/human/textures/young_lightskinned_male_diffuse3.png" ) )
elif self.creature.get_data( "skin" ) == 2:
self.get_node( "body_parts/body/skeleton/body" ).get_surface_material( 0 ).set_shader_param( "texture_albedo", preload( "res://assets/creatures/human/textures/young_darkskinned_male_diffuse.png" ) )
Config.msg_debug("Update")
if self.creature:
Config.msg_debug("scale:" + str(self.scale) + " y:" + str(self.translation.y))
if self.scale.y != self.creature.get_data( "size" ):
var delta_y = self.translation.y - self.scale.y
Config.msg_debug("scale:" + str(self.scale) + " y:" + str(self.translation.y) + " deltaY:" + str(delta_y))
self.scale = Vector3( self.creature.get_data( "size" ), self.creature.get_data( "size" ), self.creature.get_data( "size" ) )
self.translation.y = self.scale.y + delta_y
Config.msg_debug("scale:" + str(self.scale) + " y:" + str(self.translation.y) + " deltaY:" + str(self.translation.y - self.scale.y))
self.set_blend_shape( "caucasian", self.creature.get_data( "caucasian" ) )
self.set_blend_shape( "african", self.creature.get_data( "african" ) )
self.set_blend_shape( "asian", self.creature.get_data( "asian" ) )
if self.creature.get_data( "sex" ) == Globals.SEX.female:
if self.creature.get_data( "skin" ) == 0:
self.get_node( "body_parts/body/skeleton/body" ).get_surface_material( 0 ).set_shader_param( "texture_albedo", preload( "res://assets/creatures/human/textures/young_lightskinned_female_diffuse.png" ) )
elif self.creature.get_data( "skin" ) == 1:
self.get_node( "body_parts/body/skeleton/body" ).get_surface_material( 0 ).set_shader_param( "texture_albedo", preload( "res://assets/creatures/human/textures/young_lightskinned_female_diffuse3.png" ) )
elif self.creature.get_data( "skin" ) == 2:
self.get_node( "body_parts/body/skeleton/body" ).get_surface_material( 0 ).set_shader_param( "texture_albedo", preload( "res://assets/creatures/human/textures/young_darkskinned_female_diffuse.png" ) )
elif self.creature.get_data( "sex" ) == Globals.SEX.male:
if self.creature.get_data( "skin" ) == 0:
self.get_node( "body_parts/body/skeleton/body" ).get_surface_material( 0 ).set_shader_param( "texture_albedo", preload( "res://assets/creatures/human/textures/young_lightskinned_male_diffuse2.png" ) )
elif self.creature.get_data( "skin" ) == 1:
self.get_node( "body_parts/body/skeleton/body" ).get_surface_material( 0 ).set_shader_param( "texture_albedo", preload( "res://assets/creatures/human/textures/young_lightskinned_male_diffuse3.png" ) )
elif self.creature.get_data( "skin" ) == 2:
self.get_node( "body_parts/body/skeleton/body" ).get_surface_material( 0 ).set_shader_param( "texture_albedo", preload( "res://assets/creatures/human/textures/young_darkskinned_male_diffuse.png" ) )
if self.creature.get_data( "sex" ) == Globals.SEX.female:
if self.creature.get_data( "hair" ) == 0:
self.get_node( "hair_parts/mh_human_female_hair" ).hide()
elif self.creature.get_data( "hair" ) == 1:
self.get_node( "hair_parts/mh_human_female_hair" ).show()
self.get_node( "hair_parts/mh_human_female_hair/skeleton/hair" ).get_surface_material( 0 ).albedo_texture = preload( "res://assets/creatures/human/textures/human_female_hair_001.png" )
elif self.creature.get_data( "hair" ) == 2:
self.get_node( "hair_parts/mh_human_female_hair" ).show()
self.get_node( "hair_parts/mh_human_female_hair/skeleton/hair" ).get_surface_material( 0 ).albedo_texture = preload( "res://assets/creatures/human/textures/human_female_hair_002.png" )
elif self.creature.get_data( "sex" ) == Globals.SEX.male:
if self.creature.get_data( "hair" ) == 0:
self.get_node( "hair_parts/mh_human_male_hair" ).hide()
elif self.creature.get_data( "hair" ) == 1:
self.get_node( "hair_parts/mh_human_male_hair" ).show()
self.get_node( "hair_parts/mh_human_male_hair/skeleton/hair" ).get_surface_material( 0 ).albedo_texture = preload( "res://assets/creatures/human/textures/human_male_hair.png" )
for hair in $hair_parts.get_children():
if hair.has_node( "skeleton/hair" ) and hair.get_node( "skeleton/hair" ).get_surface_material( 0 ):
hair.get_node( "skeleton/hair" ).get_surface_material( 0 ).albedo_color = self.creature.get_data( "hair_color" )
if self.creature.get_data( "sex" ) == Globals.SEX.female:
if self.creature.get_data( "hair" ) == 0:
self.get_node( "hair_parts/mh_human_female_hair" ).hide()
elif self.creature.get_data( "hair" ) == 1:
self.get_node( "hair_parts/mh_human_female_hair" ).show()
self.get_node( "hair_parts/mh_human_female_hair/skeleton/hair" ).get_surface_material( 0 ).albedo_texture = preload( "res://assets/creatures/human/textures/human_female_hair_001.png" )
elif self.creature.get_data( "hair" ) == 2:
self.get_node( "hair_parts/mh_human_female_hair" ).show()
self.get_node( "hair_parts/mh_human_female_hair/skeleton/hair" ).get_surface_material( 0 ).albedo_texture = preload( "res://assets/creatures/human/textures/human_female_hair_002.png" )
elif self.creature.get_data( "sex" ) == Globals.SEX.male:
if self.creature.get_data( "hair" ) == 0:
self.get_node( "hair_parts/mh_human_male_hair" ).hide()
elif self.creature.get_data( "hair" ) == 1:
self.get_node( "hair_parts/mh_human_male_hair" ).show()
self.get_node( "hair_parts/mh_human_male_hair/skeleton/hair" ).get_surface_material( 0 ).albedo_texture = preload( "res://assets/creatures/human/textures/human_male_hair.png" )
for hair in $hair_parts.get_children():
if hair.has_node( "skeleton/hair" ) and hair.get_node( "skeleton/hair" ).get_surface_material( 0 ):
hair.get_node( "skeleton/hair" ).get_surface_material( 0 ).albedo_color = self.creature.get_data( "hair_color" )
if self.creature.get_data( "muscles" ) > 0.0:
self.set_blend_shape( "muscles_min", 0.0 )
self.set_blend_shape( "muscles_max", self.creature.get_data( "muscles" ) )
elif self.creature.get_data( "muscles" ) < 0.0:
self.set_blend_shape( "muscles_min", -self.creature.get_data( "muscles" ) )
self.set_blend_shape( "muscles_max", 0.0 )
else:
self.set_blend_shape( "muscles_min", 0.0 )
self.set_blend_shape( "muscles_max", 0.0 )
if self.creature.get_data( "fat" ) > 0.0:
self.set_blend_shape( "fat_min", 0.0 )
self.set_blend_shape( "fat_max", self.creature.get_data( "fat" ) )
elif self.creature.get_data( "fat" ) < 0.0:
self.set_blend_shape( "fat_min", -self.creature.get_data( "fat" ) )
self.set_blend_shape( "fat_max", 0.0 )
else:
self.set_blend_shape( "fat_min", 0.0 )
self.set_blend_shape( "fat_max", 0.0 )
if self.creature.get_data( "proportion" ) > 0.0:
self.set_blend_shape( "proportion_min", 0.0 )
self.set_blend_shape( "proportion_max", self.creature.get_data( "proportion" ) )
elif self.creature.get_data( "proportion" ) < 0.0:
self.set_blend_shape( "proportion_min", -self.creature.get_data( "proportion" ) )
self.set_blend_shape( "proportion_max", 0.0 )
else:
self.set_blend_shape( "proportion_min", 0.0 )
self.set_blend_shape( "proportion_max", 0.0 )
if self.creature.get_data( "breast" ) > 0.0:
self.set_blend_shape( "breast_min", 0.0 )
self.set_blend_shape( "breast_max", self.creature.get_data( "breast" ) )
elif self.creature.get_data( "breast" ) < 0.0:
self.set_blend_shape( "breast_min", -self.creature.get_data( "breast" ) )
self.set_blend_shape( "breast_max", 0.0 )
else:
self.set_blend_shape( "breast_min", 0.0 )
self.set_blend_shape( "breast_max", 0.0 )
if self.creature.get_data( "muscles" ) > 0.0:
self.set_blend_shape( "muscles_min", 0.0 )
self.set_blend_shape( "muscles_max", self.creature.get_data( "muscles" ) )
elif self.creature.get_data( "muscles" ) < 0.0:
self.set_blend_shape( "muscles_min", -self.creature.get_data( "muscles" ) )
self.set_blend_shape( "muscles_max", 0.0 )
else:
self.set_blend_shape( "muscles_min", 0.0 )
self.set_blend_shape( "muscles_max", 0.0 )
if self.creature.get_data( "fat" ) > 0.0:
self.set_blend_shape( "fat_min", 0.0 )
self.set_blend_shape( "fat_max", self.creature.get_data( "fat" ) )
elif self.creature.get_data( "fat" ) < 0.0:
self.set_blend_shape( "fat_min", -self.creature.get_data( "fat" ) )
self.set_blend_shape( "fat_max", 0.0 )
else:
self.set_blend_shape( "fat_min", 0.0 )
self.set_blend_shape( "fat_max", 0.0 )
if self.creature.get_data( "proportion" ) > 0.0:
self.set_blend_shape( "proportion_min", 0.0 )
self.set_blend_shape( "proportion_max", self.creature.get_data( "proportion" ) )
elif self.creature.get_data( "proportion" ) < 0.0:
self.set_blend_shape( "proportion_min", -self.creature.get_data( "proportion" ) )
self.set_blend_shape( "proportion_max", 0.0 )
else:
self.set_blend_shape( "proportion_min", 0.0 )
self.set_blend_shape( "proportion_max", 0.0 )
if self.creature.get_data( "breast" ) > 0.0:
self.set_blend_shape( "breast_min", 0.0 )
self.set_blend_shape( "breast_max", self.creature.get_data( "breast" ) )
elif self.creature.get_data( "breast" ) < 0.0:
self.set_blend_shape( "breast_min", -self.creature.get_data( "breast" ) )
self.set_blend_shape( "breast_max", 0.0 )
else:
self.set_blend_shape( "breast_min", 0.0 )
self.set_blend_shape( "breast_max", 0.0 )
if self.creature.get_data( "sex" ) == Globals.SEX.female:
self.set_blend_shape( "pregnancy", self.creature.get_data( "pregnancy" ) )
# Skin tone.
if self.get_node( "body_parts/body/skeleton/body" ).get( "material/0" ) and self.get_node( "body_parts/body/skeleton/body" ).get( "material/0" ) is ShaderMaterial:
var color = self.get_node( "body_parts/body/skeleton/body" ).get( "material/0" ).get_shader_param( "albedo" )
color.v = 1.0 - self.creature.get_data( "skin_tone" )
self.get_node( "body_parts/body/skeleton/body" ).get( "material/0" ).set_shader_param( "albedo", color )
if self.creature.get_data( "sex" ) == Globals.SEX.female:
self.set_blend_shape( "pregnancy", self.creature.get_data( "pregnancy" ) )
# Skin tone.
if self.get_node( "body_parts/body/skeleton/body" ).get( "material/0" ) and self.get_node( "body_parts/body/skeleton/body" ).get( "material/0" ) is ShaderMaterial:
var color = self.get_node( "body_parts/body/skeleton/body" ).get( "material/0" ).get_shader_param( "albedo" )
color.v = 1.0 - self.creature.get_data( "skin_tone" )
self.get_node( "body_parts/body/skeleton/body" ).get( "material/0" ).set_shader_param( "albedo", color )
self.set_blend_shape( "cleft_chin", self.creature.get_data( "cleft_chin" ) )
self.set_blend_shape( "chin_angle", self.creature.get_data( "chin_angle" ) )
if self.creature.get_data( "mouth_horiz" ) > 0.0:
self.set_blend_shape( "mouth_horiz_min", 0.0 )
self.set_blend_shape( "mouth_horiz_max", self.creature.get_data( "mouth_horiz" ) )
elif self.creature.get_data( "mouth_horiz" ) < 0.0:
self.set_blend_shape( "mouth_horiz_min", -self.creature.get_data( "mouth_horiz" ) )
self.set_blend_shape( "mouth_horiz_max", 0.0 )
else:
self.set_blend_shape( "mouth_horiz_min", 0.0 )
self.set_blend_shape( "mouth_horiz_max", 0.0 )
if self.creature.get_data( "mouth_vert" ) > 0.0:
self.set_blend_shape( "mouth_vert_min", 0.0 )
self.set_blend_shape( "mouth_vert_max", self.creature.get_data( "mouth_vert" ) )
elif self.creature.get_data( "mouth_vert" ) < 0.0:
self.set_blend_shape( "mouth_vert_min", -self.creature.get_data( "mouth_vert" ) )
self.set_blend_shape( "mouth_vert_max", 0.0 )
else:
self.set_blend_shape( "mouth_vert_min", 0.0 )
self.set_blend_shape( "mouth_vert_max", 0.0 )
if self.creature.get_data( "nose_galbe" ) > 0.0:
self.set_blend_shape( "nose_galbe_min", 0.0 )
self.set_blend_shape( "nose_galbe_max", self.creature.get_data( "nose_galbe" ) )
elif self.creature.get_data( "nose_galbe" ) < 0.0:
self.set_blend_shape( "nose_galbe_min", -self.creature.get_data( "nose_galbe" ) )
self.set_blend_shape( "nose_galbe_max", 0.0 )
else:
self.set_blend_shape( "nose_galbe_min", 0.0 )
self.set_blend_shape( "nose_galbe_max", 0.0 )
if self.creature.get_data( "nose_grec" ) > 0.0:
self.set_blend_shape( "nose_grec_min", 0.0 )
self.set_blend_shape( "nose_grec_max", self.creature.get_data( "nose_grec" ) )
elif self.creature.get_data( "nose_grec" ) < 0.0:
self.set_blend_shape( "nose_grec_min", -self.creature.get_data( "nose_grec" ) )
self.set_blend_shape( "nose_grec_max", 0.0 )
else:
self.set_blend_shape( "nose_grec_min", 0.0 )
self.set_blend_shape( "nose_grec_max", 0.0 )
if self.creature.get_data( "nose_horiz" ) > 0.0:
self.set_blend_shape( "nose_horiz_min", 0.0 )
self.set_blend_shape( "nose_horiz_max", self.creature.get_data( "nose_horiz" ) )
elif self.creature.get_data( "nose_horiz" ) < 0.0:
self.set_blend_shape( "nose_horiz_min", -self.creature.get_data( "nose_horiz" ) )
self.set_blend_shape( "nose_horiz_max", 0.0 )
else:
self.set_blend_shape( "nose_horiz_min", 0.0 )
self.set_blend_shape( "nose_horiz_max", 0.0 )
if self.creature.get_data( "nose_depth" ) > 0.0:
self.set_blend_shape( "nose_depth_min", 0.0 )
self.set_blend_shape( "nose_depth_max", self.creature.get_data( "nose_depth" ) )
elif self.creature.get_data( "nose_depth" ) < 0.0:
self.set_blend_shape( "nose_depth_min", -self.creature.get_data( "nose_depth" ) )
self.set_blend_shape( "nose_depth_max", 0.0 )
else:
self.set_blend_shape( "nose_depth_min", 0.0 )
self.set_blend_shape( "nose_depth_max", 0.0 )
self.get_node( "body_parts/body/skeleton/eyes" ).get_surface_material( 0 ).albedo_texture = load( "res://assets/creatures/human/textures/"+self.eye_color_list[ self.creature.get_data( "eyes_color", 0 ) ]+".png" )
if self.creature.get_data( "eyes_vert" ) > 0.0:
self.set_blend_shape( "eyes_vert_min", 0.0 )
self.set_blend_shape( "eyes_vert_max", self.creature.get_data( "eyes_vert" ) )
elif self.creature.get_data( "eyes_vert" ) < 0.0:
self.set_blend_shape( "eyes_vert_min", -self.creature.get_data( "eyes_vert" ) )
self.set_blend_shape( "eyes_vert_max", 0.0 )
else:
self.set_blend_shape( "eyes_vert_min", 0.0 )
self.set_blend_shape( "eyes_vert_max", 0.0 )
if self.creature.get_data( "eyes_gap" ) > 0.0:
self.set_blend_shape( "eyes_gap_min", 0.0 )
self.set_blend_shape( "eyes_gap_max", self.creature.get_data( "eyes_gap" ) )
elif self.creature.get_data( "eyes_gap" ) < 0.0:
self.set_blend_shape( "eyes_gap_min", -self.creature.get_data( "eyes_gap" ) )
self.set_blend_shape( "eyes_gap_max", 0.0 )
else:
self.set_blend_shape( "eyes_gap_min", 0.0 )
self.set_blend_shape( "eyes_gap_max", 0.0 )
self.set_blend_shape( "earlobes", self.creature.get_data( "earlobes" ) )
self.set_blend_shape( "ears_wing", self.creature.get_data( "ears_wing" ) )
if self.creature.get_data( "lips_up_shape" ) > 0.0:
self.set_blend_shape( "lips_up_shape_min", 0.0 )
self.set_blend_shape( "lips_up_shape_max", self.creature.get_data( "lips_up_shape" ) )
elif self.creature.get_data( "lips_up_shape" ) < 0.0:
self.set_blend_shape( "lips_up_shape_min", -self.creature.get_data( "lips_up_shape" ) )
self.set_blend_shape( "lips_up_shape_max", 0.0 )
else:
self.set_blend_shape( "lips_up_shape_min", 0.0 )
self.set_blend_shape( "lips_up_shape_max", 0.0 )
if self.creature.get_data( "lips_up_shape_2" ) > 0.0:
self.set_blend_shape( "lips_up_shape_2_min", 0.0 )
self.set_blend_shape( "lips_up_shape_2_max", self.creature.get_data( "lips_up_shape_2" ) )
elif self.creature.get_data( "lips_up_shape_2" ) < 0.0:
self.set_blend_shape( "lips_up_shape_2_min", -self.creature.get_data( "lips_up_shape_2" ) )
self.set_blend_shape( "lips_up_shape_2_max", 0.0 )
else:
self.set_blend_shape( "lips_up_shape_2_min", 0.0 )
self.set_blend_shape( "lips_up_shape_2_max", 0.0 )
self.set_blend_shape( "nipple_flat", 1.0 )
self.set_blend_shape( "cleft_chin", self.creature.get_data( "cleft_chin" ) )
self.set_blend_shape( "chin_angle", self.creature.get_data( "chin_angle" ) )
if self.creature.get_data( "mouth_horiz" ) > 0.0:
self.set_blend_shape( "mouth_horiz_min", 0.0 )
self.set_blend_shape( "mouth_horiz_max", self.creature.get_data( "mouth_horiz" ) )
elif self.creature.get_data( "mouth_horiz" ) < 0.0:
self.set_blend_shape( "mouth_horiz_min", -self.creature.get_data( "mouth_horiz" ) )
self.set_blend_shape( "mouth_horiz_max", 0.0 )
else:
self.set_blend_shape( "mouth_horiz_min", 0.0 )
self.set_blend_shape( "mouth_horiz_max", 0.0 )
if self.creature.get_data( "mouth_vert" ) > 0.0:
self.set_blend_shape( "mouth_vert_min", 0.0 )
self.set_blend_shape( "mouth_vert_max", self.creature.get_data( "mouth_vert" ) )
elif self.creature.get_data( "mouth_vert" ) < 0.0:
self.set_blend_shape( "mouth_vert_min", -self.creature.get_data( "mouth_vert" ) )
self.set_blend_shape( "mouth_vert_max", 0.0 )
else:
self.set_blend_shape( "mouth_vert_min", 0.0 )
self.set_blend_shape( "mouth_vert_max", 0.0 )
if self.creature.get_data( "nose_galbe" ) > 0.0:
self.set_blend_shape( "nose_galbe_min", 0.0 )
self.set_blend_shape( "nose_galbe_max", self.creature.get_data( "nose_galbe" ) )
elif self.creature.get_data( "nose_galbe" ) < 0.0:
self.set_blend_shape( "nose_galbe_min", -self.creature.get_data( "nose_galbe" ) )
self.set_blend_shape( "nose_galbe_max", 0.0 )
else:
self.set_blend_shape( "nose_galbe_min", 0.0 )
self.set_blend_shape( "nose_galbe_max", 0.0 )
if self.creature.get_data( "nose_grec" ) > 0.0:
self.set_blend_shape( "nose_grec_min", 0.0 )
self.set_blend_shape( "nose_grec_max", self.creature.get_data( "nose_grec" ) )
elif self.creature.get_data( "nose_grec" ) < 0.0:
self.set_blend_shape( "nose_grec_min", -self.creature.get_data( "nose_grec" ) )
self.set_blend_shape( "nose_grec_max", 0.0 )
else:
self.set_blend_shape( "nose_grec_min", 0.0 )
self.set_blend_shape( "nose_grec_max", 0.0 )
if self.creature.get_data( "nose_horiz" ) > 0.0:
self.set_blend_shape( "nose_horiz_min", 0.0 )
self.set_blend_shape( "nose_horiz_max", self.creature.get_data( "nose_horiz" ) )
elif self.creature.get_data( "nose_horiz" ) < 0.0:
self.set_blend_shape( "nose_horiz_min", -self.creature.get_data( "nose_horiz" ) )
self.set_blend_shape( "nose_horiz_max", 0.0 )
else:
self.set_blend_shape( "nose_horiz_min", 0.0 )
self.set_blend_shape( "nose_horiz_max", 0.0 )
if self.creature.get_data( "nose_depth" ) > 0.0:
self.set_blend_shape( "nose_depth_min", 0.0 )
self.set_blend_shape( "nose_depth_max", self.creature.get_data( "nose_depth" ) )
elif self.creature.get_data( "nose_depth" ) < 0.0:
self.set_blend_shape( "nose_depth_min", -self.creature.get_data( "nose_depth" ) )
self.set_blend_shape( "nose_depth_max", 0.0 )
else:
self.set_blend_shape( "nose_depth_min", 0.0 )
self.set_blend_shape( "nose_depth_max", 0.0 )
self.get_node( "body_parts/body/skeleton/eyes" ).get_surface_material( 0 ).albedo_texture = load( "res://assets/creatures/human/textures/"+self.eye_color_list[ self.creature.get_data( "eyes_color", 0 ) ]+".png" )
if self.creature.get_data( "eyes_vert" ) > 0.0:
self.set_blend_shape( "eyes_vert_min", 0.0 )
self.set_blend_shape( "eyes_vert_max", self.creature.get_data( "eyes_vert" ) )
elif self.creature.get_data( "eyes_vert" ) < 0.0:
self.set_blend_shape( "eyes_vert_min", -self.creature.get_data( "eyes_vert" ) )
self.set_blend_shape( "eyes_vert_max", 0.0 )
else:
self.set_blend_shape( "eyes_vert_min", 0.0 )
self.set_blend_shape( "eyes_vert_max", 0.0 )
if self.creature.get_data( "eyes_gap" ) > 0.0:
self.set_blend_shape( "eyes_gap_min", 0.0 )
self.set_blend_shape( "eyes_gap_max", self.creature.get_data( "eyes_gap" ) )
elif self.creature.get_data( "eyes_gap" ) < 0.0:
self.set_blend_shape( "eyes_gap_min", -self.creature.get_data( "eyes_gap" ) )
self.set_blend_shape( "eyes_gap_max", 0.0 )
else:
self.set_blend_shape( "eyes_gap_min", 0.0 )
self.set_blend_shape( "eyes_gap_max", 0.0 )
self.set_blend_shape( "earlobes", self.creature.get_data( "earlobes" ) )
self.set_blend_shape( "ears_wing", self.creature.get_data( "ears_wing" ) )
if self.creature.get_data( "lips_up_shape" ) > 0.0:
self.set_blend_shape( "lips_up_shape_min", 0.0 )
self.set_blend_shape( "lips_up_shape_max", self.creature.get_data( "lips_up_shape" ) )
elif self.creature.get_data( "lips_up_shape" ) < 0.0:
self.set_blend_shape( "lips_up_shape_min", -self.creature.get_data( "lips_up_shape" ) )
self.set_blend_shape( "lips_up_shape_max", 0.0 )
else:
self.set_blend_shape( "lips_up_shape_min", 0.0 )
self.set_blend_shape( "lips_up_shape_max", 0.0 )
if self.creature.get_data( "lips_up_shape_2" ) > 0.0:
self.set_blend_shape( "lips_up_shape_2_min", 0.0 )
self.set_blend_shape( "lips_up_shape_2_max", self.creature.get_data( "lips_up_shape_2" ) )
elif self.creature.get_data( "lips_up_shape_2" ) < 0.0:
self.set_blend_shape( "lips_up_shape_2_min", -self.creature.get_data( "lips_up_shape_2" ) )
self.set_blend_shape( "lips_up_shape_2_max", 0.0 )
else:
self.set_blend_shape( "lips_up_shape_2_min", 0.0 )
self.set_blend_shape( "lips_up_shape_2_max", 0.0 )
self.set_blend_shape( "nipple_flat", 1.0 )
func play( anim_name, speed = 1.0 ):
for child in $body_parts.get_children():
child.get_node( "skeleton/AnimationPlayer" ).playback_speed = speed
if child.get_node( "skeleton/AnimationPlayer" ).has_animation( anim_name ):
child.get_node( "skeleton/AnimationPlayer" ).play( anim_name )
for child in $hair_parts.get_children():
child.get_node( "skeleton/AnimationPlayer" ).playback_speed = speed
if child.get_node( "skeleton/AnimationPlayer" ).has_animation( anim_name ):
child.get_node( "skeleton/AnimationPlayer" ).play( anim_name )
for child in $cloths.get_children():
child.get_node( "skeleton/AnimationPlayer" ).playback_speed = speed
if child.get_node( "skeleton/AnimationPlayer" ).has_animation( anim_name ):
child.get_node( "skeleton/AnimationPlayer" ).play( anim_name )
for child in $body_parts.get_children():
child.get_node( "skeleton/AnimationPlayer" ).playback_speed = speed
if child.get_node( "skeleton/AnimationPlayer" ).has_animation( anim_name ):
child.get_node( "skeleton/AnimationPlayer" ).play( anim_name )
for child in $hair_parts.get_children():
child.get_node( "skeleton/AnimationPlayer" ).playback_speed = speed
if child.get_node( "skeleton/AnimationPlayer" ).has_animation( anim_name ):
child.get_node( "skeleton/AnimationPlayer" ).play( anim_name )
for child in $cloths.get_children():
child.get_node( "skeleton/AnimationPlayer" ).playback_speed = speed
if child.get_node( "skeleton/AnimationPlayer" ).has_animation( anim_name ):
child.get_node( "skeleton/AnimationPlayer" ).play( anim_name )
func play_backwards( anim_name, speed = 1.0 ):
for child in $body_parts.get_children():
child.get_node( "skeleton/AnimationPlayer" ).playback_speed = speed
if child.get_node( "skeleton/AnimationPlayer" ).has_animation( anim_name ):
child.get_node( "skeleton/AnimationPlayer" ).play_backwards( anim_name )
for child in $hair_parts.get_children():
child.get_node( "skeleton/AnimationPlayer" ).playback_speed = speed
if child.get_node( "skeleton/AnimationPlayer" ).has_animation( anim_name ):
child.get_node( "skeleton/AnimationPlayer" ).play_backwards( anim_name )
for child in $cloths.get_children():
child.get_node( "skeleton/AnimationPlayer" ).playback_speed = speed
if child.get_node( "skeleton/AnimationPlayer" ).has_animation( anim_name ):
child.get_node( "skeleton/AnimationPlayer" ).play_backwards( anim_name )
for child in $body_parts.get_children():
child.get_node( "skeleton/AnimationPlayer" ).playback_speed = speed
if child.get_node( "skeleton/AnimationPlayer" ).has_animation( anim_name ):
child.get_node( "skeleton/AnimationPlayer" ).play_backwards( anim_name )
for child in $hair_parts.get_children():
child.get_node( "skeleton/AnimationPlayer" ).playback_speed = speed
if child.get_node( "skeleton/AnimationPlayer" ).has_animation( anim_name ):
child.get_node( "skeleton/AnimationPlayer" ).play_backwards( anim_name )
for child in $cloths.get_children():
child.get_node( "skeleton/AnimationPlayer" ).playback_speed = speed
if child.get_node( "skeleton/AnimationPlayer" ).has_animation( anim_name ):
child.get_node( "skeleton/AnimationPlayer" ).play_backwards( anim_name )
func can_turn():
var animation_player = $body_parts/body/skeleton/AnimationPlayer
return (animation_player.current_animation.begins_with( "turn_") and animation_player.current_animation_position >= 1.2) or (not animation_player.current_animation.begins_with( "turn_") and not animation_player.current_animation.begins_with( "idle"))
var animation_player = $body_parts/body/skeleton/AnimationPlayer
return (animation_player.current_animation.begins_with( "turn_") and animation_player.current_animation_position >= 1.2) or (not animation_player.current_animation.begins_with( "turn_") and not animation_player.current_animation.begins_with( "idle"))
func equip( p_item, p_slot = null ):
var model = load( p_item.get_data( "model_equiped", "") )
if not model:
model = load( p_item.get_data( "model", "") )
if model:
model = model.instance()
var attachment = null
if not p_slot:
p_slot = p_item.get_data( "default_slot" )
if p_slot and int(p_slot) in self.slots:
self.unequip( p_slot )
attachment = self.slots[ int(p_slot) ].attachment
self.slots[ int(p_slot) ].item = p_item
if attachment:
if attachment == "cloths":
model.name = str(int(p_slot))
$cloths.add_child( model )
var animation = $body_parts/body/skeleton/AnimationPlayer.current_animation
var animation_position = $body_parts/body/skeleton/AnimationPlayer.current_animation_position
var animation_speed = $body_parts/body/skeleton/AnimationPlayer.playback_speed
model.get_node( "skeleton/AnimationPlayer" ).stop()
model.get_node( "skeleton/AnimationPlayer" ).set( "playback_speed", animation_speed )
model.get_node( "skeleton/AnimationPlayer" ).play( animation )
model.get_node( "skeleton/AnimationPlayer" ).advance( animation_position )
else:
if $body_parts/body/skeleton.has_node( attachment ):
$body_parts/body/skeleton.get_node( attachment ).get_node( "handle" ).add_child( model )
emit_signal( "equip", int(p_slot), p_item )
var model = load( p_item.get_data( "model_equiped", "") )
if not model:
model = load( p_item.get_data( "model", "") )
if model:
model = model.instance()
var attachment = null
if not p_slot:
p_slot = p_item.get_data( "default_slot" )
if p_slot and int(p_slot) in self.slots:
self.unequip( p_slot )
attachment = self.slots[ int(p_slot) ].attachment
self.slots[ int(p_slot) ].item = p_item
if attachment:
if attachment == "cloths":
model.name = str(int(p_slot))
$cloths.add_child( model )
var animation = $body_parts/body/skeleton/AnimationPlayer.current_animation
var animation_position = $body_parts/body/skeleton/AnimationPlayer.current_animation_position
var animation_speed = $body_parts/body/skeleton/AnimationPlayer.playback_speed
model.get_node( "skeleton/AnimationPlayer" ).stop()
model.get_node( "skeleton/AnimationPlayer" ).set( "playback_speed", animation_speed )
model.get_node( "skeleton/AnimationPlayer" ).play( animation )
model.get_node( "skeleton/AnimationPlayer" ).advance( animation_position )
else:
if $body_parts/body/skeleton.has_node( attachment ):
$body_parts/body/skeleton.get_node( attachment ).get_node( "handle" ).add_child( model )
emit_signal( "equip", int(p_slot), p_item )
func unequip( p_slot ):
if p_slot and int(p_slot) in self.slots:
if self.slots[ int(p_slot) ].item:
var attachment = self.slots[ int(p_slot) ].attachment
self.slots[ int(p_slot) ].item = null
if attachment:
if attachment == "cloths":
var node = $cloths.get_node( str(p_slot) )
if node:
$cloths.remove_child( node )
node.queue_free()
else:
for child in $body_parts/body/skeleton.get_node( attachment ).get_node( "handle" ).get_children():
$body_parts/body/skeleton.get_node( attachment ).get_node( "handle" ).remove_child( child )
child.queue_free()
emit_signal( "unequip", int(p_slot) )
if p_slot and int(p_slot) in self.slots:
if self.slots[ int(p_slot) ].item:
var attachment = self.slots[ int(p_slot) ].attachment
self.slots[ int(p_slot) ].item = null
if attachment:
if attachment == "cloths":
var node = $cloths.get_node( str(p_slot) )
if node:
$cloths.remove_child( node )
node.queue_free()
else:
for child in $body_parts/body/skeleton.get_node( attachment ).get_node( "handle" ).get_children():
$body_parts/body/skeleton.get_node( attachment ).get_node( "handle" ).remove_child( child )
child.queue_free()
emit_signal( "unequip", int(p_slot) )
func drop_item( p_item ):
var new_inventory = self.creature.get_data( "inventory" )
var item_index = new_inventory.find( p_item )
if item_index != -1:
if new_inventory[ item_index ].get_data( "dropable", true ):
new_inventory[ item_index ].set_data( "number", new_inventory[ item_index ].get_data( "number" )-1 )
var new_inventory = self.creature.get_data( "inventory" )
var item_index = new_inventory.find( p_item )
if item_index != -1:
if new_inventory[ item_index ].get_data( "dropable", true ):
new_inventory[ item_index ].set_data( "number", new_inventory[ item_index ].get_data( "number" )-1 )
if new_inventory[ item_index ].get_data( "number" ) <= 0:
new_inventory.remove( item_index )
if new_inventory[ item_index ].get_data( "number" ) <= 0:
new_inventory.remove( item_index )
var pickup_item_node = preload( "res://scenes/items/pickup_item.tscn" ).instance()
pickup_item_node.item_filename = p_item.get_filename()
pickup_item_node.global_transform = $drop_point.global_transform
var pickup_item_node = preload( "res://scenes/items/pickup_item.tscn" ).instance()
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 )
pickup_item_node.item = pickup_item
if self.get_tree().get_root().has_node( "main/scene/game" ):
self.get_tree().get_root().get_node( "main/scene/game" ).get_node( "pickups" ).add_child( pickup_item_node )
var pickup_item = Datas.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" ):
self.get_tree().get_root().get_node( "main/scene/game" ).get_node( "pickups" ).add_child( pickup_item_node )
func _on_body_animation_finished( anim_name ):
emit_signal( "animation_finished", anim_name )
emit_signal( "animation_finished", anim_name )
func _on_body_limb_body_entered(limb, body):
if body.is_in_group( "bullet" ):
if limb == Datas.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()
emit_signal( "is_dead" )
self.creature.set_data( "current_life", 0.0 )
else:
var blood_particle = preload( "res://scenes/fx/blood_particles.tscn" ).instance()
$body_parts/body/skeleton/limb_torso_1.add_child( blood_particle )
blood_particle.emit()
if body.is_in_group( "bullet" ):
if limb == Datas.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()
emit_signal( "is_dead" )
self.creature.set_data( "current_life", 0.0 )
else:
var blood_particle = preload( "res://scenes/fx/blood_particles.tscn" ).instance()
$body_parts/body/skeleton/limb_torso_1.add_child( blood_particle )
blood_particle.emit()

View file

@ -229,7 +229,6 @@ func _on_underwear_button_toggled(button_pressed):
else:
$margin_box/window_box/content_box/preview_box/v_box_container/underwear_button.modulate.a = 0.5
func _on_zoom_head_button_toggled(button_pressed):
emit_signal( "zoom_head_button_toggled", button_pressed )

View file

@ -1,8 +1,27 @@
[gd_scene load_steps=4 format=2]
[gd_scene load_steps=7 format=2]
[ext_resource path="res://scenes/characters/character.tscn" type="PackedScene" id=1]
[ext_resource path="res://scenes/creatures/creature_creation_menu.tscn" type="PackedScene" id=2]
[ext_resource path="res://scenes/creatures/creatures_creation.gd" type="Script" id=3]
[ext_resource path="res://assets/interfaces/creatures_creation/Material.material" type="Material" id=4]
[sub_resource type="ArrayMesh" id=1]
resource_name = "Cube"
surfaces/0 = {
"aabb": AABB( -4, -1, -4, 8.00001, 1.00001, 8 ),
"array_data": PoolByteArray( 0, 0, 128, 64, 0, 0, 0, 0, 0, 0, 128, 192, 0, 0, 129, 0, 0, 127, 0, 127, 0, 57, 0, 56, 0, 0, 128, 64, 0, 0, 0, 0, 0, 0, 128, 192, 0, 127, 0, 0, 129, 0, 0, 127, 0, 57, 0, 56, 0, 0, 128, 64, 0, 0, 0, 0, 0, 0, 128, 192, 127, 0, 0, 0, 0, 127, 0, 127, 0, 57, 0, 56, 0, 0, 128, 64, 0, 0, 128, 191, 0, 0, 128, 192, 0, 129, 0, 0, 127, 0, 0, 127, 0, 54, 0, 56, 0, 0, 128, 64, 0, 0, 128, 191, 0, 0, 128, 192, 0, 0, 129, 0, 0, 127, 0, 127, 0, 54, 0, 56, 0, 0, 128, 64, 0, 0, 128, 191, 0, 0, 128, 192, 127, 0, 0, 0, 0, 127, 0, 127, 0, 54, 0, 56, 0, 0, 128, 64, 0, 0, 0, 0, 0, 0, 128, 64, 0, 0, 127, 0, 0, 127, 0, 127, 0, 57, 0, 52, 0, 0, 128, 64, 0, 0, 0, 0, 0, 0, 128, 64, 0, 127, 0, 0, 129, 0, 0, 127, 0, 57, 0, 52, 0, 0, 128, 64, 0, 0, 0, 0, 0, 0, 128, 64, 127, 0, 0, 0, 0, 127, 0, 127, 0, 57, 0, 52, 0, 0, 128, 64, 0, 0, 128, 191, 0, 0, 128, 64, 0, 129, 0, 0, 127, 0, 0, 127, 0, 54, 0, 52, 0, 0, 128, 64, 0, 0, 128, 191, 0, 0, 128, 64, 0, 0, 127, 0, 0, 127, 0, 127, 0, 54, 0, 52, 0, 0, 128, 64, 0, 0, 128, 191, 0, 0, 128, 64, 127, 0, 0, 0, 0, 127, 0, 127, 0, 54, 0, 52, 0, 0, 128, 192, 0, 0, 0, 0, 0, 0, 128, 192, 129, 0, 0, 0, 0, 127, 0, 127, 0, 57, 0, 58, 0, 0, 128, 192, 0, 0, 0, 0, 0, 0, 128, 192, 0, 0, 129, 0, 0, 127, 0, 127, 0, 57, 0, 58, 0, 0, 128, 192, 0, 0, 0, 0, 0, 0, 128, 192, 0, 127, 0, 0, 129, 0, 0, 127, 0, 59, 0, 56, 0, 0, 128, 192, 0, 0, 128, 191, 0, 0, 128, 192, 129, 0, 0, 0, 0, 127, 0, 127, 0, 54, 0, 58, 0, 0, 128, 192, 0, 0, 128, 191, 0, 0, 128, 192, 0, 129, 0, 0, 127, 0, 0, 127, 0, 48, 0, 56, 0, 0, 128, 192, 0, 0, 128, 191, 0, 0, 128, 192, 0, 0, 129, 0, 0, 127, 0, 127, 0, 54, 0, 58, 0, 0, 128, 192, 0, 0, 0, 0, 0, 0, 128, 64, 129, 0, 0, 0, 0, 127, 0, 127, 0, 57, 0, 60, 0, 0, 128, 192, 0, 0, 0, 0, 0, 0, 128, 64, 0, 0, 127, 0, 0, 127, 0, 127, 0, 57, 0, 0, 0, 0, 128, 192, 0, 0, 0, 0, 0, 0, 128, 64, 0, 127, 0, 0, 129, 0, 0, 127, 0, 59, 0, 52, 0, 0, 128, 192, 0, 0, 128, 191, 0, 0, 128, 64, 129, 0, 0, 0, 0, 127, 0, 127, 0, 54, 0, 60, 0, 0, 128, 192, 0, 0, 128, 191, 0, 0, 128, 64, 0, 129, 0, 0, 127, 0, 0, 127, 0, 48, 0, 52, 0, 0, 128, 192, 0, 0, 128, 191, 0, 0, 128, 64, 0, 0, 127, 0, 0, 127, 0, 127, 0, 54, 0, 0 ),
"array_index_data": PoolByteArray( 1, 0, 20, 0, 14, 0, 1, 0, 7, 0, 20, 0, 10, 0, 19, 0, 6, 0, 10, 0, 23, 0, 19, 0, 21, 0, 12, 0, 18, 0, 21, 0, 15, 0, 12, 0, 16, 0, 9, 0, 3, 0, 16, 0, 22, 0, 9, 0, 5, 0, 8, 0, 2, 0, 5, 0, 11, 0, 8, 0, 17, 0, 0, 0, 13, 0, 17, 0, 4, 0, 0, 0 ),
"blend_shape_data": [ ],
"format": 97559,
"index_count": 36,
"material": ExtResource( 4 ),
"primitive": 4,
"skeleton_aabb": [ ],
"vertex_count": 24
}
[sub_resource type="ConcavePolygonShape" id=2]
data = PoolVector3Array( 4, 0, -4, -4, 0, 4, -4, 0, -4, 4, 0, -4, 4, 0, 4, -4, 0, 4, 4, -1, 4, -4, 0, 4, 4, 0, 4, 4, -1, 4, -4, -1, 4, -4, 0, 4, -4, -1, 4, -4, 0, -4, -4, 0, 4, -4, -1, 4, -4, -1, -4, -4, 0, -4, -4, -1, -4, 4, -1, 4, 4, -1, -4, -4, -1, -4, -4, -1, 4, 4, -1, 4, 4, -1, -4, 4, 0, 4, 4, 0, -4, 4, -1, -4, 4, -1, 4, 4, 0, 4, -4, -1, -4, 4, 0, -4, -4, 0, -4, -4, -1, -4, 4, -1, -4, 4, 0, -4 )
[node name="creatures_creation" type="Spatial"]
script = ExtResource( 3 )
@ -27,6 +46,23 @@ gravity = 0.0
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="."]
[node name="Cube" type="MeshInstance" parent="root"]
mesh = SubResource( 1 )
material/0 = null
[node name="static_body" type="StaticBody" parent="root/Cube"]
[node name="collision_shape" type="CollisionShape" parent="root/Cube/static_body"]
shape = SubResource( 2 )
[node name="Light" type="Spatial" parent="root"]
transform = Transform( -0.290865, 0.566393, 0.771101, -0.0551891, 0.794672, -0.604525, -0.955171, -0.218391, -0.199883, 4.07625, 5.90386, -1.00545 )
[node name="Camera" type="Spatial" parent="root"]
transform = Transform( 0.685921, 0.651558, 0.324014, 0, 0.445271, -0.895396, -0.727676, 0.61417, 0.305421, 7.35889, 4.95831, 6.92579 )
[connection signal="choose_pressed" from="creature_creation_menu" to="." method="_on_creature_creation_menu_choose_pressed"]
[connection signal="cloths_button_toggled" from="creature_creation_menu" to="." method="_on_creature_creation_menu_cloths_button_toggled"]
[connection signal="load_pressed" from="creature_creation_menu" to="." method="_on_creature_creation_menu_load_pressed"]

View file

@ -30,5 +30,6 @@ transform = Transform( 1, 0, 0, 0, -1.62921e-07, 1, 0, -1, -1.62921e-07, 0, 0, 0
[node name="drop_point" type="Spatial" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.332089, -0.157172 )
[connection signal="animation_finished" from="body_parts/body" to="." method="_on_body_animation_finished"]
[connection signal="limb_body_entered" from="body_parts/body" to="." method="_on_body_limb_body_entered"]

View file

@ -15,31 +15,31 @@ signal animation_finished( anim_name )
signal limb_body_entered( limb, body )
func _on_AnimationPlayer_animation_finished(anim_name):
emit_signal( \"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\", Datas.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\", Datas.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\", Datas.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\", Datas.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\", Datas.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\", Datas.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\", Datas.Cloth.LIMB.left_upper_arm, body )
"
@ -179,6 +179,7 @@ bone_name = "pelvis.R"
[node name="handle" type="Spatial" parent="skeleton/attachment_hips_R" index="0"]
transform = Transform( -0.142459, -0.381941, -0.913079, -0.617878, -0.686553, 0.383382, -0.773427, 0.618672, -0.138049, 0.0391004, 0.0367368, 0.013404 )
[connection signal="animation_finished" from="skeleton/AnimationPlayer" to="." method="_on_AnimationPlayer_animation_finished"]
[connection signal="body_entered" from="skeleton/limb_head/area" to="." method="_on_limb_head_area_body_entered"]
[connection signal="body_entered" from="skeleton/limb_torso_1/area" to="." method="_on_limb_tosro_1_body_entered"]

View file

@ -5,5 +5,5 @@ class_name focus_reticle
export( Vector2 ) var size = Vector2( 1.0, 1.0 ) setget set_size
func set_size( p_value ):
size = p_value
self.mesh.size = p_value
size = p_value
self.mesh.size = p_value

View file

@ -249,6 +249,7 @@ func add_music(file: String):
self.next_id += 1
playlist_music['player'] = $window_box/scroll_box/musics_box.get_children()
load_music_to_config()
auto_sizing_windows()
func _on_music_box_delete_pressed( id ):
@ -256,6 +257,7 @@ func _on_music_box_delete_pressed( id ):
for child in $window_box/scroll_box/musics_box.get_children():
if child.id == id:
child.queue_free()
auto_sizing_windows()
func _on_music_box_down_pressed( id ):
@ -307,9 +309,35 @@ func move_child_id(id, pos):
load_music_to_config()
func auto_sizing_windows():
Config.msg_debug("Auto sizing Jukebox")
var max_x = 0
var max_y = $window_box/controls_box.rect_size.y
for child in $window_box/scroll_box/musics_box.get_children():
var x = 0
for child2 in child.get_children():
x += child2.rect_size.x
if max_x < x:
max_x += x
max_y += 24
var tx = int( (get_viewport().size.x - max_x) / 2 )
var ty = int( (get_viewport().size.y - max_y) / 2 )
if tx <= 20:
max_x = get_viewport().size.x - 20
tx = 10
if ty <= 20:
max_y = get_viewport().size.y - 20
ty = 10
self.rect_size.x = max_x
self.rect_position.x = tx
self.rect_size.y = max_y
self.rect_position.y = ty
func open():
Config.msg_debug("Open")
update_playermusic()
# auto_sizing_windows()
self.popup()

View file

@ -74,3 +74,7 @@ func _on_sound_button_pressed():
func _on_control_mute_pressed():
Config.msg_debug("<Option> Received Signal mute")
update_sound_button()
func _on_jukebox_button_pressed():
MusicManager.open()

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=19 format=2]
[gd_scene load_steps=21 format=2]
[ext_resource path="res://scenes/interfaces/options/options.gd" type="Script" id=1]
[ext_resource path="res://assets/interfaces/Login-Khanat-help-button.png" type="Texture" id=2]
@ -18,6 +18,8 @@
[ext_resource path="res://assets/interfaces/Login-Khanat-language-button-hover.png" type="Texture" id=16]
[ext_resource path="res://assets/interfaces/Login-Khanat-settings-button-hover.png" type="Texture" id=17]
[ext_resource path="res://scenes/interfaces/options/option_settings.tscn" type="PackedScene" id=18]
[ext_resource path="res://assets/interfaces/Login-Khanat-jukebox-button.png" type="Texture" id=19]
[ext_resource path="res://assets/interfaces/Login-Khanat-jukebox-button-hover.png" type="Texture" id=20]
[node name="control" type="Control"]
anchor_right = 1.0
@ -32,7 +34,7 @@ __meta__ = {
[node name="options_reduce" type="TextureRect" parent="."]
anchor_left = 1.0
anchor_right = 1.0
margin_left = -416.0
margin_left = -474.0
margin_bottom = 69.0
mouse_default_cursor_shape = 5
texture = ExtResource( 4 )
@ -41,8 +43,8 @@ __meta__ = {
}
[node name="h_box_container" type="HBoxContainer" parent="options_reduce"]
margin_left = 30.0
margin_right = 396.0
margin_left = 45.0
margin_right = 447.0
margin_bottom = 64.0
alignment = 2
__meta__ = {
@ -50,22 +52,21 @@ __meta__ = {
}
[node name="news_button" type="TextureButton" parent="options_reduce/h_box_container"]
margin_left = 22.0
margin_right = 76.0
margin_right = 54.0
margin_bottom = 64.0
texture_normal = ExtResource( 8 )
texture_hover = ExtResource( 15 )
[node name="language_button" type="TextureButton" parent="options_reduce/h_box_container"]
margin_left = 80.0
margin_right = 134.0
margin_left = 58.0
margin_right = 112.0
margin_bottom = 64.0
texture_normal = ExtResource( 9 )
texture_hover = ExtResource( 16 )
[node name="sound_button" type="TextureButton" parent="options_reduce/h_box_container"]
margin_left = 138.0
margin_right = 192.0
margin_left = 116.0
margin_right = 170.0
margin_bottom = 64.0
texture_normal = ExtResource( 6 )
texture_hover = ExtResource( 14 )
@ -73,23 +74,30 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="jukebox_button" type="TextureButton" parent="options_reduce/h_box_container"]
margin_left = 174.0
margin_right = 228.0
margin_bottom = 64.0
texture_normal = ExtResource( 19 )
texture_hover = ExtResource( 20 )
[node name="help_button" type="TextureButton" parent="options_reduce/h_box_container"]
margin_left = 196.0
margin_right = 250.0
margin_left = 232.0
margin_right = 286.0
margin_bottom = 64.0
texture_normal = ExtResource( 2 )
texture_hover = ExtResource( 7 )
[node name="settings_button" type="TextureButton" parent="options_reduce/h_box_container"]
margin_left = 254.0
margin_right = 308.0
margin_left = 290.0
margin_right = 344.0
margin_bottom = 64.0
texture_normal = ExtResource( 5 )
texture_hover = ExtResource( 17 )
[node name="quit_button" type="TextureButton" parent="options_reduce/h_box_container"]
margin_left = 312.0
margin_right = 366.0
margin_left = 348.0
margin_right = 402.0
margin_bottom = 64.0
texture_normal = ExtResource( 3 )
texture_hover = ExtResource( 10 )
@ -117,6 +125,7 @@ visible = false
[connection signal="pressed" from="options_reduce/h_box_container/news_button" to="." method="_on_news_button_pressed"]
[connection signal="pressed" from="options_reduce/h_box_container/language_button" to="." method="_on_language_button_pressed"]
[connection signal="pressed" from="options_reduce/h_box_container/sound_button" to="." method="_on_sound_button_pressed"]
[connection signal="pressed" from="options_reduce/h_box_container/jukebox_button" to="." method="_on_jukebox_button_pressed"]
[connection signal="pressed" from="options_reduce/h_box_container/help_button" to="." method="_on_help_button_pressed"]
[connection signal="pressed" from="options_reduce/h_box_container/settings_button" to="." method="_on_settings_button_pressed"]
[connection signal="pressed" from="options_reduce/h_box_container/quit_button" to="." method="_on_quit_button_pressed"]

View file

@ -11,13 +11,14 @@ var is_scene_loading = false
var creature_selected_slot = null
var creature_selected_filename = null
func _ready():
Connection.connect( "connection_ok", self, "_on_connexion_ok" )
Connection.connect( "connection_error", self, "_on_connection_error" )
#GeneratorMap.GenerateSphere()
#GeneratorMap.GenerateMap("res://ground-0-2-high.png", 0 , 0)
#GeneratorMap.GenerateMap("res://ground-0-4-high.png", 0 , 0)
Globals.ressource_queue.start()
func _process(_time):
if self.is_scene_loading:
if Globals.ressource_queue.is_ready( self.current_scene_path ):
@ -124,7 +125,7 @@ func goto_scene( p_path ):
# self.current_scene = scene_resource.instance()
# self.get_node("scene").add_child(self.current_scene)
# self.is_scene_loading = false
#func update_progress():
# self.get_node("loading_screen/progress_bar").value = Globals.ressource_queue.get_progress( self.current_scene_path )
#

View file

@ -1,8 +1,9 @@
[gd_scene load_steps=4 format=2]
[gd_scene load_steps=5 format=2]
[ext_resource path="res://scenes/interfaces/main_menu/main_menu.tscn" type="PackedScene" id=1]
[ext_resource path="res://scenes/interfaces/loading_screen/loading_screen.tscn" type="PackedScene" id=2]
[ext_resource path="res://scenes/main/main.gd" type="Script" id=3]
[ext_resource path="res://map0-0.tres" type="ArrayMesh" id=5]
[node name="main" type="Spatial"]
script = ExtResource( 3 )
@ -16,5 +17,10 @@ margin_bottom = 1.49829
[node name="loading_screen" parent="." instance=ExtResource( 2 )]
visible = false
[node name="mesh_instance_2" type="MeshInstance" parent="."]
visible = false
mesh = ExtResource( 5 )
material/0 = null
[connection signal="play_pressed" from="main_menu" to="." method="_on_main_menu_play_pressed"]
[connection signal="quit_pressed" from="main_menu" to="." method="_on_main_menu_quit_pressed"]

View file

@ -67,6 +67,7 @@ material/0 = SubResource( 3 )
[node name="collision_shape" type="CollisionShape" parent="character/crosshair/crosshair_area"]
shape = SubResource( 4 )
[connection signal="equip" from="character" to="." method="_on_character_equip"]
[connection signal="unequip" from="character" to="." method="_on_character_unequip"]
[connection signal="body_entered" from="character/interact_area" to="." method="_on_interact_area_body_entered"]