fix(scene): unlock all teleports across maps, merge resource configs, fix scenary not load error, and add quick farm battle handlers

This commit is contained in:
CAtlas0784 committed 2026-10-16 20:08:13 +07:00
1 parent 9aab62414f
commit 163d4433e6
47 files changed
+2025067 -6082

No files matched your search

+9 -8
View File
@@ -183,12 +183,12 @@ func (g *Gateway) processKCPPayload(data []byte, addr *net.UDPAddr) {
}
}
// watchFreesrData polls freesr-data.json mtime every second (the Rust version
// used a notify debouncer) and re-syncs the player on change.
// watchFreesrData polls freesr-data.json mtime every second
// and re-syncs the player in real-time when changed.
func watchFreesrData(session *Session) {
var lastMod time.Time
var lastModFreesr time.Time
if st, err := statFile("freesr-data.json"); err == nil {
lastMod = st
lastModFreesr = st
}
ticker := time.NewTicker(time.Second)
defer ticker.Stop()
@@ -197,18 +197,19 @@ func watchFreesrData(session *Session) {
case <-session.Done():
return
case <-ticker.C:
st, err := statFile("freesr-data.json")
if err != nil || !st.After(lastMod) {
stFreesr, _ := statFile("freesr-data.json")
if stFreesr.IsZero() || !stFreesr.After(lastModFreesr) {
continue
}
lastMod = st
lastModFreesr = stFreesr
if data, err := common.LoadFreesrData(); err == nil {
session.SetJSON(data)
if err := session.SyncPlayer(); err == nil {
Log("json updated")
Log("player data updated & live synced to client")
}
}
}
}
}