-
Notifications
You must be signed in to change notification settings - Fork 0
/
HUD.gd
65 lines (53 loc) · 2.35 KB
/
HUD.gd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
extends CanvasLayer
onready var game = get_tree().current_scene
onready var event_window = get_node("EventWindow")
onready var summary_window = get_node("BattleSummaryWindow")
func _ready():
pass
func get_battle_summary_text():
# first summarise the battle result
var winner_name = null
var battle_summary_text = ""
if game.battle_scene.winner != null:
winner_name = game.battle_scene.winner.get_rdf_property("n:fn")
battle_summary_text = winner_name + " triumphed in this game."
else:
battle_summary_text = "Game over."
# explain what happens next
var next_what_happens = "The output world of your game has been saved on a server which one day you'll be able to take to other games, please ask us what that means. We wanted to show you more but we ran out of time ^^'"
return battle_summary_text + "\n\n" + next_what_happens
func get_battle_summary_depiction():
var depiction = null
if game.battle_scene.winner != null:
game.battle_scene.winner.get_rdf_property("foaf:depiction")
return depiction
func display_battle_summary():
# TODO: added recorded history summary which I can scroll through before hitting accept
# var recorded_history = game.world_manager.get_rdf_property("twt2023:hasRecordedHistory")
var summary_obj = {
"@context": {
"n": "http://www.w3.org/2006/vcard/ns#",
"foaf": "http://xmlns.com/foaf/0.1/",
"mud": "https://raw.githubusercontent.com/Multi-User-Domain/vocab/main/mud#",
"mudchar": "https://raw.githubusercontent.com/Multi-User-Domain/vocab/main/mudchar.ttl#",
"mudcard": "https://raw.githubusercontent.com/Multi-User-Domain/vocab/main/mudcard.ttl#",
"mudcombat": "https://raw.githubusercontent.com/Multi-User-Domain/vocab/main/mudcombat.ttl#",
"twt2023": "https://raw.githubusercontent.com/Multi-User-Domain/vocab/main/games/twt2023.ttl#"
},
"@id": "_:TempSummaryObj",
"@type": "https://raw.githubusercontent.com/Multi-User-Domain/vocab/main/mudlogic.ttl#Event",
"n:fn": "Game Over",
"n:hasNote": get_battle_summary_text(),
"twt2023:maximumUses": 1,
"mudlogic:hasChoices": [
{
"n:fn": "Restart",
"@id": "_:SPECIAL_RESET_GAME",
"@type": "https://raw.githubusercontent.com/Multi-User-Domain/vocab/main/mudlogic.ttl#Action",
}
]
}
var depiction = get_battle_summary_depiction()
if depiction != null:
summary_obj["foaf:depiction"] = depiction
summary_window.configure(summary_obj)