Unverified Commit 2d76ca29 authored by Flávio Fernandes's avatar Flávio Fernandes Committed by GitHub
Browse files

Add 'recompute' param to Satori's update-properties (#1068)

parent d5f76b74
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@ require (
	github.com/gorilla/mux v1.8.0
	github.com/gorilla/websocket v1.5.0
	github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0
	github.com/heroiclabs/nakama-common v1.28.1-0.20230731105719-fb1172396380
	github.com/heroiclabs/nakama-common v1.28.1-0.20230801104954-f68ccb40522c
	github.com/jackc/pgconn v1.14.0
	github.com/jackc/pgerrcode v0.0.0-20220416144525-469b46aa5efa
	github.com/jackc/pgtype v1.14.0
+4 −0
Original line number Diff line number Diff line
@@ -296,6 +296,10 @@ github.com/heroiclabs/nakama-common v1.28.0 h1:oj6voT/3xOkOjeWzPVkrH0ATakZT6WNLL
github.com/heroiclabs/nakama-common v1.28.0/go.mod h1:Os8XeXGvHAap/p6M/8fQ3gle4eEXDGRQmoRNcPQTjXs=
github.com/heroiclabs/nakama-common v1.28.1-0.20230731105719-fb1172396380 h1:cPpoIEukbm0RmM7jzLApRVYQeZp9G1Sg1RsvyxcJ0d4=
github.com/heroiclabs/nakama-common v1.28.1-0.20230731105719-fb1172396380/go.mod h1:Os8XeXGvHAap/p6M/8fQ3gle4eEXDGRQmoRNcPQTjXs=
github.com/heroiclabs/nakama-common v1.28.1-0.20230731165244-63a5a47100ee h1:rDI4A+kMhbE5xzMdWYiDHAavt6zOa7ZjmShNUE2WafI=
github.com/heroiclabs/nakama-common v1.28.1-0.20230731165244-63a5a47100ee/go.mod h1:Os8XeXGvHAap/p6M/8fQ3gle4eEXDGRQmoRNcPQTjXs=
github.com/heroiclabs/nakama-common v1.28.1-0.20230801104954-f68ccb40522c h1:WYodhJ3/FcxNkYHTH4QT07IFM48VTcg5R88f99xeL3I=
github.com/heroiclabs/nakama-common v1.28.1-0.20230801104954-f68ccb40522c/go.mod h1:Os8XeXGvHAap/p6M/8fQ3gle4eEXDGRQmoRNcPQTjXs=
github.com/huandu/xstrings v1.3.1/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
+8 −0
Original line number Diff line number Diff line
@@ -8294,6 +8294,14 @@ func (n *runtimeJavascriptNakamaModule) satoriPropertiesUpdate(r *goja.Runtime)
			properties.Custom = customPropsMap
		}

		if recompute, ok := props["recompute"]; ok {
			recomputeBool, ok := recompute.(bool)
			if !ok {
				panic(r.NewTypeError("expects recompute to be a boolean"))
			}
			properties.Recompute = &recomputeBool
		}

		if err := n.satori.PropertiesUpdate(n.ctx, id, properties); err != nil {
			panic(r.NewGoError(fmt.Errorf("failed to satori update properties: %s", err.Error())))
		}
+8 −0
Original line number Diff line number Diff line
@@ -9986,6 +9986,14 @@ func (n *RuntimeLuaNakamaModule) satoriPropertiesUpdate(l *lua.LState) int {
				return
			}
			properties.Custom = customMap
		case "recompute":
			if v.Type() != lua.LTBool {
				conversionError = true
				l.ArgError(3, "expects recompute value to be a bool")
				return
			}
			recompute := lua.LVAsBool(v)
			properties.Recompute = &recompute
		}
	})

+3 −2
Original line number Diff line number Diff line
@@ -1169,6 +1169,7 @@ type Properties struct {
type PropertiesUpdate struct {
	Default   map[string]string `json:"default,omitempty"`
	Custom    map[string]string `json:"custom,omitempty"`
	Recompute *bool             `json:"recompute,omitempty"`
}

type Events struct {
Loading