World
getID
Returns the world's ID.
world:getID()getName
Returns the world's name.
world:getName()getTile
Returns the tile object at the specified coordinates.
world:getTile(x, y)getOwner
Returns the player object of the world's owner, if one exists.
world:getOwner()getSizeX
Get the world size horizontally.
world:getSizeX()getSizeY
Get the world size vertically.
world:getSizeY()getTiles
Returns an array of all tiles in the world.
world:getTiles()getPlayers
Returns a table of all player objects currently in the world.
world:getPlayers()getWorldLock
Returns the tile object of the world lock if present, or nil.
world:getWorldLock()getWorldType
Returns the world type (e.g., 0 for normal, 255 for dungeon).
world:getWorldType()getDroppedItems
Returns a table of all dropped items in the world.
world:getDroppedItems()getPlayersCount
Returns the number of players in the world. Pass 1 to include invisible players.
world:getPlayersCount(includeInvisible)getTileDroppedItems
Returns a list of dropped items on a specific tile.
world:getTileDroppedItems(tile)getTilesByActionType
Returns tiles with a specific action type.
world:getTilesByActionType(actionType)getMagplantRemoteTile
Returns the tile object linked to the player's Magplant Remote.
world:getMagplantRemoteTile(player)getVisiblePlayersCount
Returns the number of visible players in the world.
world:getVisiblePlayersCount()setOwner
Sets the owner of the world by user ID, bypassing world locks.
world:setOwner(user_id)setWeather
Permanently changes the default weather of a world.
world:setWeather(weather_id)setClothing
Force-equips an item onto a player.
world:setClothing(player, item_id)setPlayerPosition
Teleports a player to a specific tile coordinate within the world.
world:setPlayerPosition(player, x, y)setTileBackground
Sets the background of a tile. If isVisual is true, it's a temporary visual change, optionally for a single player.
world:setTileBackground(tile, itemID, isVisual, player)setTileForeground
Sets the foreground of a tile. If isVisual is true, it's a temporary visual change, optionally for a single player.
world:setTileForeground(tile, itemID, isVisual, player)new
Static method to create a new world object in memory. Use world:save() to create it on the server.
world:new(name, sizeX, sizeY, worldType)kill
Kills a player in the world.
world:kill(player)save
Saves a world created with World.new or World.newFromTemplate to the server.
world:save()addXP
Adds XP to a player. Recommended over player:addXP for better management.
world:addXP(player, amount)delete
Deletes a world object from memory if it hasn't been saved.
world:delete()onLoot
Triggers a loot event for a player from a tile.
world:onLoot(player, tile, gem_count)hasFlag
Checks if the world has a specific flag (e.g., 0 for open to public, 1 for signal jammer, etc.).
world:hasFlag(flagID)addAccess
Gives a player access to a World Locked world. adminType: 0 for regular, 1 for super-admin.
world:addAccess(player, adminType)createNPC
Spawns an NPC in the world and returns its player object.
world:createNPC(name, x, y)hasAccess
Checks if a player has build access to the entire world (e.g., via world lock).
world:hasAccess(player)punchTile
Simulates a punch on a tile, triggering its break logic.
world:punchTile(tile)removeNPC
Removes an NPC from the world.
world:removeNPC(npc)spawnGems
Spawns gems at a specific tile coordinate.
world:spawnGems(x, y, amount, player)spawnItem
Spawns an item. center: 1 (default) to center, 0 to not. Returns the dropped item object.
world:spawnItem(x, y, itemID, count, center)adjustGems
Adjusts gem count for a player from a tile action.
world:adjustGems(player, tile, gem_count, val)redeemCode
Forces the player to redeem a specific code.
world:redeemCode(player, code)updateTile
Forces a visual update for a tile, necessary after using tile:setTileData.
world:updateTile(tile)removeOwner
Removes the owner of the world, bypassing world locks.
world:removeOwner()isGameActive
Returns if a game is active in the world.
world:isGameActive()removeAccess
Removes a player's access to a World Locked world.
world:removeAccess(player)addTileAccess
Gives a player permanent access to a specific tile (e.g., Small Lock).
world:addTileAccess(player, tile)findNPCByName
Finds an NPC by name and returns its player object.
world:findNPCByName(name)hasTileAccess
Checks if a player has build access to a specific tile (e.g., via small lock).
world:hasTileAccess(player, tile)useConsumable
Uses a consumable. 4th arg: 1 to suppress callback, 0 to trigger (default).
world:useConsumable(player, tile, id, should_NOT_trigger_callback)useItemEffect
Triggers a visual item effect in the world.
world:useItemEffect(playerNetID, itemID, targetNetID, effectDelay)updateClothing
Forces a visual update of a player's clothing for everyone in the world.
world:updateClothing(player)newFromTemplate
Static method to create a new world from a .dat template. Use world:save() to create it.
world:newFromTemplate(name, templateFile)removeTileAccess
Removes a player's access to a specific tile.
world:removeTileAccess(player, tile)onCreateExplosion
Creates an explosion at a specific pixel coordinate.
world:onCreateExplosion(x, y, radius, power)removeDroppedItem
Removes a dropped item by its unique ID.
world:removeDroppedItem(dropUID)sendPlayerMessage
Sends a message to a player, can also run commands.
world:sendPlayerMessage(player, message)onCreateChatBubble
Creates a chat bubble at a specific pixel coordinate.
world:onCreateChatBubble(x, y, text, netID)removeAllTileAccess
Removes all tile access permissions in the world (emergency command).
world:removeAllTileAccess()onGameWinHighestScore
Returns the game's highest win score.
world:onGameWinHighestScore()