diff options
author | jacopograndi <jacopo.grandi@outlook.it> | 2022-01-19 20:08:32 +0100 |
---|---|---|
committer | jacopograndi <jacopo.grandi@outlook.it> | 2022-01-19 20:08:32 +0100 |
commit | c930eb8a0cabaeb3651e2dc7f94a26310fb2dcf3 (patch) | |
tree | 5256261a9510a9ac8e1150c8902ffefbec32ddac /scripts/control.gd | |
parent | 10d700152deeea4a8c6acea1124b9f9ea4905486 (diff) |
turrets implementation finished
Diffstat (limited to 'scripts/control.gd')
-rw-r--r-- | scripts/control.gd | 17 |
1 files changed, 13 insertions, 4 deletions
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): |