Small Godot Wild Jam game
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Don't allow sending out units if there are 0 in reserves

+12 -6
+12 -6
Scenes/dialogue/dialogue_container.gd
··· 55 55 return (choice == correct_choice) 56 56 57 57 func _on_doc_button_pressed() -> void: 58 - var was_correct := choice_check(Global.UnitType.DOCTOR) 59 - SignalBus.spawn_unit_request.emit(Global.UnitType.DOCTOR, Global.get_target_location(), was_correct) 60 - queue_free() 58 + if Global.available_doctors > 0: 59 + var was_correct := choice_check(Global.UnitType.DOCTOR) 60 + SignalBus.spawn_unit_request.emit(Global.UnitType.DOCTOR, Global.get_target_location(), was_correct) 61 + queue_free() 62 + else: 63 + SignalBus.play_error.emit() 61 64 62 65 63 66 func _on_priest_button_pressed() -> void: 64 - var was_correct := choice_check(Global.UnitType.PRIEST) 65 - SignalBus.spawn_unit_request.emit(Global.UnitType.PRIEST, Global.get_target_location(), was_correct) 66 - queue_free() 67 + if Global.available_priests > 0: 68 + var was_correct := choice_check(Global.UnitType.PRIEST) 69 + SignalBus.spawn_unit_request.emit(Global.UnitType.PRIEST, Global.get_target_location(), was_correct) 70 + queue_free() 71 + else: 72 + SignalBus.play_error.emit()