Initial commit.

This commit is contained in:
osquallo 2020-03-21 10:10:26 +01:00
parent 487da1e938
commit 9eb6e8ccbd
79 changed files with 1681 additions and 0 deletions

View file

@ -0,0 +1,45 @@
tool
extends HBoxContainer
signal changed
signal value_changed( value )
export( Texture ) var minus_texture setget set_minus_texture, get_minus_texture
func set_minus_texture( value ):
minus_texture = value
if self.has_node( "kh_h_slider/minus" ):
$kh_h_slider/minus.texture_normal = minus_texture
func get_minus_texture():
return minus_texture
export( Texture ) var plus_texture setget set_plus_texture, get_plus_texture
func set_plus_texture( value ):
plus_texture = value
if self.has_node( "kh_h_slider/plus" ):
$kh_h_slider/plus.texture_normal = plus_texture
func get_plus_texture():
return plus_texture
func _ready():
self.add_child( preload( "res://addons/kh_slider/kh_h_slider.tscn" ).instance() )
$kh_h_slider/minus.connect( "pressed", self, "_on_minus_pressed" )
$kh_h_slider/value.connect( "changed", self, "_on_value_changed" )
$kh_h_slider/value.connect( "value_changed", self, "_on_value_value_changed" )
$kh_h_slider/plus.connect( "pressed", self, "_on_plus_pressed" )
$kh_h_slider/minus.texture_normal = minus_texture
$kh_h_slider/plus.texture_normal = plus_texture
func _on_minus_pressed():
$kh_h_slider/value.value -= $kh_h_slider/value.step
func _on_plus_pressed():
$kh_h_slider/value.value += $kh_h_slider/value.step
func _on_value_changed():
emit_signal( "changed" )
func _on_value_value_changed( value ):
emit_signal( "value_changed", value )

Binary file not shown.

After

Width:  |  Height:  |  Size: 263 B

View file

@ -0,0 +1,28 @@
[gd_scene format=2]
[node name="kh_h_slider" type="HBoxContainer"]
anchor_right = 1.0
anchor_bottom = 1.0
size_flags_horizontal = 3
__meta__ = {
"_edit_use_anchors_": false
}
[node name="minus" type="TextureButton" parent="."]
margin_bottom = 720.0
[node name="value" type="HSlider" parent="."]
margin_left = 4.0
margin_top = 352.0
margin_right = 1276.0
margin_bottom = 368.0
size_flags_horizontal = 7
size_flags_vertical = 4
max_value = 1.0
step = 0.1
[node name="plus" type="TextureButton" parent="."]
margin_left = 1280.0
margin_right = 1280.0
margin_bottom = 720.0
size_flags_horizontal = 9

View file

@ -0,0 +1,8 @@
tool
extends EditorPlugin
func _enter_tree():
add_custom_type("KhHSlider", "HBoxContainer", preload("kh_h_slider.gd"), preload("kh_h_slider.png"))
func _exit_tree():
remove_custom_type("KhHSlider")

View file

@ -0,0 +1,7 @@
[plugin]
name="Kh horizontal slider"
description="A custom horizontal slider with plus and minus button."
author="Osquallo"
version="1.0.0"
script="kh_h_slider_plugin.gd"

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 MiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 239 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 592 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 182 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 367 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 377 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 213 B

Binary file not shown.

Binary file not shown.

8
default_env.tres Normal file
View file

@ -0,0 +1,8 @@
[gd_resource type="Environment" load_steps=2 format=2]
[sub_resource type="ProceduralSky" id=1]
sky_top_color = Color( 0.886275, 0.945098, 0.976471, 1 )
[resource]
background_mode = 2
background_sky = SubResource( 1 )

BIN
icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

106
project.godot Normal file
View file

@ -0,0 +1,106 @@
; Engine configuration file.
; It's best edited using the editor UI and not directly,
; since the parameters that go here are not all obvious.
;
; Format:
; [section] ; section goes between []
; param=value ; assign values to parameters
config_version=4
_global_script_classes=[ ]
_global_script_class_icons={
}
[application]
config/name="Khanat"
run/main_scene="res://scenes/main/main.tscn"
boot_splash/image="res://assets/interfaces/new_launcher_bg_0-1.png"
config/icon="res://icon.png"
[autoload]
Creatures="*res://ressources/scripts/creatures.gd"
MusicManager="*res://scenes/interfaces/music_manager/music_manager.tscn"
Connection="*res://scenes/connection/connection.tscn"
[display]
window/size/width=1280
window/size/height=720
[editor_plugins]
enabled=PoolStringArray( "kh_slider" )
[input]
move_forward={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":90,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777232,"unicode":0,"echo":false,"script":null)
]
}
move_backward={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":83,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777234,"unicode":0,"echo":false,"script":null)
]
}
move_left={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":81,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777231,"unicode":0,"echo":false,"script":null)
]
}
move_right={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":68,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777233,"unicode":0,"echo":false,"script":null)
]
}
turn_left={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":65,"unicode":0,"echo":false,"script":null)
]
}
turn_right={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":69,"unicode":0,"echo":false,"script":null)
]
}
creatures_editor_rotate_view_y={
"deadzone": 0.5,
"events": [ Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"button_mask":0,"position":Vector2( 0, 0 ),"global_position":Vector2( 0, 0 ),"factor":1.0,"button_index":3,"pressed":false,"doubleclick":false,"script":null)
]
}
creatures_editor_zoom_in={
"deadzone": 0.5,
"events": [ Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"button_mask":0,"position":Vector2( 0, 0 ),"global_position":Vector2( 0, 0 ),"factor":1.0,"button_index":4,"pressed":false,"doubleclick":false,"script":null)
]
}
creatures_editor_zoom_out={
"deadzone": 0.5,
"events": [ Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"button_mask":0,"position":Vector2( 0, 0 ),"global_position":Vector2( 0, 0 ),"factor":1.0,"button_index":5,"pressed":false,"doubleclick":false,"script":null)
]
}
music_manager={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":77,"unicode":0,"echo":false,"script":null)
]
}
[khanat]
debug_mode=true
[node]
name_num_separator=2
name_casing=2
[rendering]
environment/default_environment="res://default_env.tres"

View file

