Skip to content

Commit

Permalink
Add world size/type/theme into contract :)
Browse files Browse the repository at this point in the history
  • Loading branch information
elliotsayes committed May 10, 2024
1 parent 9985d31 commit c6062af
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 18 deletions.
21 changes: 18 additions & 3 deletions process/gatherchat.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ Worlds = Worlds or {
lastActivity = 1713833416559,
name = "WelcomeLobby",
description = "Welcome to the Lobby!",
theme = "clubhouse1",
worldSize = {
w = 21,
h = 12,
},
worldType = "decoratedRoom",
worldTheme = "room_default",
spawnPosition = {
x = 5,
y = 4,
Expand All @@ -48,7 +53,12 @@ Worlds = Worlds or {
lastActivity = 1713833416559,
name = "ChillZone",
description = "Take it easy ;)",
theme = "clubhouse2",
worldSize = {
w = 12,
h = 14,
},
worldType = "clubbeach",
worldTheme = "clubhouse1",
spawnPosition = {
x = 5,
y = 4,
Expand All @@ -60,7 +70,12 @@ Worlds = Worlds or {
lastActivity = 1713833416559,
name = "HolidayHangout",
description = "Sun, sand, and sea~",
theme = "beach1",
worldSize = {
w = 18,
h = 10,
},
worldType = "clubbeach",
worldTheme = "beach1",
spawnPosition = {
x = 5,
y = 4,
Expand Down
31 changes: 19 additions & 12 deletions src/components/layout/GatherChat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ import { ChatBox } from "../../features/post/components/ChatBox";
import { ProfileView } from "../../features/profile/components/ProfileView";
import { SetupForm } from "../../features/profile/components/SetupForm";
import { SidePanel, type SidePanelState } from "./SidePanel";
import { createClubBeach } from "@/features/worlds/ClubBeach";
import type { RoomTileSet } from "@/features/worlds/components/RoomLayout";
import type { GenericTileSet } from "@/features/worlds/components/GenericLayout";

export type UploadInfo = Pick<ContractPost, "type" | "textOrTxId">;

Expand Down Expand Up @@ -135,19 +138,23 @@ export const GatherChat = ({

const world = useMemo(
() =>
createDecoratedRoom(
"room_default",
{
w: 21,
h: 12,
},
3,
{
w: 4,
h: 4,
},
contractState.world.worldType === "clubbeach" ? (
createClubBeach(
contractState.world.worldTheme as GenericTileSet,
contractState.world.worldSize,
)
) : (
createDecoratedRoom(
contractState.world.worldTheme as RoomTileSet,
contractState.world.worldSize,
3,
{
w: 4,
h: 4,
},
)
),
[],
[contractState.world],
);

return (
Expand Down
7 changes: 6 additions & 1 deletion src/features/ao/lib/ao-gather.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,12 @@ export type ContractWorld = {
lastActivity: number;
name: string;
description: string;
theme: string;
worldSize: {
w: number;
h: number;
}
worldType: string;
worldTheme: string;
spawnPosition: ContractPosition;
playerPositions: Record<ArweaveID, ContractPosition>;
};
Expand Down
7 changes: 6 additions & 1 deletion src/routes/index.lazy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ const defaultState: GatherContractState = {
lastActivity: 0,
name: "",
description: "",
theme: "",
worldSize: {
w: 21,
h: 12,
},
worldType: "room",
worldTheme: "room_default",
spawnPosition: {
x: 5,
y: 4,
Expand Down
7 changes: 6 additions & 1 deletion src/routes/render.lazy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,12 @@ function Render() {
lastActivity: 0,
name: "",
description: "",
theme: "",
worldSize: {
w: widthSlider,
h: heightSlider,
},
worldType,
worldTheme: worldType === "room" ? roomTileSet : clubbeachTileSet,
spawnPosition: {
x: 0,
y: 0,
Expand Down

0 comments on commit c6062af

Please sign in to comment.