Refactor code structure for improved readability and maintainability
This commit is contained in:
+13
-12
@@ -4,16 +4,17 @@ class_name OwniverseEntity
|
||||
var id: String
|
||||
var is_visible: bool = false
|
||||
var unlock: Dictionary = {}
|
||||
var is_unlocked: bool = false
|
||||
var cost: Dictionary = {}
|
||||
var bind: Dictionary = {}
|
||||
var mass: float
|
||||
var space: int
|
||||
var mass: float
|
||||
var space: int
|
||||
var lifespan: int
|
||||
var auto: float
|
||||
var gamma: float
|
||||
var blast: int
|
||||
var gamma: float
|
||||
var blast: int
|
||||
var life_product: Dictionary = {}
|
||||
var product_per_year_type: String = ""
|
||||
var product_per_year_amount: float = 0.0
|
||||
var voids: int
|
||||
var output_or: Dictionary = {}
|
||||
var output_and: Dictionary = {}
|
||||
@@ -30,26 +31,28 @@ var claim: String
|
||||
var amount: float = 0.0
|
||||
|
||||
|
||||
func init_entity(values: Dictionary) -> bool:
|
||||
func init_entity(values: Dictionary) -> void:
|
||||
id = values.id
|
||||
is_visible = values.is_visible == "1"
|
||||
unlock = _parse_and_string(values.unlock)
|
||||
if "prime" == values.unlock:
|
||||
is_unlocked = true
|
||||
cost = _parse_and_string(values.cost)
|
||||
bind = _parse_and_string(values.bind)
|
||||
mass = float(values.mass)
|
||||
space = int(values.space)
|
||||
lifespan = int(values.lifespan)
|
||||
auto = float(values.auto)
|
||||
gamma = float(values.gamma)
|
||||
gamma = float(values.gamma)
|
||||
blast = int(values.blast)
|
||||
life_product = _parse_and_string(values.life_product)
|
||||
for key in life_product.keys():
|
||||
product_per_year_type = key
|
||||
product_per_year_amount = life_product[key] / lifespan if lifespan != 0 else 0
|
||||
|
||||
voids = int(values.voids)
|
||||
output_or = _parse_or_string(values.output)
|
||||
output_and = _parse_and_string(values.output)
|
||||
destroy_level = int(values.destroy_level)
|
||||
degradation = _parse_and_string(values.degradation)
|
||||
degradation = _parse_and_string(values.degradation)
|
||||
planets = _parse_planet_string(values.planets)
|
||||
count_as = values.count_as
|
||||
group_as = values.group_as
|
||||
@@ -58,8 +61,6 @@ func init_entity(values: Dictionary) -> bool:
|
||||
civ_bonus = float(values.civ_bonus)
|
||||
claim = values.claim
|
||||
|
||||
return true
|
||||
|
||||
|
||||
func _parse_or_string(source_line: String) -> Dictionary:
|
||||
var result = {}
|
||||
|
||||
Reference in New Issue
Block a user