@ -0,0 +1,80 @@
extends Node
class Creature:
enum Sex { F, M, H, A, U }
var type
var pseudonym
func _init( p_pseudonym = "Créature" ):
self.type = "creature"
self.pseudonym = p_pseudonym
class Ra extends Creature:
var sex = Creature.Sex.F
var female_boobs = 0.0
var female_hip = 0.0
var male_pack = 0.0
var male_throat = 0.0
var female_pregnant = 0.0
var color = Color( 1.0, 1.0, 1.0 )
func _init( p_pseudonym = "Créature" ):
self.type = "ra"
self.pseudonym = p_pseudonym
func to_dictionary():
var dictionary = Dictionary()
dictionary[ "type" ] = self.type
dictionary[ "pseudonym" ] = self.pseudonym
dictionary[ "sex" ] = var2str( self.sex )
dictionary[ "female_boobs" ] = var2str( self.female_boobs )
dictionary[ "female_hip" ] = var2str( self.female_hip )
dictionary[ "male_pack" ] = var2str( self.male_pack )
dictionary[ "male_throat" ] = var2str( self.male_throat )
dictionary[ "female_pregnant" ] = var2str( self.female_pregnant )
dictionary[ "color" ] = var2str( self.color )
return dictionary
func from_dictionary( dictionary ):
self.pseudonym = dictionary.get( "pseudonym", self.pseudonym )
self.sex = dictionary.get( "sex", self.sex )
self.female_boobs = dictionary.get( "female_boobs", self.female_boobs )
self.female_hip = dictionary.get( "female_hip", self.female_hip )
self.male_pack = dictionary.get( "male_pack", self.male_pack )
self.male_throat = dictionary.get( "male_throat", self.male_throat )
self.female_pregnant = dictionary.get( "female_pregnant", self.female_pregnant )
self.color = dictionary.get( "color", self.color )
func from_file( filename ):
var file = File.new()
if file.file_exists( "user://creatures/" + filename ):
file.open( "user://creatures/" + filename, File.READ )
var lines = ""
while not file.eof_reached():
var current_line = file.get_line()
lines += current_line
var json = JSON.parse( lines ).result
var dict = {}
for data in json:
dict[ data ] = str2var( json[data] )
self.from_dictionary( dict )
file.close()

View file

@ -0,0 +1,29 @@
extends Spatial
export(bool) var gravity_enabled = true
var creature = null
func _process( delta ):
if self.gravity_enabled and $model:
for child in $model.get_children():
if child is KinematicBody:
child.move_and_slide( Vector3( 0.0, -9.81, 0.0 ), Vector3( 0.0, 1.0, 0.0 ), true )
func move( m_movment ):
if $model:
for child in $model.get_children():
if child is KinematicBody:
child.translate( m_movment )
# child.move_and_slide( m_movment, Vector3( 0.0, 1.0, 0.0 ) )
func turn( m_rotation ):
if $model:
for child in $model.get_children():
if child is KinematicBody:
child.rotate_x( m_rotation.x )
child.rotate_y( m_rotation.y )
child.rotate_z( m_rotation.z )

View file

@ -0,0 +1,30 @@
class nel_login_message:
var _cmd;
var _login;
var _password;
var _clientApplication;
var _cp;
var _lg;
func _init(cmd, login, password, clientApplication, cp, lg):
self._cmd = cmd;
self._login = login;
self._password = password;
self._clientApplication = clientApplication;
self._cp = cp;
self._lg = lg;
func get_request_string():
var request_string = "cmd=" + self._cmd;
if self._login != "":
request_string += "&login=" + self._login;
if self._password != "":
request_string += "&password=" + self._password;
if self._clientApplication != "":
request_string += "&clientApplication=" + self._clientApplication;
if self._cp != "":
request_string += "&cp=" + self._cp;
if self._lg != "":
request_string += "&lg=" + self._lg;
return request_string;

View file

@ -0,0 +1,19 @@
class nel_server_info:
var _cookie;
var _shardIp;
var _ringStartAdress;
var _ringAddress;
var _patchVersion
var _backupPatchUrls;
var _patchUrls;
func _init(connexionResultString):
var params = connexionResultString.split('#');
var temp = params[4].split('\n')
self._cookie = params[1];
self._shardIp = params[2];
self._ringStartAdress = params[3];
self._ringAddress = temp[0];
self._patchVersion = temp[1];
self._backupPatchUrls = params[5];
self._patchUrls = params[6];

View file

@ -0,0 +1,34 @@
extends Node
signal connection_ok
signal connection_error( message )
func do_request(username, password):
var message = load("res://ressources/scripts/nel/nel_login_message.gd")
if message:
message = message.nel_login_message.new("https-login", username, password, "Lirria", "2", "en");
# $http_request.request("http://lirria.khaganat.net/login/r2_login.php?" + message.get_request_string());
$http_request.request("http://149.91.80.160/login/r2_login.php?" + message.get_request_string());
func _make_post_request(url, data_to_send, use_ssl):
# Convert data to json string:
var query = JSON.print(data_to_send)
# Add 'Content-Type' header:
var headers = ["Content-Type: application/json"]
$http_request.request(url, headers, use_ssl, HTTPClient.METHOD_POST, query)
func _on_http_request_request_completed(result, response_code, headers, body):
print( response_code )
if ProjectSettings.get_setting("khanat/debug_mode"):
emit_signal( "connection_ok" )
elif not response_code == 200:
emit_signal( "connection_error", "Erreur de connexion." )
else:
var s = body.get_string_from_utf8().split(":")
if(s[0] != "0"):
var server_info_script = load("res://ressources/scripts/nel/nel_server_infos.gd");
var server_info = server_info_script.nel_server_info.new(body.get_string_from_utf8());
emit_signal( "connection_ok" )
# No error so login was successful.

View file

@ -0,0 +1,14 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://scenes/connection/connection.gd" type="Script" id=1]
[node name="connection" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="http_request" type="HTTPRequest" parent="."]
[connection signal="request_completed" from="http_request" to="." method="_on_http_request_request_completed"]

View file

