Unity and Cocos stay as parallel schemes; apps/minigame ships the Godot 4.7 WeChat pack for DevTools. Co-authored-by: Cursor <cursoragent@cursor.com>
48 lines
1.1 KiB
GDScript
48 lines
1.1 KiB
GDScript
extends Node
|
|
|
|
## Lightweight plaza quest loop.
|
|
|
|
signal quest_changed(text: String)
|
|
signal toast(text: String)
|
|
|
|
var met_npcs: Dictionary = {}
|
|
var visited_pois: Dictionary = {}
|
|
var coins := 0
|
|
|
|
func _ready() -> void:
|
|
add_to_group("game")
|
|
call_deferred("_boot")
|
|
|
|
func _boot() -> void:
|
|
quest_changed.emit(_quest_text())
|
|
toast.emit("Welcome to Chiang Mai Plaza")
|
|
|
|
func on_npc_met(npc_name: String) -> void:
|
|
if met_npcs.has(npc_name):
|
|
return
|
|
met_npcs[npc_name] = true
|
|
coins += 5
|
|
toast.emit("Met %s · +5 coin" % npc_name)
|
|
quest_changed.emit(_quest_text())
|
|
_check_clear()
|
|
|
|
func on_poi_visited(poi_title: String) -> void:
|
|
if visited_pois.has(poi_title):
|
|
return
|
|
visited_pois[poi_title] = true
|
|
coins += 8
|
|
toast.emit("Checked in · %s · +8 coin" % poi_title)
|
|
quest_changed.emit(_quest_text())
|
|
_check_clear()
|
|
|
|
func _quest_text() -> String:
|
|
return "Meet nomads %d/5 · Visit spots %d/3 · Coin %d" % [
|
|
mini(met_npcs.size(), 5),
|
|
mini(visited_pois.size(), 3),
|
|
coins,
|
|
]
|
|
|
|
func _check_clear() -> void:
|
|
if met_npcs.size() >= 5 and visited_pois.size() >= 3:
|
|
toast.emit("Day one clear · rooftop sunset unlocked")
|