From 379c2794c40bc2b212d29fa0e0847f76e3f3a870 Mon Sep 17 00:00:00 2001 From: J08nY Date: Tue, 25 Apr 2017 01:04:37 +0200 Subject: Almost done here, still not really a game but, oh well Not everything has to work out, not always. --- scripts/builder.gd | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'scripts/builder.gd') diff --git a/scripts/builder.gd b/scripts/builder.gd index 74b8aaf..a37221a 100644 --- a/scripts/builder.gd +++ b/scripts/builder.gd @@ -33,13 +33,14 @@ func combine(where, materials): var gas_mass = 0 var gas_volume = 0 var gas_color = Color(0.5,0.5,0.6,0.4) + var cost = 0 for mat in materials: var item = self.items.get(mat) var category = self.items.category(mat) if category == "solid": mass += item.data["mass"] - #volume += item.data["volume"] + volume += item.data["volume"] var s = item.data["color"] color = color.blend(Color(s)) @@ -48,6 +49,7 @@ func combine(where, materials): gas_volume += item.data["volume"] var s = item.data["color"] gas_color = gas_color.blend(Color(s)) + cost += item.data["cost"] w.materials = materials w.mass = mass @@ -56,5 +58,8 @@ func combine(where, materials): w.gas_mass = gas_mass w.gas_volume = gas_volume w.gas_color = gas_color + w.total_mass = mass + gas_mass + w.total_volume = volume + gas_volume + w.cost = cost w.call_deferred("build") return w -- cgit v1.2.3-70-g09d2