@ -0,0 +1,77 @@
[gd_scene load_steps=8 format=2]
[ext_resource path="res://assets/creatures/ra/basemesh_humanoid.glb" type="PackedScene" id=1]
[ext_resource path="res://assets/creatures/ra/textures/basemesh_humanoid.png" type="Texture" id=2]
[ext_resource path="res://assets/creatures/ra/textures/Wood035_2K_Roughness.jpg" type="Texture" id=3]
[ext_resource path="res://assets/creatures/ra/textures/Wood035_2K_Normal.jpg" type="Texture" id=4]
[ext_resource path="res://assets/creatures/ra/tatoos/tatoo_001.png" type="Texture" id=5]
[sub_resource type="Shader" id=1]
code = "shader_type spatial;
render_mode blend_mix,depth_draw_opaque,cull_back,diffuse_burley,specular_schlick_ggx;
uniform vec4 albedo : hint_color;
uniform sampler2D texture_albedo : hint_albedo;
uniform float specular;
uniform float metallic;
uniform float roughness : hint_range(0,1);
uniform float point_size : hint_range(0,128);
uniform sampler2D texture_roughness : hint_white;
uniform vec4 roughness_texture_channel;
uniform sampler2D texture_normal : hint_normal;
uniform float normal_scale : hint_range(-16,16);
uniform vec3 uv1_scale;
uniform vec3 uv1_offset;
uniform vec3 uv2_scale;
uniform vec3 uv2_offset;
uniform sampler2D tatoo_albedo : hint_black;
void vertex() {
UV=UV*uv1_scale.xy+uv1_offset.xy;
}
void fragment() {
vec2 base_uv = UV;
vec4 albedo_tex = texture(texture_albedo,base_uv);
vec4 tatoo_tex = texture(tatoo_albedo,base_uv);
ALBEDO = albedo.rgb * albedo_tex.rgb;
METALLIC = metallic;
float roughness_tex = dot(texture(texture_roughness,base_uv),roughness_texture_channel);
ROUGHNESS = roughness_tex * roughness;
SPECULAR = specular;
NORMALMAP = texture(texture_normal,base_uv).rgb;
NORMALMAP_DEPTH = normal_scale;
if ( tatoo_tex.a > 0.2 )
{
ALBEDO += tatoo_tex.rgb;
}
}
"
[sub_resource type="ShaderMaterial" id=2]
shader = SubResource( 1 )
shader_param/albedo = Color( 1, 1, 1, 1 )
shader_param/specular = 0.0
shader_param/metallic = 0.0
shader_param/roughness = 1.0
shader_param/point_size = 1.0
shader_param/roughness_texture_channel = Plane( 1, 0, 0, 0 )
shader_param/normal_scale = 1.0
shader_param/uv1_scale = Vector3( 1, 1, 1 )
shader_param/uv1_offset = Vector3( 0, 0, 0 )
shader_param/uv2_scale = Vector3( 1, 1, 1 )
shader_param/uv2_offset = Vector3( 0, 0, 0 )
shader_param/texture_albedo = ExtResource( 2 )
shader_param/texture_roughness = ExtResource( 3 )
shader_param/texture_normal = ExtResource( 4 )
shader_param/tatoo_albedo = ExtResource( 5 )
[node name="basemesh_humanoid" instance=ExtResource( 1 )]
[node name="body" parent="." index="0"]
material/0 = SubResource( 2 )

View file

@ -0,0 +1,22 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://scenes/creatures/ra/basemesh_humanoid.tscn" type="PackedScene" id=1]
[sub_resource type="CapsuleShape" id=1]
margin = 0.1
radius = 0.404418
height = 0.827082
[node name="ra" type="KinematicBody"]
[node name="spring_arm" type="Spatial" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.73134, -1.7404 )
[node name="camera" type="Camera" parent="spring_arm"]
transform = Transform( -0.999408, 0.0139118, -0.0314544, 0.00553681, 0.967693, 0.252072, 0.033945, 0.251749, -0.967197, 0, -1.19209e-07, 1.19209e-07 )
[node name="model" parent="." instance=ExtResource( 1 )]
[node name="collision" type="CollisionShape" parent="."]
transform = Transform( 1, 0, 0, 0, -1.62921e-07, -1, 0, 1, -1.62921e-07, 0, 0.808348, 0 )
shape = SubResource( 1 )

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,69 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://assets/decors/terrains/heightmaps/test_heightmap.png" type="Texture" id=1]
[sub_resource type="PlaneMesh" id=1]
size = Vector2( 10, 10 )
subdivide_width = 10
subdivide_depth = 10
[sub_resource type="Shader" id=2]
code = "shader_type spatial;
render_mode blend_mix,depth_draw_opaque,cull_back,diffuse_burley,specular_schlick_ggx;
uniform vec4 albedo : hint_color;
uniform sampler2D texture_albedo : hint_albedo;
uniform float specular;
uniform float metallic;
uniform float roughness : hint_range(0,1);
uniform float point_size : hint_range(0,128);
uniform vec3 uv1_scale;
uniform vec3 uv1_offset;
uniform vec3 uv2_scale;
uniform vec3 uv2_offset;
uniform float max_height = 10.0;
uniform float min_height = 0.0;
uniform sampler2D texture_heightmap;
void vertex() {
UV=UV*uv1_scale.xy+uv1_offset.xy;
vec4 heightmap_tex = texture(texture_heightmap, UV);
VERTEX.y = min_height + (heightmap_tex.r * max_height);
}
void fragment() {
vec2 base_uv = UV;
vec4 albedo_tex = texture(texture_albedo,base_uv);
ALBEDO = albedo.rgb * albedo_tex.rgb;
METALLIC = metallic;
ROUGHNESS = roughness;
SPECULAR = specular;
}
"
[sub_resource type="ShaderMaterial" id=3]
shader = SubResource( 2 )
shader_param/albedo = Color( 1, 1, 1, 1 )
shader_param/specular = 0.5
shader_param/metallic = 0.0
shader_param/roughness = 1.0
shader_param/point_size = 1.0
shader_param/uv1_scale = Vector3( 1, 1, 1 )
shader_param/uv1_offset = Vector3( 0, 0, 0 )
shader_param/uv2_scale = Vector3( 1, 1, 1 )
shader_param/uv2_offset = Vector3( 0, 0, 0 )
shader_param/max_height = 10.0
shader_param/min_height = 0.0
shader_param/texture_heightmap = ExtResource( 1 )
[node name="spatial" type="Spatial"]
[node name="mesh_instance" type="MeshInstance" parent="."]
mesh = SubResource( 1 )
material/0 = SubResource( 3 )

View file

@ -0,0 +1,24 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://assets/decors/vegets/tree_001.glb" type="PackedScene" id=1]
[ext_resource path="res://assets/decors/vegets/leaf_001/plant_32.png" type="Texture" id=2]
[sub_resource type="SpatialMaterial" id=1]
albedo_color = Color( 0.529412, 0.333333, 0.188235, 1 )
[sub_resource type="SpatialMaterial" id=2]
params_cull_mode = 2
params_use_alpha_scissor = true
params_alpha_scissor_threshold = 0.98
albedo_color = Color( 0.921569, 1, 0.921569, 1 )
albedo_texture = ExtResource( 2 )
uv1_scale = Vector3( 5, 1, 1 )
uv1_offset = Vector3( 0.1, 0, 0 )
[node name="tree_001" instance=ExtResource( 1 )]
[node name="tree" parent="." index="0"]
material/0 = SubResource( 1 )
[node name="leaves" parent="tree" index="0"]
material/0 = SubResource( 2 )

