Add objective update notice
This commit is contained in:
@@ -8,6 +8,7 @@ signal log_added(message: String)
|
||||
signal dialogue_requested(lines: Array)
|
||||
signal combat_feedback_requested(unit_id: String, text: String, kind: String)
|
||||
signal unit_motion_requested(unit_id: String, from_cell: Vector2i, to_cell: Vector2i)
|
||||
signal objective_updated(victory: String, defeat: String)
|
||||
|
||||
const TEAM_PLAYER := "player"
|
||||
const TEAM_ENEMY := "enemy"
|
||||
@@ -3682,11 +3683,25 @@ func _grant_event_item(action: Dictionary, trigger_unit: Dictionary = {}) -> boo
|
||||
|
||||
|
||||
func _apply_objective_event(action: Dictionary) -> void:
|
||||
var updated := false
|
||||
var updated_victory := ""
|
||||
var updated_defeat := ""
|
||||
if action.has("victory"):
|
||||
objectives["victory"] = str(action["victory"])
|
||||
updated_victory = str(objectives.get("victory", ""))
|
||||
updated = true
|
||||
if action.has("defeat"):
|
||||
objectives["defeat"] = str(action["defeat"])
|
||||
_emit_log("Objective updated.")
|
||||
updated_defeat = str(objectives.get("defeat", ""))
|
||||
updated = true
|
||||
if not updated:
|
||||
return
|
||||
if action.has("victory") and not updated_victory.is_empty():
|
||||
_emit_log("Objective updated: %s" % updated_victory)
|
||||
if action.has("defeat") and not updated_defeat.is_empty():
|
||||
_emit_log("Defeat condition updated: %s" % updated_defeat)
|
||||
objective_updated.emit(updated_victory, updated_defeat)
|
||||
_notify_changed()
|
||||
|
||||
|
||||
func _dialogue_lines_from_action(action: Dictionary) -> Array:
|
||||
|
||||
Reference in New Issue
Block a user