From c930eb8a0cabaeb3651e2dc7f94a26310fb2dcf3 Mon Sep 17 00:00:00 2001 From: jacopograndi Date: Wed, 19 Jan 2022 20:08:32 +0100 Subject: turrets implementation finished --- scripts/control.gd | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'scripts/control.gd') diff --git a/scripts/control.gd b/scripts/control.gd index 7c8b95d..68b0bb4 100644 --- a/scripts/control.gd +++ b/scripts/control.gd @@ -88,8 +88,8 @@ func build_option (st, sttype): func buy (pos, rot, turr_name): var info = load_turrets.info[turr_name] - if resources.greater_than(info.cost): - resources.sub(info.cost) + if ineditor or resources.greater_than(info.cost): + if !ineditor: resources.sub(info.cost) var obj = placer.inst_turret(pos, rot, turr_name) editing_turret = obj.name state = Globals.PlayerState.EDIT @@ -100,8 +100,8 @@ func buy (pos, rot, turr_name): func upgrade (turr_inst_name, upg_name): var info = load_turrets.info[upg_name] - if resources.greater_than(info.cost): - resources.sub(info.cost) + if ineditor or resources.greater_than(info.cost): + if !ineditor: resources.sub(info.cost) var prv = turret_holder.get_node(turr_inst_name) var pos = prv.transform.origin var rot = prv.transform.basis.get_rotation_quat() @@ -254,6 +254,15 @@ func gui_start_wave_event (): wave.start() gui.refresh() +func end_wave_event (): + wave.end() + + for turr in turret_holder.get_children(): + if turr.info.has("resource_per_wave"): + resources.add(turr.info.resource_per_wave) + + _refresh() + func gui_save_map_event (): saveload_map.map_save() func gui_save_as_map_event (mapname : String): -- cgit v1.2.3-54-g00ecf