57
scenes/game/game.gd Normal file
View file

@ -0,0 +1,57 @@
extends Spatial
var player_speed = 1.0
var player_rotation_speed = 0.1
var heightmap = null
#func _ready():
#
# self.heightmap = Image.new()
# self.heightmap.load( "res://assets/decors/terrains/dunes_heightmap.png" )
#
func _input( event ):
var movment = Vector3( 0.0, 0.0, 0.0 )
var rotation = Vector3( 0.0, 0.0, 0.0 )
if event.is_action( "move_forward" ):
movment.z += self.player_speed
elif event.is_action( "move_backward" ):
movment.z -= self.player_speed
elif event.is_action( "move_left" ):
movment.x += self.player_speed
elif event.is_action( "move_right" ):
movment.x -= self.player_speed
if event.is_action( "turn_left" ):
rotation.y += self.player_rotation_speed
elif event.is_action( "turn_right" ):
rotation.y -= self.player_rotation_speed
$creatures/player.turn( rotation )
$creatures/player.move( movment )
func _process( delta ):
pass
# if self.heightmap:
# self.heightmap.lock()
# print( $creatures/player.translation )
# print( $creatures/player/model.translation )
# print( $creatures/player/model/ra.translation )
# var pixel = self.heightmap.get_pixel( $creatures/player/model/ra.translation.x*2048.0, $creatures/player/model/ra.translation.z*2048.0 )
# var pixel = self.heightmap.get_pixel( 512, 512 )
# self.heightmap.unlock()
# print ( pixel )
# var movment = Vector3( 0.0, 0.0, 0.0 )
# $creatures/player/model/ra.translation.y = pixel.r*10.0
# movment.y = pixel.r - $creatures/player/model/ra.translation.y
#
# $creatures/player.move( movment )
# print( movment )
func load_player( filename ):
$creatures/player.load_creature( filename )

26
scenes/game/game.tscn Normal file
View file

