mirror of
https://port.numenaute.org/aleajactaest/khanat-client.git
synced 2024-12-19 07:58:43 +00:00
85 lines
2.5 KiB
GDScript
85 lines
2.5 KiB
GDScript
extends Node
|
|
|
|
class Creature_old:
|
|
|
|
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_old extends Creature_old:
|
|
|
|
|
|
var sex = Creature_old.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 )
|
|
|
|
var douleur = 0.0
|
|
var trauma = 0.0
|
|
var oubli = 0.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()
|
|
|