Refactor code structure for improved readability and maintainability
This commit is contained in:
+22
-22
@@ -41,28 +41,28 @@ HG|hypergiant|ui/2-stars/|2|2|4|
|
|||||||
WD|white_dwarf|ui/2-stars/|2|3|0|
|
WD|white_dwarf|ui/2-stars/|2|3|0|
|
||||||
NS|neutron_star|ui/2-stars/|2|3|1|
|
NS|neutron_star|ui/2-stars/|2|3|1|
|
||||||
MGT|magnetar|ui/2-stars/|2|3|2|
|
MGT|magnetar|ui/2-stars/|2|3|2|
|
||||||
BH|blackhole|ui/2-stars/|2|3|3|
|
BH|black_hole|ui/2-stars/|2|3|3|
|
||||||
SMBH|supermassive_blackhole|ui/2-stars/|2|3|4|
|
SMBH|supermassive_black_hole|ui/2-stars/|2|3|4|
|
||||||
SCD|starclusterscattered|ui/3-structures/|3|0|0|
|
SCD|star_cluster_scattered|ui/3-structures/|3|0|0|
|
||||||
SCS|starclustersmall|ui/3-structures/|3|0|1|
|
SCS|star_cluster_small|ui/3-structures/|3|0|1|
|
||||||
SCM|starclustermedium|ui/3-structures/|3|0|2|
|
SCM|star_cluster_medium|ui/3-structures/|3|0|2|
|
||||||
SCL|starclusterlarge|ui/3-structures/|3|0|3|
|
SCL|star_cluster_large|ui/3-structures/|3|0|3|
|
||||||
SCG|starclustergiant|ui/3-structures/|3|0|4|
|
SCG|star_cluster_giant|ui/3-structures/|3|0|4|
|
||||||
GED|galaxyellipticaldwarf|ui/3-structures/|3|1|0|
|
GED|galaxy_elliptical_dwarf|ui/3-structures/|3|1|0|
|
||||||
GES|galaxyellipticalsmall|ui/3-structures/|3|1|1|
|
GES|galaxy_elliptical_small|ui/3-structures/|3|1|1|
|
||||||
GEM|galaxyellipticalmedium|ui/3-structures/|3|1|2|
|
GEM|galaxy_elliptical_medium|ui/3-structures/|3|1|2|
|
||||||
GEL|galaxyellipticallarge|ui/3-structures/|3|1|3|
|
GEL|galaxy_elliptical_large|ui/3-structures/|3|1|3|
|
||||||
GEG|galaxyellipticalgiant|ui/3-structures/|3|1|4|
|
GEG|galaxy_elliptical_giant|ui/3-structures/|3|1|4|
|
||||||
GSD|galaxyspiraldwarf|ui/3-structures/|3|2|0|
|
GSD|galaxy_spiral_dwarf|ui/3-structures/|3|2|0|
|
||||||
GSS|galaxyspiralsmall|ui/3-structures/|3|2|1|
|
GSS|galaxy_spiral_small|ui/3-structures/|3|2|1|
|
||||||
GSM|galaxyspiralmedium|ui/3-structures/|3|2|2|
|
GSM|galaxy_spiral_medium|ui/3-structures/|3|2|2|
|
||||||
GSL|galaxyspirallarge|ui/3-structures/|3|2|3|
|
GSL|galaxy_spiral_large|ui/3-structures/|3|2|3|
|
||||||
GSG|galaxyspiralgiant|ui/3-structures/|3|2|4|
|
GSG|galaxy_spiral_giant|ui/3-structures/|3|2|4|
|
||||||
LGG|galacticgroup|ui/3-structures/|3|3|0|
|
LGG|galactic_group|ui/3-structures/|3|3|0|
|
||||||
LSC|galacticsupercluster|ui/3-structures/|3|3|1|
|
LSC|galactic_super_cluster|ui/3-structures/|3|3|1|
|
||||||
LGF|galacticfilament|ui/3-structures/|3|3|2|
|
LGF|galactic_filament|ui/3-structures/|3|3|2|
|
||||||
LGW|galacticwall|ui/3-structures/|3|3|3|
|
LGW|galactic_wall|ui/3-structures/|3|3|3|
|
||||||
LUB|universebubble|ui/3-structures/|3|3|4|
|
LUB|universe_bubble|ui/3-structures/|3|3|4|
|
||||||
GG|gas_giant|ui/4-life/|4|0|0|
|
GG|gas_giant|ui/4-life/|4|0|0|
|
||||||
AB|asteroid_belt|ui/4-life/|4|0|1|
|
AB|asteroid_belt|ui/4-life/|4|0|1|
|
||||||
RP|rocky_planet|ui/4-life/|4|0|2|
|
RP|rocky_planet|ui/4-life/|4|0|2|
|
||||||
|
|||||||
+5
-5
@@ -4,8 +4,8 @@ class_name Owniverse
|
|||||||
signal unlock_item(item_id: String)
|
signal unlock_item(item_id: String)
|
||||||
|
|
||||||
var current_year: float = 0
|
var current_year: float = 0
|
||||||
var current_speed: int = 1
|
var current_speed: float = 1
|
||||||
var current_speed_in_years:int = 1
|
var current_speed_in_years:float = 1
|
||||||
|
|
||||||
var entities: Dictionary[String, OwniverseEntity] = {}
|
var entities: Dictionary[String, OwniverseEntity] = {}
|
||||||
var entity_groups: Dictionary[String, Array] = {}
|
var entity_groups: Dictionary[String, Array] = {}
|
||||||
@@ -86,8 +86,8 @@ func produce(item_id: String, amount: float) -> void:
|
|||||||
|
|
||||||
func automated_production(_delta: float) -> void:
|
func automated_production(_delta: float) -> void:
|
||||||
for entity_id in auto_production:
|
for entity_id in auto_production:
|
||||||
var entity = entities[entity_id]
|
var _entity = entities[entity_id]
|
||||||
var amount_to_produce = int(entity.amount * entity.product_per_year_amount * _delta)
|
var _amount_to_produce = int(_entity.amount * _entity.product_per_year_amount * _delta)
|
||||||
|
|
||||||
|
|
||||||
func get_available_to_produce(item_id: String) -> float:
|
func get_available_to_produce(item_id: String) -> float:
|
||||||
@@ -140,7 +140,7 @@ func add_time_delta(delta) -> float:
|
|||||||
return current_year
|
return current_year
|
||||||
|
|
||||||
|
|
||||||
func change_speed(delta: int) -> int:
|
func change_speed(delta: int) -> float:
|
||||||
current_speed = clamp(current_speed + delta, 1, Global.SPEED_LIMIT)
|
current_speed = clamp(current_speed + delta, 1, Global.SPEED_LIMIT)
|
||||||
current_speed_in_years = pow(10, current_speed - 1)
|
current_speed_in_years = pow(10, current_speed - 1)
|
||||||
return current_speed
|
return current_speed
|
||||||
|
|||||||
Reference in New Issue
Block a user