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