### Install Docker Prerequisites Source: https://wiki.tiltedphoques.com/tilted-online/guides/server-guide/linux-setup/docker-setup.md Installs essential packages required for Docker installation on Ubuntu. ```bash sudo apt update sudo apt install -y apt-transport-https ca-certificates curl software-properties-common ``` -------------------------------- ### Install the Mod Source: https://wiki.tiltedphoques.com/tilted-online/technical-documentation/build-guide.md Install the compiled mod to create a 'distrib' directory containing all necessary files to run the project. ```bash xmake install -o distrib ``` -------------------------------- ### Start Skyrim Together Server Source: https://wiki.tiltedphoques.com/tilted-online/guides/server-guide/linux-setup/docker-setup.md Starts a previously stopped Skyrim Together server Docker container. ```bash docker start skyrimserver ``` -------------------------------- ### Install Docker Engine and Compose Source: https://wiki.tiltedphoques.com/tilted-online/guides/server-guide/linux-setup/docker-setup.md Installs the Docker Community Edition, CLI, containerd.io, and the Docker Compose plugin. ```bash sudo apt update sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin ``` -------------------------------- ### Example Resource Manifest Configuration Source: https://wiki.tiltedphoques.com/tilted-online/guides/scripting.md This is a sample manifest file required for a script resource. It defines metadata and the entry point for your script. ```ini [Resource] name = "Example Resource" version = 1.0.0 apiset = 1.0.0 description = "Official skyrim together example resource" keywords = ["example", "resource"] license = "MIT" repository = "" homepage = "https://skyrim-together.com/" entrypoint = "main.lua" ``` -------------------------------- ### Query Documentation Index via GET Request Source: https://wiki.tiltedphoques.com/tilted-online/llms.txt Use this GET request to query the documentation index with 'ask' and optional 'goal' parameters. The 'ask' parameter should be a specific, self-contained question in natural language. The 'goal' parameter helps tailor the answer to a broader objective. ```http GET https://wiki.tiltedphoques.com/tilted-online/guides/client-setup.md?ask=&goal= ``` -------------------------------- ### GameServer Event Handling Example Source: https://wiki.tiltedphoques.com/tilted-online/guides/scripting/gameserver.md An example demonstrating how to use GameServer methods within event handlers for player quits, time changes, and chat messages. ```lua local gameServer = GameServer:get() addEventHandler("onPlayerQuit", function(entityId) gameServer:SendGlobalChatMessage("Someone left, server sad, server close :(") gameServer:Kill() end) addEventHandler("onSetTime", function(hours, minutes, timeScale) gameServer:SendGlobalChatMessage("Time set to " .. hours .. ":" .. minutes .. " at time scale of " .. timeScale) end) addEventHandler("onChatMessage", function(entityId, message) local player = getPlayer(entityId) if not player then return end if(string.find(message, "a") then gameServer:SendMessage(player:GetConnectionId(), "Your message contains an a, you're kicked") gameServer:Kick(player:GetConnectionId()) end end) ``` -------------------------------- ### Install UI Dependencies Source: https://wiki.tiltedphoques.com/tilted-online/technical-documentation/build-guide.md Install the required Node.js packages for the Together UI. Navigate to the 'Code/skyrim_ui' directory first. ```bash pnpm install ``` -------------------------------- ### Run Server with Docker Compose Source: https://wiki.tiltedphoques.com/tilted-online/guides/server-guide/linux-setup/docker-setup.md Starts the Skyrim Together server using a docker-compose.yml file. Ensure directories are created beforehand. ```bash docker compose up -d ``` -------------------------------- ### Configure xmake with vcpkg Path Source: https://wiki.tiltedphoques.com/tilted-online/technical-documentation/build-guide/troubleshooting.md Run this command to point xmake to your vcpkg installation directory. This is necessary to resolve errors related to missing vcpkg integration. ```bash xmake g --vcpkg="location" ``` -------------------------------- ### Example Translation File Structure Source: https://wiki.tiltedphoques.com/tilted-online/technical-documentation/contributing-to-translations.md This is an example of a JSON file used for storing translations. Duplicate this file and rename it with the appropriate language code (e.g., da.json for Danish). ```json { "some.key": "Some value", "another.key": "Another value" } ``` -------------------------------- ### Get GameServer Instance Source: https://wiki.tiltedphoques.com/tilted-online/guides/scripting/gameserver.md Fetch the singleton GameServer instance. This is the first step before calling any GameServer methods. ```lua local gameServer = GameServer:get() ``` -------------------------------- ### Clone Repository Source: https://wiki.tiltedphoques.com/tilted-online/technical-documentation/build-guide/build-docker-image.md Clone the TiltedEvolution repository to your local machine. Ensure you have Git installed and are logged into GitHub if necessary. ```bash git clone --recursive https://github.com/tiltedphoques/TiltedEvolution.git ~/str ``` -------------------------------- ### Add Docker Repository Source: https://wiki.tiltedphoques.com/tilted-online/guides/server-guide/linux-setup/docker-setup.md Adds the Docker repository to your APT sources list to enable installation of Docker packages. ```bash echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null ``` -------------------------------- ### Registering Multiple Event Handlers Source: https://wiki.tiltedphoques.com/tilted-online/guides/scripting/event-handlers.md This example demonstrates how to register multiple event handlers for different game events, such as player joins, player quits, chat messages, character spawns/destroys, and server updates. It also shows how to retrieve player information and send global chat messages. ```lua local playerMgr = PlayerManager:get() local gameServer = GameServer:get() function getPlayer(entityId) local players = playerMgr:GetAllPlayers() for k, player in pairs(players) do if player:GetCharacter() == entityId then return player end end return nil end addEventHandler("onUpdate", function(delta) print("This is called every tick") end) addEventHandler("onPlayerJoin", function (connId) local player = getPlayer(connId) if not player then return end gameServer:SendGlobalChatMessage(player:GetUsername() .. " joined the server") end) addEventHandler("onPlayerQuit", function(connId, reason) local player = getPlayer(connId) if not player then return end gameServer:SendGlobalChatMessage(player:GetUsername() .. " left the server") end) addEventHandler("onChatMessage", function(entityId, message) local player = getPlayer(entityId) if not player then return end print(player:GetUsername() .. ": " .. message) end) addEventHandler("onCharacterSpawn", function(entityId) local player = getPlayer(entityId) if player then return end gameServer:SendGlobalChatMessage("Non-player with ID " .. entityId .. " spawned") end) addEventHandler("onCharacterDestroy", function(entityId) local player = getPlayer(entityId) if player then return end gameServer:SendGlobalChatMessage("Non-player with ID " .. entityId .. " destroyed") end) addEventHandler("onSetTime", function(hours, minutes, timeScale) gameServer:SendGlobalChatMessage("Time set to " .. hours .. ":" .. minutes .. " at time scale of " .. timeScale) end) ``` -------------------------------- ### Ask a Question via Documentation API Source: https://wiki.tiltedphoques.com/tilted-online/guides/%7B%7B%20revealButtonHref%20%7D%7D Use this GET request to ask a specific question about the documentation. The 'ask' parameter is required for the question, and 'goal' is optional for specifying the broader objective. ```http GET https://wiki.tiltedphoques.com/tilted-online/guides/server-guide.md?ask=&goal= ``` -------------------------------- ### PlayerManager Methods: Count, GetByConnectionId, GetAllPlayers Source: https://wiki.tiltedphoques.com/tilted-online/guides/scripting/player-functions.md Demonstrates common PlayerManager methods for getting player count, retrieving a player by connection ID, and fetching all connected players. ```lua local playerCount = playerManager:Count() local player = playerManager:GetByConnectionId(connId) local allPlayers = playerManager:GetAllPlayers() ``` -------------------------------- ### Run Skyrim Together Server with Docker Source: https://wiki.tiltedphoques.com/tilted-online/guides/server-guide/linux-setup/docker-setup.md Starts the Skyrim Together server in detached mode, mapping ports and volumes for configuration, data, and logs. ```bash docker run -d -it --name skyrimserver -p 10578:10578/udp -v /opt/docker/skyrimserver/config:/st-server/config -v /opt/docker/skyrimserver/Data:/st-server/Data -v /opt/docker/skyrimserver/logs:/st-server/logs tiltedphoques/st-reborn-server:latest ``` -------------------------------- ### Interact with GameServer Methods Source: https://wiki.tiltedphoques.com/tilted-online/guides/scripting/gameserver.md Call methods on the obtained GameServer instance to perform actions like killing the server, kicking players, or getting the server tick. ```lua gameServer:Kill(playerId) gameServer:Kick(playerId) local serverTick = gameServer:GetTick() ``` -------------------------------- ### Enable QEMU for Emulated Architectures Source: https://wiki.tiltedphoques.com/tilted-online/technical-documentation/build-guide/build-docker-image.md Run this command if you encounter build errors related to emulated architectures. It resets and enables QEMU user static binaries for cross-architecture emulation. ```bash docker run --rm --privileged multiarch/qemu-user-static --reset -p yes ``` -------------------------------- ### Build the Mod Source: https://wiki.tiltedphoques.com/tilted-online/technical-documentation/build-guide.md Compile the mod using xmake. This command builds the project with all configurations. ```bash xmake -y ``` -------------------------------- ### Configure Build Mode Source: https://wiki.tiltedphoques.com/tilted-online/technical-documentation/build-guide.md Configure the build mode for the project. Use 'releasedbg' for debugging the client. ```bash xmake config -m releasedbg ``` -------------------------------- ### Get Player Username Source: https://wiki.tiltedphoques.com/tilted-online/guides/scripting/player-functions.md Retrieve the username of a player instance. Assumes a player instance named 'newPlayer' is available. ```lua local username = newPlayer:GetUsername() ``` -------------------------------- ### Create Docker Buildx Builder Source: https://wiki.tiltedphoques.com/tilted-online/technical-documentation/build-guide/build-docker-image.md Set up a multi-architecture Docker builder named 'str-multiarch' using `docker buildx create`. This builder will be used for cross-platform image builds. ```bash docker buildx create --name str-multiarch --use ``` -------------------------------- ### Get PlayerManager Instance Source: https://wiki.tiltedphoques.com/tilted-online/guides/scripting/player-functions.md Retrieve the global instance of the PlayerManager to manage multiple players. This is the entry point for player management functions. ```lua local playerManager = PlayerManager:get() ``` -------------------------------- ### Basic Docker Build Source: https://wiki.tiltedphoques.com/tilted-online/technical-documentation/build-guide/build-docker-image.md Build the server Docker image for the current architecture without using buildx. This is a simpler method but only produces an image for your local system's architecture. ```bash docker build . ``` -------------------------------- ### Inspect Docker Buildx Builder Source: https://wiki.tiltedphoques.com/tilted-online/technical-documentation/build-guide/build-docker-image.md Verify that the Docker buildx builder is correctly set up and bootstrapped. This command confirms the builder's status and configuration. ```bash docker buildx inspect --bootstrap ``` -------------------------------- ### Create Skyrim Together Server Directories Source: https://wiki.tiltedphoques.com/tilted-online/guides/server-guide/linux-setup/docker-setup.md Creates the necessary directory structure in /opt/docker/ for the Skyrim Together server configuration, data, and logs. ```bash sudo mkdir -p /opt/docker/skyrimserver/{config,Data,logs} ``` -------------------------------- ### Get Public IPv4 Address Source: https://wiki.tiltedphoques.com/tilted-online/guides/server-guide/linux-setup/locating-your-ip-address.md Run this command in your console to display your public IPv4 address. This is the address needed for external connections to your server. ```bash curl -4 icanhazip.com ``` -------------------------------- ### Updated Available Languages Array Source: https://wiki.tiltedphoques.com/tilted-online/technical-documentation/contributing-to-translations.md The complete availableLangs array after adding a new language (Danish in this example). This ensures the new language is recognized by the application. ```typescript availableLangs: [ { id: 'en', label: 'English' }, { id: 'de', label: 'Deutsch' }, { id: 'ru', label: 'Русский' }, { id: 'fr', label: 'Français' }, { id: 'zh-CN', label: '中文(中国)' }, { id: 'nl', label: 'Nederlands' }, { id: 'es', label: 'Español' }, { id: 'ko', label: '한국어' }, { id: 'tr', label: 'Türkçe' }, { id: 'cs', label: 'Čeština' }, { id: 'pl', label: 'Polski' }, { id: 'da', label: 'Dansk' }, { id: 'overwrite', label: 'Custom' }, ] ``` -------------------------------- ### Generate Project Files Source: https://wiki.tiltedphoques.com/tilted-online/technical-documentation/build-guide.md Generate Visual Studio project files using xmake. The generated solution will be in the 'vsxmake20**' folder. ```bash xmake project -k vsxmake ``` -------------------------------- ### GameServer Methods Source: https://wiki.tiltedphoques.com/tilted-online/guides/scripting/gameserver.md Provides documentation for the methods available on the GameServer singleton instance. ```APIDOC ## GameServer GameServer is a singleton instance. To fetch use, use the following lua: ```lua local gameServer = GameServer:get() ``` **Interact with the GameServer** After obtaining the game server instance, you can call methods from the `GameServer` class using the colon operator (:) . For example: ```lua gameServer:Kill(playerId) gameServer:Kick(playerId) local serverTick = gameServer:GetTick() ``` **Send a chat message** To send a chat message from the server to a specific player, use the `SendChatMessage` method: ```lua local connectionId = 1 -- Replace this with the target player's connection ID local message = "Hello from the server!" gameServer:SendChatMessage(connectionId, message) ``` --- ## Methods ### get() * **Description**: Get the GameServer instance * **Usage**: `GameServer:get()` ### Kill() * **Description**: Shut down server * **Usage**: `GameServer:get():Kill()` ### Kick(int) * **Description**: Kick the player with the given Connection Id * **Usage**: `GameServer:get():Kick(player:GetConnectionId())` ### GetTick() * **Description**: Get the server's current tick value * **Usage**: `GameServer:get():GetTick()` ### SendChatMessage(int, string) * **Description**: Send a message to the given Connection Id * **Usage**: `GameServer:get():SendMessage(player:getConnectionId(), "This is a message")` ### SendGlobalChatMessage(string) * **Description**: Send a message to all connected players * **Usage**: `GameServer:get():SendGlobalChatMessage("This is a global message")` ### SetTime(int hours, int minutes, float timeScale) * **Description**: Set the world's time to the specified hour and minutes at the given time scale (default time scale is whatever the current world time scale * **Usage**: `GameServer:get():SetTime(11, 15, 20)` * `-- Set time to 11:15 AM at a time scale of 20` {% hint style="info" %} NOTE: `SendChatMessage` and `SendGlobalChatMessage` are automatically sanitized to remove any HTML tags {% endhint %} ``` -------------------------------- ### Get MovementComponent Instance Source: https://wiki.tiltedphoques.com/tilted-online/guides/scripting/components.md Use this Lua code to retrieve the MovementComponent instance for a given entity. Ensure the 'entity' variable is correctly assigned before calling the function. ```lua local entity = ... -- Replace this with the target entity local movementComponent = GetMovementComponent(entity) ``` -------------------------------- ### Create mat3 Objects Source: https://wiki.tiltedphoques.com/tilted-online/guides/scripting/core-math-functions.md Demonstrates creating mat3 objects using default values, a scalar, a mat4, or individual column values. ```lua local m1 = glm.mat3() local m2 = glm.mat3(1.0) local m3 = glm.mat3(glm.mat4()) local m4 = glm.mat3(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0) ``` -------------------------------- ### Get Player ID, Character, and Level Source: https://wiki.tiltedphoques.com/tilted-online/guides/scripting/player-functions.md Retrieve the unique ID, character model, and level of a player instance. Assumes a player instance named 'newPlayer' is available. ```lua local id = newPlayer:GetId() local character = newPlayer:GetCharacter() local level = newPlayer:GetLevel() ``` -------------------------------- ### Add New Language Entry Source: https://wiki.tiltedphoques.com/tilted-online/technical-documentation/contributing-to-translations.md Example of how to add a new language entry to the availableLangs array in transloco-root.module.ts. This involves creating a new object with the language 'id' and 'label'. ```typescript { id: 'da', label: 'Dansk' } ``` -------------------------------- ### Build Together UI (Production) Source: https://wiki.tiltedphoques.com/tilted-online/technical-documentation/build-guide.md Build the production version of the Together UI. This command should be run from the 'Code/skyrim_ui' directory. ```bash pnpm deploy:production ``` -------------------------------- ### Build Together UI (Development) Source: https://wiki.tiltedphoques.com/tilted-online/technical-documentation/build-guide.md Build the development version of the Together UI. This command should be run from the 'Code/skyrim_ui' directory. ```bash pnpm deploy:develop ``` -------------------------------- ### Mathematical Functions Source: https://wiki.tiltedphoques.com/tilted-online/guides/scripting/core-math-functions.md Demonstrates the usage of square root and power functions. ```lua local sqrt_result = glm.sqrt(x) local pow_result = glm.pow(x, y) local exp_result = glm.exp(x) ``` -------------------------------- ### View Docker Server Logs Source: https://wiki.tiltedphoques.com/tilted-online/guides/server-guide/linux-setup/docker-setup.md Displays the live logs of the running Skyrim Together server container. ```bash docker logs -tf "skyrimserver" ``` -------------------------------- ### Build Multiarch Server Container Source: https://wiki.tiltedphoques.com/tilted-online/technical-documentation/build-guide/build-docker-image.md Build the server Docker container using the multi-architecture builder. This command creates images for linux/amd64 and linux/arm64 and pushes them to Docker Hub. ```bash docker buildx build --platform linux/amd64,linux/arm64 -f Dockerfile -t username/st-reborn-server:latest --push . ``` -------------------------------- ### Clone the Repository Source: https://wiki.tiltedphoques.com/tilted-online/technical-documentation/build-guide.md Clone the Tilted Evolution repository recursively. Replace '[YourGithubName]' with your actual GitHub username. ```bash git clone --recursive https://github.com/[YourGithubName]/TiltedEvolution.git ``` -------------------------------- ### Create vec3 Objects Source: https://wiki.tiltedphoques.com/tilted-online/guides/scripting/core-math-functions.md Demonstrates creating vec3 objects with no arguments, a single scalar value, or three scalar values. ```lua local v1 = glm.vec3() local v2 = glm.vec3(1.0) local v3 = glm.vec3(1.0, 2.0, 3.0) ``` -------------------------------- ### Reset xmake Configuration and Repositories Source: https://wiki.tiltedphoques.com/tilted-online/technical-documentation/build-guide/troubleshooting.md Use this command to reset xmake's configuration and refresh xrepo repositories. This involves deleting the local ./.xmake/ folder and then removing all cached repositories. ```bash xrepo remove --all -y ``` -------------------------------- ### Build Multiarch Builder Image Source: https://wiki.tiltedphoques.com/tilted-online/technical-documentation/build-guide/build-docker-image.md Build the multi-architecture builder image for both linux/amd64 and linux/arm64 platforms. This image is tagged and pushed to your Docker Hub repository. ```bash docker buildx build --platform linux/amd64,linux/arm64 -f Dockerfile.builder -t username/multiarch-builder:latest --push . ``` -------------------------------- ### Create vec2 Objects Source: https://wiki.tiltedphoques.com/tilted-online/guides/scripting/core-math-functions.md Demonstrates creating vec2 objects with no arguments, a single scalar value, or two scalar values. ```lua local v1 = vec2() local v2 = vec2(1.0) local v3 = vec2(1.0, 2.0) ```