@ -0,0 +1,26 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://scenes/player/player.tscn" type="PackedScene" id=1]
[ext_resource path="res://scenes/decors/terrains/dunes/dunes.tscn" type="PackedScene" id=2]
[ext_resource path="res://scenes/game/game.gd" type="Script" id=3]
[ext_resource path="res://scenes/decors/vegets/tree_001.tscn" type="PackedScene" id=4]
[node name="game" type="Spatial"]
script = ExtResource( 3 )
[node name="level" type="Spatial" parent="."]
[node name="dunes" parent="level" instance=ExtResource( 2 )]
transform = Transform( 10, 0, 0, 0, 10, 0, 0, 0, 10, 0, 0, 0 )
[node name="tree_001" parent="level" instance=ExtResource( 4 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -11.2768, 8, 13.9512 )
[node name="creatures" type="Spatial" parent="."]
[node name="player" parent="creatures" instance=ExtResource( 1 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 14.7098, 0 )
[node name="directional_light" type="DirectionalLight" parent="."]
transform = Transform( 0.556412, 0.175846, -0.812086, 0.830907, -0.117754, 0.543809, 0, -0.977349, -0.211632, -12.4893, 10.8693, -9.53674e-07 )
shadow_enabled = true

View file

@ -0,0 +1,116 @@
extends Control
signal name_changed( value )
signal boobs_changed( value )
signal hip_changed( value )
signal male_scrotch( value )
signal male_throat( value )
signal pregnant( value )
signal valid_pressed
signal cancel_pressed
var Creatures = preload( "res://ressources/scripts/creatures.gd" )
var mouse_old_position = null
var mouse_delta = null
var camera_zoom = 0.0
var camera_zoom_speed = 0.1
var ra = Creatures.Ra.new()
var slot = null
func _ready():
$viewport/spring_arm/camera.make_current()
func _input( event ):
if event is InputEventMouseButton:
if event.is_action_pressed( "creatures_editor_rotate_view_y" ):
self.mouse_old_position = event.position
elif event.is_action_released( "creatures_editor_rotate_view_y" ):
self.mouse_old_position = null
self.mouse_delta = null
if event.is_action( "creatures_editor_zoom_in" ):
self.camera_zoom += self.camera_zoom_speed
elif event.is_action( "creatures_editor_zoom_out" ):
self.camera_zoom -= self.camera_zoom_speed
if event is InputEventMouseMotion:
if not mouse_old_position == null:
self.mouse_delta = mouse_old_position - event.position
self.mouse_old_position = event.position
func _process( delta ):
if self.mouse_delta:
$viewport/model/ra.rotate( Vector3( 0.0, 1.0, 0.0 ), deg2rad( -self.mouse_delta.x ) )
self.mouse_delta = Vector2( 0.0, 0.0 )
if self.camera_zoom:
$viewport/spring_arm/camera.size += self.camera_zoom
self.camera_zoom = 0.0
func set_creature( p_creature ):
if p_creature is Creatures.Ra:
self.ra = p_creature
$screen_box/tools_box/boobs/value.value = p_creature.female_boobs
$screen_box/tools_box/hip/value.value = p_creature.female_hip
$screen_box/tools_box/male_scrotch/value.value = p_creature.male_pack
$screen_box/tools_box/male_throat/value.value = p_creature.male_throat
$screen_box/tools_box/pregnant/value.value = p_creature.female_pregnant
$screen_box/tools_box/color/value.value = p_creature.color
func _on_name_text_changed( new_text ):
self.ra.pseudonym = new_text
func _on_boobs_value_changed( value ):
$viewport/model/ra/model/body.set( "blend_shapes/Boobs", value )
self.ra.female_boobs = value
func _on_hip_value_changed(value):
$viewport/model/ra/model/body.set( "blend_shapes/Female_hip", value )
self.ra.female_hip = value
func _on_male_scrotch_value_changed(value):
$viewport/model/ra/model/body.set( "blend_shapes/Male_Pack", value )
self.ra.male_pack = value
func _on_male_throat_value_changed(value):
$viewport/model/ra/model/body.set( "blend_shapes/Male_Throat", value )
self.ra.male_throat = value
func _on_pregnant_value_changed(value):
$viewport/model/ra/model/body.set( "blend_shapes/Pregnant", value )
self.ra.female_pregnant = value
func _on_valid_pressed():
if not self.slot == null:
var directory = Directory.new()
if not directory.dir_exists( "user://creatures/" ):
directory.make_dir_recursive( "user://creatures/" )
var creature_file = File.new()
creature_file.open("user://creatures/slot_"+str(self.slot)+".creature", File.WRITE)
creature_file.store_line(to_json(self.ra.to_dictionary()))
creature_file.close()
emit_signal( "valid_pressed" )
func _on_cancel_pressed():
emit_signal( "cancel_pressed" )
func _on_color_changed(color):
$viewport/model/ra/model/body.get_surface_material( 0 ).set_shader_param( "albedo", color )
self.ra.color = color

View file

@ -0,0 +1,253 @@
[gd_scene load_steps=9 format=2]
[ext_resource path="res://assets/interfaces/themes/login_theme.theme" type="Theme" id=1]
[ext_resource path="res://assets/interfaces/settings-Khanat-background.png" type="Texture" id=2]
[ext_resource path="res://scenes/interfaces/creatures_editor/creatures_editor_ui.gd" type="Script" id=3]
[ext_resource path="res://addons/kh_slider/kh_h_slider.gd" type="Script" id=4]
[ext_resource path="res://assets/interfaces/slider_plus.png" type="Texture" id=5]
[ext_resource path="res://assets/interfaces/slider_minus.png" type="Texture" id=6]
[ext_resource path="res://scenes/creatures/ra/ra.tscn" type="PackedScene" id=7]
[sub_resource type="ViewportTexture" id=1]
viewport_path = NodePath("viewport")
[node name="creatures_editor_ui" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
theme = ExtResource( 1 )
script = ExtResource( 3 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="background" type="TextureRect" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
texture = ExtResource( 2 )
expand = true
__meta__ = {
"_edit_use_anchors_": false
}
[node name="screen_box" type="MarginContainer" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
margin_top = -0.773773
margin_bottom = -0.773804
custom_constants/margin_left = 220
__meta__ = {
"_edit_use_anchors_": false
}
[node name="tools_box" type="VBoxContainer" parent="screen_box"]
margin_left = 220.0
margin_top = 243.0
margin_right = 465.0
margin_bottom = 476.0
size_flags_horizontal = 2
size_flags_vertical = 6
[node name="name" type="HBoxContainer" parent="screen_box/tools_box"]
margin_right = 245.0
margin_bottom = 33.0
[node name="label" type="Label" parent="screen_box/tools_box/name"]
margin_top = 8.0
margin_right = 113.0
margin_bottom = 25.0
size_flags_horizontal = 11
text = "Pseudonyme"
align = 2
[node name="value" type="LineEdit" parent="screen_box/tools_box/name"]
margin_left = 117.0
margin_right = 245.0
margin_bottom = 33.0
rect_min_size = Vector2( 128, 0 )
size_flags_horizontal = 3
[node name="color" type="HBoxContainer" parent="screen_box/tools_box"]
margin_top = 37.0
margin_right = 245.0
margin_bottom = 54.0
[node name="label" type="Label" parent="screen_box/tools_box/color"]
margin_right = 113.0
margin_bottom = 17.0
size_flags_horizontal = 11
text = "Couleur"
align = 2
[node name="value" type="ColorPickerButton" parent="screen_box/tools_box/color"]
margin_left = 117.0
margin_right = 245.0
margin_bottom = 17.0
rect_min_size = Vector2( 128, 0 )
color = Color( 1, 1, 1, 1 )
[node name="boobs" type="HBoxContainer" parent="screen_box/tools_box"]
margin_top = 58.0
margin_right = 245.0
margin_bottom = 75.0
[node name="label" type="Label" parent="screen_box/tools_box/boobs"]
margin_right = 113.0
margin_bottom = 17.0
size_flags_horizontal = 11
text = "Poitrine"
align = 2
valign = 1
[node name="value" type="HBoxContainer" parent="screen_box/tools_box/boobs"]
margin_left = 117.0
margin_right = 245.0
margin_bottom = 16.0
rect_min_size = Vector2( 128, 0 )
size_flags_horizontal = 3
size_flags_vertical = 2
script = ExtResource( 4 )
minus_texture = ExtResource( 6 )
plus_texture = ExtResource( 5 )
[node name="hip" type="HBoxContainer" parent="screen_box/tools_box"]
margin_top = 79.0
margin_right = 245.0
margin_bottom = 96.0
[node name="label" type="Label" parent="screen_box/tools_box/hip"]
margin_right = 113.0
margin_bottom = 17.0
size_flags_horizontal = 11
text = "Hanches"
align = 2
valign = 1
[node name="value" type="HBoxContainer" parent="screen_box/tools_box/hip"]
margin_left = 117.0
margin_right = 245.0
margin_bottom = 16.0
rect_min_size = Vector2( 128, 0 )
size_flags_horizontal = 3
size_flags_vertical = 2
script = ExtResource( 4 )
minus_texture = ExtResource( 6 )
plus_texture = ExtResource( 5 )
[node name="male_scrotch" type="HBoxContainer" parent="screen_box/tools_box"]
margin_top = 100.0
margin_right = 245.0
margin_bottom = 117.0
[node name="label" type="Label" parent="screen_box/tools_box/male_scrotch"]
margin_right = 113.0
margin_bottom = 17.0
size_flags_horizontal = 11
text = "Entrejambe"
align = 2
valign = 1
[node name="value" type="HBoxContainer" parent="screen_box/tools_box/male_scrotch"]
margin_left = 117.0
margin_right = 245.0
margin_bottom = 16.0
rect_min_size = Vector2( 128, 0 )
size_flags_horizontal = 3
size_flags_vertical = 2
script = ExtResource( 4 )
minus_texture = ExtResource( 6 )
plus_texture = ExtResource( 5 )
[node name="male_throat" type="HBoxContainer" parent="screen_box/tools_box"]
margin_top = 121.0
margin_right = 245.0
margin_bottom = 138.0
[node name="label" type="Label" parent="screen_box/tools_box/male_throat"]
margin_right = 113.0
margin_bottom = 17.0
size_flags_horizontal = 11
text = "Pomme d'Adam"
align = 2
valign = 1
[node name="value" type="HBoxContainer" parent="screen_box/tools_box/male_throat"]
margin_left = 117.0
margin_right = 245.0
margin_bottom = 16.0
rect_min_size = Vector2( 128, 0 )
size_flags_horizontal = 3
size_flags_vertical = 2
script = ExtResource( 4 )
minus_texture = ExtResource( 6 )
plus_texture = ExtResource( 5 )
[node name="pregnant" type="HBoxContainer" parent="screen_box/tools_box"]
margin_top = 142.0
margin_right = 245.0
margin_bottom = 159.0
[node name="label" type="Label" parent="screen_box/tools_box/pregnant"]
margin_right = 113.0
margin_bottom = 17.0
size_flags_horizontal = 11
text = "Grossesse"
align = 2
valign = 1
[node name="value" type="HBoxContainer" parent="screen_box/tools_box/pregnant"]
margin_left = 117.0
margin_right = 245.0
margin_bottom = 16.0
rect_min_size = Vector2( 128, 0 )
size_flags_horizontal = 3
size_flags_vertical = 2
script = ExtResource( 4 )
minus_texture = ExtResource( 6 )
plus_texture = ExtResource( 5 )
[node name="valid" type="Button" parent="screen_box/tools_box"]
margin_top = 163.0
margin_right = 245.0
margin_bottom = 196.0
text = "Valider"
[node name="cancel" type="Button" parent="screen_box/tools_box"]
margin_top = 200.0
margin_right = 245.0
margin_bottom = 233.0
text = "Retour"
[node name="preview" type="TextureRect" parent="."]
margin_right = 40.0
margin_bottom = 40.0
mouse_filter = 2
texture = SubResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="viewport" type="Viewport" parent="."]
size = Vector2( 1280, 720 )
transparent_bg = true
render_target_v_flip = true
[node name="spring_arm" type="Spatial" parent="viewport"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.878, 2.235 )
[node name="camera" type="Camera" parent="viewport/spring_arm"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.46, 0, 0.374 )
projection = 1
size = 2.0
[node name="model" type="Spatial" parent="viewport"]
[node name="ra" parent="viewport/model" instance=ExtResource( 7 )]
[connection signal="text_changed" from="screen_box/tools_box/name/value" to="." method="_on_name_text_changed"]
[connection signal="color_changed" from="screen_box/tools_box/color/value" to="." method="_on_color_changed"]
[connection signal="value_changed" from="screen_box/tools_box/boobs/value" to="." method="_on_boobs_value_changed"]
[connection signal="value_changed" from="screen_box/tools_box/hip/value" to="." method="_on_hip_value_changed"]
[connection signal="value_changed" from="screen_box/tools_box/male_scrotch/value" to="." method="_on_male_scrotch_value_changed"]
[connection signal="value_changed" from="screen_box/tools_box/male_throat/value" to="." method="_on_male_throat_value_changed"]
[connection signal="value_changed" from="screen_box/tools_box/pregnant/value" to="." method="_on_pregnant_value_changed"]
[connection signal="pressed" from="screen_box/tools_box/valid" to="." method="_on_valid_pressed"]
[connection signal="pressed" from="screen_box/tools_box/cancel" to="." method="_on_cancel_pressed"]

View file

@ -0,0 +1,14 @@
extends HBoxContainer
signal select_pressed( slot )
signal delete_pressed( slot )
var slot = null
var creature_filename = null
func _on_select_pressed():
emit_signal( "select_pressed", self.slot )
func _on_delete_pressed():
emit_signal( "delete_pressed", self.slot )

View file

@ -0,0 +1,40 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://scenes/interfaces/creatures_menu/creature_box.gd" type="Script" id=1]
[node name="creature_box" type="HBoxContainer"]
anchor_right = 1.0
anchor_bottom = 1.0
size_flags_horizontal = 7
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="label" type="Label" parent="."]
margin_left = 547.0
margin_top = 353.0
margin_right = 608.0
margin_bottom = 367.0
size_flags_horizontal = 10
text = "Anonyme"
[node name="select" type="Button" parent="."]
margin_left = 612.0
margin_top = 350.0
margin_right = 668.0
margin_bottom = 370.0
size_flags_horizontal = 0
size_flags_vertical = 6
text = "Choisir"
[node name="delete" type="Button" parent="."]
margin_left = 672.0
margin_top = 350.0
margin_right = 726.0
margin_bottom = 370.0
size_flags_horizontal = 2
size_flags_vertical = 6
text = "Effacer"
[connection signal="pressed" from="select" to="." method="_on_select_pressed"]
[connection signal="pressed" from="delete" to="." method="_on_delete_pressed"]

View file

@ -0,0 +1,54 @@
extends Control
signal new_pressed( slot )
signal cancel_pressed
signal select_pressed( creature_filename )
var slots_number = 0
var slots = {}
func _ready():
var files = []
var directory = Directory.new()
if directory.dir_exists( "user://creatures/" ):
directory.open( "user://creatures/" )
directory.list_dir_begin()
while true:
var file = directory.get_next()
if file == "":
break
elif not file.begins_with( "." ) and not directory.current_is_dir():
files.append( file )
directory.list_dir_end()
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.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.new()
creature.from_file( file )
creature_box.get_node( "label" ).text = creature.pseudonym
func _on_new_pressed():
emit_signal( "new_pressed", self.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 )
func _on_creature_box_delete_pressed( slot ):
if self.slots[ slot ].creature_filename:
var dir = Directory.new()
dir.remove( "user://creatures/" + self.slots[ slot ].creature_filename )
self.slots[ slot ].queue_free()

View file

@ -0,0 +1,66 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://scenes/interfaces/creatures_menu/creatures_menu_ui.gd" type="Script" id=1]
[ext_resource path="res://assets/interfaces/settings-Khanat-background.png" type="Texture" id=2]
[ext_resource path="res://assets/interfaces/themes/login_theme.theme" type="Theme" id=3]
[node name="creatures_menu_ui" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
theme = ExtResource( 3 )
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="background" type="TextureRect" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
texture = ExtResource( 2 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="screen_box" type="CenterContainer" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="scroll_container" type="ScrollContainer" parent="screen_box"]
margin_left = 340.0
margin_top = 159.0
margin_right = 940.0
margin_bottom = 559.0
rect_min_size = Vector2( 600, 400 )
[node name="v_box_container" type="VBoxContainer" parent="screen_box/scroll_container"]
margin_right = 600.0
margin_bottom = 400.0
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="creatures_box" type="VBoxContainer" parent="screen_box/scroll_container/v_box_container"]
margin_right = 600.0
margin_bottom = 326.0
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="new" type="Button" parent="screen_box/scroll_container/v_box_container"]
margin_left = 196.0
margin_top = 330.0
margin_right = 404.0
margin_bottom = 363.0
size_flags_horizontal = 4
text = "Créer une nouvel créature."
[node name="cancel" type="Button" parent="screen_box/scroll_container/v_box_container"]
margin_left = 268.0
margin_top = 367.0
margin_right = 332.0
margin_bottom = 400.0
size_flags_horizontal = 4
text = "Retour"
[connection signal="pressed" from="screen_box/scroll_container/v_box_container/new" to="." method="_on_new_pressed"]
[connection signal="pressed" from="screen_box/scroll_container/v_box_container/cancel" to="." method="_on_cancel_pressed"]

View file

@ -0,0 +1,15 @@
extends Control
signal play_pressed
signal quit_pressed
func close():
self.hide()
func _on_play_pressed():
emit_signal( "play_pressed" )
func _on_quitter_pressed():
emit_signal( "quit_pressed" )

View file

@ -0,0 +1,79 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://assets/interfaces/Login-Khanat-background.png" type="Texture" id=1]
[ext_resource path="res://assets/interfaces/themes/login_theme.theme" type="Theme" id=2]
[ext_resource path="res://scenes/interfaces/main_menu/main_menu.gd" type="Script" id=3]
[node name="main_menu" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
mouse_filter = 2
theme = ExtResource( 2 )
script = ExtResource( 3 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="background" type="TextureRect" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
texture = ExtResource( 1 )
expand = true
__meta__ = {
"_edit_use_anchors_": false
}
[node name="screen_box" type="MarginContainer" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
custom_constants/margin_left = 280
__meta__ = {
"_edit_use_anchors_": false
}
[node name="login_box" type="VBoxContainer" parent="screen_box"]
margin_left = 652.0
margin_top = 277.0
margin_right = 908.0
margin_bottom = 442.0
size_flags_horizontal = 6
size_flags_vertical = 6
[node name="error" type="Label" parent="screen_box/login_box"]
margin_right = 256.0
margin_bottom = 17.0
custom_colors/font_color = Color( 1, 0.0470588, 0, 1 )
align = 1
valign = 1
autowrap = true
[node name="play" type="Button" parent="screen_box/login_box"]
margin_top = 21.0
margin_right = 256.0
margin_bottom = 54.0
text = "Jouer"
[node name="username" type="LineEdit" parent="screen_box/login_box"]
margin_top = 58.0
margin_right = 256.0
margin_bottom = 91.0
rect_min_size = Vector2( 256, 0 )
align = 1
placeholder_text = "Username"
[node name="password" type="LineEdit" parent="screen_box/login_box"]
margin_top = 95.0
margin_right = 256.0
margin_bottom = 128.0
rect_min_size = Vector2( 256, 0 )
align = 1
secret = true
placeholder_text = "Password"
[node name="quitter" type="Button" parent="screen_box/login_box"]
margin_top = 132.0
margin_right = 256.0
margin_bottom = 165.0
text = "Quitter"
[connection signal="pressed" from="screen_box/login_box/play" to="." method="_on_play_pressed"]
[connection signal="pressed" from="screen_box/login_box/quitter" to="." method="_on_quitter_pressed"]

View file

@ -0,0 +1,8 @@
extends Button
signal music_selected( filename )
var music_filename = ""
func _on_music_button_pressed():
emit_signal( "music_selected", self.music_filename )

View file

@ -0,0 +1,12 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://scenes/interfaces/music_manager/music_button.gd" type="Script" id=1]
[node name="music_button" type="Button"]
margin_right = 12.0
margin_bottom = 20.0
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="pressed" from="." to="." method="_on_music_button_pressed"]

View file

@ -0,0 +1,41 @@
extends WindowDialog
func _ready():
var directory = Directory.new()
if not directory.dir_exists( "user://musics/" ):
directory.make_dir_recursive( "user://musics/" )
directory.open( "user://musics/" )
directory.list_dir_begin()
var files = []
while true:
var file = directory.get_next()
if file == "":
break
elif not file.begins_with(".") and not directory.current_is_dir() and not file.ends_with( ".import" ):
files.append(file)
directory.list_dir_end()
for file in files:
var button = preload( "res://scenes/interfaces/music_manager/music_button.tscn" ).instance()
button.music_filename = file
button.text = file
button.connect( "music_selected", self, "_on_music_pressed" )
$window_box/scroll_box/musics_box.add_child( button )
func open():
self.popup()
func close():
self.hide()
func toggle():
if self.visible:
self.close()
else:
self.open()
func _on_music_pressed( p_filename ):
$music.stream = load( "res://assets/musics/" + p_filename )
$music.play()

View file

@ -0,0 +1,76 @@
[gd_scene load_steps=6 format=2]
[ext_resource path="res://assets/interfaces/music_manager/play.png" type="Texture" id=1]
[ext_resource path="res://assets/interfaces/music_manager/previous.png" type="Texture" id=2]
[ext_resource path="res://assets/interfaces/music_manager/next.png" type="Texture" id=3]
[ext_resource path="res://assets/interfaces/music_manager/pause.png" type="Texture" id=4]
[ext_resource path="res://scenes/interfaces/music_manager/music_manager.gd" type="Script" id=5]
[node name="music_manager" type="WindowDialog"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -64.0
margin_top = -64.0
margin_right = 64.0
margin_bottom = 64.0
rect_min_size = Vector2( 256, 128 )
popup_exclusive = true
window_title = "Juke box"
resizable = true
script = ExtResource( 5 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="window_box" type="VBoxContainer" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="controls_box" type="HBoxContainer" parent="window_box"]
margin_left = 26.0
margin_right = 102.0
margin_bottom = 16.0
size_flags_horizontal = 6
[node name="previous" type="TextureButton" parent="window_box/controls_box"]
margin_right = 16.0
margin_bottom = 16.0
texture_normal = ExtResource( 2 )
[node name="pause" type="TextureButton" parent="window_box/controls_box"]
margin_left = 20.0
margin_right = 36.0
margin_bottom = 16.0
texture_normal = ExtResource( 4 )
[node name="play" type="TextureButton" parent="window_box/controls_box"]
margin_left = 40.0
margin_right = 56.0
margin_bottom = 16.0
texture_normal = ExtResource( 1 )
[node name="next" type="TextureButton" parent="window_box/controls_box"]
margin_left = 60.0
margin_right = 76.0
margin_bottom = 16.0
texture_normal = ExtResource( 3 )
[node name="scroll_box" type="ScrollContainer" parent="window_box"]
margin_top = 20.0
margin_right = 128.0
margin_bottom = 128.0
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="musics_box" type="VBoxContainer" parent="window_box/scroll_box"]
margin_left = 64.0
margin_right = 64.0
size_flags_horizontal = 6
size_flags_vertical = 2
[node name="music" type="AudioStreamPlayer" parent="."]

126
scenes/main/main.gd Normal file
View file

@ -0,0 +1,126 @@
extends Spatial
var loader
var wait_frames
var time_max = 100 # msec
var current_scene = null
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" )
func _process(_time):
if loader == null:
# no need to process anymore
set_process(false)
return
if wait_frames > 0: # wait for frames to let the "loading" animation show up
wait_frames -= 1
return
var t = OS.get_ticks_msec()
while OS.get_ticks_msec() < t + time_max: # use "time_max" to control for how long we block this thread
# poll your loader
var err = loader.poll()
if err == ERR_FILE_EOF: # Finished loading.
var resource = loader.get_resource()
loader = null
set_new_scene(resource)
break
elif err == OK:
update_progress()
else: # error during loading
# show_error()
printerr( "Loading errors." )
loader = null
break
func _input( event ):
if event.is_action_released( "music_manager" ):
MusicManager.toggle()
func load_scene( path ):
self.loader = ResourceLoader.load_interactive( path )
if self.loader == null:
# show_error()
printerr( "Loading errors." )
return
set_process(true)
if self.current_scene:
self.current_scene.queue_free() # get rid of the old scene
# start your "loading..." animation
# get_node("animation").play("loading")
$loading_screen.show()
self.wait_frames = 1
func set_new_scene( scene_resource ):
self.current_scene = scene_resource.instance()
self.get_node("scene").add_child(current_scene)
$loading_screen.hide()
$main_menu.hide()
if self.has_node( "scene/creatures_menu_ui" ):
self.get_node( "scene/creatures_menu_ui" ).connect( "new_pressed", self, "_on_creatures_menu_ui_new_pressed" )
self.get_node( "scene/creatures_menu_ui" ).connect( "cancel_pressed", self, "_on_creatures_menu_ui_cancel_pressed" )
self.get_node( "scene/creatures_menu_ui" ).connect( "select_pressed", self, "_on_creatures_menu_ui_select_pressed" )
elif self.has_node( "scene/creatures_editor_ui" ):
self.get_node( "scene/creatures_editor_ui" ).connect( "valid_pressed", self, "_on_creature_editor_ui_valid_pressed" )
self.get_node( "scene/creatures_editor_ui" ).connect( "cancel_pressed", self, "_on_creature_editor_ui_cencel_pressed" )
print( "slot: " + str( self.creature_selected_slot ) )
self.get_node( "scene/creatures_editor_ui" ).slot = self.creature_selected_slot
elif self.has_node( "scene/game" ):
self.get_node( "scene/game" ).load_player( self.creature_selected_filename )
func update_progress():
var progress = float(self.loader.get_stage()) / self.loader.get_stage_count()
self.get_node("loading_screen").set_value( progress )
func _on_main_menu_play_pressed():
var username = $main_menu/screen_box/login_box/username.text;
var password = $main_menu/screen_box/login_box/password.text;
if username != null and username != "" and password != null and password != "":
Connection.do_request(username, password)
func _on_creatures_menu_ui_new_pressed( slot ):
self.creature_selected_slot = slot
self.load_scene( "res://scenes/interfaces/creatures_editor/creatures_editor_ui.tscn" )
func _on_creatures_menu_ui_cancel_pressed():
$main_menu.show()
func _on_creatures_menu_ui_select_pressed( filename ):
self.creature_selected_filename = filename
self.load_scene( "res://scenes/game/game.tscn" )
func _on_creature_editor_ui_valid_pressed():
self.load_scene( "res://scenes/interfaces/creatures_menu/creatures_menu_ui.tscn" )
func _on_creature_editor_ui_cencel_pressed():
self.load_scene( "res://scenes/interfaces/creatures_menu/creatures_menu_ui.tscn" )
func _on_main_menu_quit_pressed():
get_tree().quit()
func _on_connexion_ok():
self.load_scene( "res://scenes/interfaces/creatures_menu/creatures_menu_ui.tscn" )
func _on_connection_error( message ):
$main_menu/screen_box/login_box/error.text = message

26
scenes/main/main.tscn Normal file
View file

@ -0,0 +1,26 @@
[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://assets/interfaces/new_launcher_bg_0-1.png" type="Texture" id=2]
[ext_resource path="res://scenes/main/main.gd" type="Script" id=3]
[ext_resource path="res://assets/interfaces/Login-Khanat-background-loading.png" type="Texture" id=4]
[node name="main" type="Spatial"]
script = ExtResource( 3 )
[node name="scene" type="Spatial" parent="."]
[node name="main_menu" parent="." instance=ExtResource( 1 )]
[node name="loading_screen" type="TextureProgress" parent="."]
visible = false
margin_right = 1280.0
margin_bottom = 720.0
texture_under = ExtResource( 2 )
texture_progress = ExtResource( 4 )
nine_patch_stretch = true
__meta__ = {
"_edit_use_anchors_": false
}
[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"]

26
scenes/player/player.gd Normal file
View file

@ -0,0 +1,26 @@
extends "res://ressources/scripts/entity.gd"
func _ready():
$model/ra/spring_arm/camera.make_current()
func load_creature( filename ):
var file = File.new()
if file.file_exists( "user://creatures/" + filename ):
file.open( "user://creatures/" + filename, File.READ )
var lines = ""
while not file.eof_reached():
var current_line = file.get_line()
lines += current_line
var json = JSON.parse( lines ).result
$model/ra/model/body.set( "blend_shapes/Boobs", str2var(json[ "female_boobs" ] ) )
$model/ra/model/body.set( "blend_shapes/Female_hip", str2var(json[ "female_hip" ] ) )
$model/ra/model/body.set( "blend_shapes/Male_Pack", str2var(json[ "male_pack" ] ) )
$model/ra/model/body.set( "blend_shapes/Male_Throat", str2var(json[ "male_throat" ] ) )
$model/ra/model/body.set( "blend_shapes/Pregnant", str2var(json[ "female_pregnant" ] ) )
$model/ra/model/body.set( "blend_shapes/Pregnant", str2var(json[ "female_pregnant" ] ) )
$model/ra/model/body.get_surface_material( 0 ).set_shader_param( "albedo", str2var( json[ "color" ] ) )
print( str2var( json[ "color" ] ) )
file.close()

11
scenes/player/player.tscn Normal file
View file

@ -0,0 +1,11 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://scenes/player/player.gd" type="Script" id=1]
[ext_resource path="res://scenes/creatures/ra/ra.tscn" type="PackedScene" id=2]
[node name="player" type="Spatial"]
script = ExtResource( 1 )
[node name="model" type="Spatial" parent="."]
[node name="ra" parent="model" instance=ExtResource( 2 )]