diff --git a/client/src/dojo/debouncedQueries.ts b/client/src/dojo/debouncedQueries.ts index 58558184e..ea350511a 100644 --- a/client/src/dojo/debouncedQueries.ts +++ b/client/src/dojo/debouncedQueries.ts @@ -2,7 +2,7 @@ import { Component, Metadata, Schema } from "@dojoengine/recs"; import { ToriiClient } from "@dojoengine/torii-client"; import debounce from "lodash/debounce"; import { - addArrivalsSubscription, + addDonkeysAndArmiesSubscription, addHyperstructureSubscription, addMarketSubscription, addToSubscription, @@ -103,14 +103,14 @@ export const debouncedAddToSubscriptionOneKey = debounce( { leading: true }, ); -export const debounceAddResourceArrivals = debounce( +export const debounceAddDonkeysAndArmiesSubscription = debounce( async ( client: ToriiClient, components: Component[], entityID: number[], onComplete?: () => void, ) => { - await subscriptionQueue.add(() => addArrivalsSubscription(client, components, entityID), onComplete); + await subscriptionQueue.add(() => addDonkeysAndArmiesSubscription(client, components, entityID), onComplete); }, 250, { leading: true }, diff --git a/client/src/dojo/queries.ts b/client/src/dojo/queries.ts index 20f2e334d..99575f481 100644 --- a/client/src/dojo/queries.ts +++ b/client/src/dojo/queries.ts @@ -191,7 +191,7 @@ export const addHyperstructureSubscription = async ( console.log("HyperstructureEnd", end - start); }; -export const addArrivalsSubscription = async ( +export const addDonkeysAndArmiesSubscription = async ( client: ToriiClient, components: Component[], entityIds: number[], @@ -200,35 +200,6 @@ export const addArrivalsSubscription = async ( console.log("ArrivalsEnd: starting resource arrivals"); await getEntities( client, - // todo: waiting on ghlim to check issue with this query - // { - // Composite: { - // operator: "And", - // clauses: [ - // { - // Composite: { - // operator: "Or", - // clauses: entityIds.map((id) => ({ - // Member: { - // model: "s0_eternum-EntityOwner", - // member: "entity_owner_id", - // operator: "Eq", - // value: { Primitive: { U32: id } }, - // }, - // })), - // }, - // }, - // { - // Member: { - // model: "s0_eternum-OwnedResourcesTracker", - // member: "resource_types", - // operator: "Neq", - // value: { Primitive: { U256: "0" } }, - // }, - // }, - // ], - // }, - // }, { Composite: { operator: "Or", @@ -248,10 +219,14 @@ export const addArrivalsSubscription = async ( [ "s0_eternum-Army", "s0_eternum-Position", + "s0_eternum-Health", "s0_eternum-EntityOwner", + "s0_eternum-Protectee", + "s0_eternum-Stamina", "s0_eternum-Weight", "s0_eternum-OwnedResourcesTracker", "s0_eternum-ArrivalTime", + "s0_eternum-Quantity", ], 1000, false, diff --git a/client/src/hooks/store/useWorldLoading.tsx b/client/src/hooks/store/useWorldLoading.tsx index 5a1ab77b5..55e76cf11 100644 --- a/client/src/hooks/store/useWorldLoading.tsx +++ b/client/src/hooks/store/useWorldLoading.tsx @@ -7,7 +7,7 @@ export enum LoadingStateKey { Market = "market", PlayerStructuresOneKey = "playerStructuresOneKey", PlayerStructuresTwoKey = "playerStructuresTwoKey", - Arrivals = "arrivals", + DonkeysAndArmies = "donkeysAndArmies", Map = "map", Bank = "bank", World = "world", @@ -32,7 +32,7 @@ export const createWorldStoreSlice = (set: any) => ({ [LoadingStateKey.Market]: false, [LoadingStateKey.PlayerStructuresOneKey]: false, [LoadingStateKey.PlayerStructuresTwoKey]: false, - [LoadingStateKey.Arrivals]: false, + [LoadingStateKey.DonkeysAndArmies]: false, [LoadingStateKey.Map]: false, [LoadingStateKey.Bank]: false, [LoadingStateKey.World]: false, diff --git a/client/src/ui/components/WorldLoading.tsx b/client/src/ui/components/WorldLoading.tsx index 71d753486..fbb45c35a 100644 --- a/client/src/ui/components/WorldLoading.tsx +++ b/client/src/ui/components/WorldLoading.tsx @@ -12,7 +12,7 @@ export const WorldLoading = () => { if (loadingStates[LoadingStateKey.Market]) items.push("Market"); if (loadingStates[LoadingStateKey.PlayerStructuresOneKey] || loadingStates[LoadingStateKey.PlayerStructuresTwoKey]) items.push("Player Structures"); - if (loadingStates[LoadingStateKey.Arrivals]) items.push("Arrivals"); + if (loadingStates[LoadingStateKey.DonkeysAndArmies]) items.push("Donkeys and Armies"); if (loadingStates[LoadingStateKey.Map]) items.push("Map"); if (loadingStates[LoadingStateKey.Bank]) items.push("Bank"); if (loadingStates[LoadingStateKey.World]) items.push("World"); diff --git a/client/src/ui/layouts/World.tsx b/client/src/ui/layouts/World.tsx index 5448f989e..1817fc8dd 100644 --- a/client/src/ui/layouts/World.tsx +++ b/client/src/ui/layouts/World.tsx @@ -4,7 +4,7 @@ import { Redirect } from "wouter"; import useUIStore from "../../hooks/store/useUIStore"; import { - debounceAddResourceArrivals, + debounceAddDonkeysAndArmiesSubscription, debouncedAddHyperstructureSubscription, debouncedAddMarketSubscription, debouncedAddToSubscription, @@ -164,7 +164,7 @@ export const World = ({ backgroundImage }: { backgroundImage: string }) => { const fetch = async () => { setLoading(LoadingStateKey.PlayerStructuresOneKey, true); setLoading(LoadingStateKey.PlayerStructuresTwoKey, true); - setLoading(LoadingStateKey.Arrivals, true); + setLoading(LoadingStateKey.DonkeysAndArmies, true); const isSyncing = true; @@ -186,11 +186,11 @@ export const World = ({ backgroundImage }: { backgroundImage: string }) => { ), ]); - await debounceAddResourceArrivals( + await debounceAddDonkeysAndArmiesSubscription( dojo.network.toriiClient, dojo.network.contractComponents as any, [...structures.map((structure) => structure.entity_id)], - () => setLoading(LoadingStateKey.Arrivals, false), + () => setLoading(LoadingStateKey.DonkeysAndArmies, false), ); } catch (error) { console.error("Fetch failed", error);