Constants & Enums
This page documents all available constants and enumerations used throughout the GrowSoft Lua API. Use these constants in your scripts for better code readability and maintainability.
Centralized Reference
All constants are defined here in one place. Individual API pages link to this reference for easy lookup.
World Punishment Types
Constants for world-specific player punishments:
WORLD_BAN = 1 -- Ban player from the world
WORLD_MUTE = 2 -- Mute player in the worldUsage:
-- Ban a player from the world for 1 hour
world:addPunishment(player, WORLD_BAN, os.time() + 3600, "Rule violation", 0)
-- Mute a player for 30 minutes
world:addPunishment(player, WORLD_MUTE, os.time() + 1800, "Spam", 0)
-- Check for punishment
local punishment = world:getPunishment(player, WORLD_BAN)
if punishment then
print("Player is banned until: " .. punishment.expires)
endSee World Punishments for more details.
World Flags
Flag IDs used with world:hasFlag(id) to check world properties:
| Flag ID | Property | Description |
|---|---|---|
| 0 | Open to public | World is publicly accessible |
| 1 | Signal jammer | Signal is jammed |
| 2 | Punch jammer | Punching is disabled |
| 3 | Zombie jammer | Zombies are disabled |
| 4 | Balloon jammer | Balloons are disabled |
| 5 | Antigravity | Gravity is reversed/disabled |
| 6 | Ghost jammed | Ghosts are disabled |
| 7 | Pineapple guardian | Protected by pineapple guardian |
| 8 | Firehouse | Firehouse active |
| 9 | Mini-mod | Mini-mod enabled |
| 10 | Xenonite crystal | Xenonite crystal active |
| 11 | Silenced | World chat is silenced |
| 12 | Silenced, but admins ignore | Silenced except for admins |
| 13 | Instant collect gems | Gems collected instantly |
| 14 | Block dropped items | Items cannot be dropped |
| 15 | Disable ghost | Ghosts disabled |
| 16 | Disable cheats | Cheats/mods disabled |
| 17 | Disable one-hit | One-hit breaking disabled |
Usage:
-- Check if world is open to public
if world:hasFlag(0) then
print("World is public!")
end
-- Check if punching is disabled
if world:hasFlag(2) then
player:onConsoleMessage("Punching is jammed in this world!")
end
-- Check multiple flags
if world:hasFlag(13) and world:hasFlag(3) then
print("World has instant gem collection and zombie jammer")
endSee World Flags for more details.
Ghost Types
Constants for spawning different ghost types in worlds:
GHOST_NORMAL = 1 -- Normal ghost (speed: 33)
GHOST_ANCESTOR = 4 -- Ancestor ghost (speed: 33)
GHOST_SHARK = 6 -- Shark ghost (speed: 33)
GHOST_WINTERFEST = 7 -- Winterfest ghost (speed: 33)
GHOST_BOSS = 11 -- Boss ghost (speed: 33)
GHOST_MIND = 12 -- Mind ghost (speed: 132)Recommended Movement Speeds:
- Most ghosts:
33 - Mind ghost:
132
Usage:
local tile = world:getTile(10, 10)
-- Spawn a normal ghost
world:spawnGhost(tile, GHOST_NORMAL, 0, 0, 33)
-- Spawn a mind ghost with faster speed
world:spawnGhost(tile, GHOST_MIND, 0, 0, 132)
-- Spawn a boss ghost that disappears in 60 seconds
world:spawnGhost(tile, GHOST_BOSS, 0, 60, 33)See Ghost Spawning for more details.
Discord Reply Flags
Flags for modifying Discord message behavior:
ReplyFlags = {
CROSSPOSTED = bit.lshift(1, 0),
IS_CROSSPOST = bit.lshift(1, 1),
SUPRESS_EMBEDS = bit.lshift(1, 2),
SOURCE_MESSAGE_DELETED = bit.lshift(1, 3),
URGENT = bit.lshift(1, 4),
HAS_THREAD = bit.lshift(1, 5),
EPHEMERAL = bit.lshift(1, 6),
LOADING = bit.lshift(1, 7),
THREAD_MENTION_FAILED = bit.lshift(1, 8),
SUPRESS_NOTIFICATIONS = bit.lshift(1, 12),
IS_VOICE_MESSAGE = bit.lshift(1, 13),
HAS_SNAPSHOT = bit.lshift(1, 14),
USING_COMPONENTS_V2 = bit.lshift(1, 15)
}Common Flags:
| Flag | Value | Description |
|---|---|---|
| EPHEMERAL | bit.lshift(1, 6) | Message only visible to the user who triggered it |
| SUPRESS_EMBEDS | bit.lshift(1, 2) | Don’t show link previews/embeds |
| SUPRESS_NOTIFICATIONS | bit.lshift(1, 12) | Don’t send push notification |
Usage:
-- Send an ephemeral reply (only visible to the user)
onDiscordMessageCreateCallback(function(event)
if event:getContent() == "-secret" then
event:reply(
"This message is only visible to you!",
nil,
ReplyFlags.EPHEMERAL,
0
)
end
end)
-- Combine multiple flags
local flags = bit.bor(ReplyFlags.EPHEMERAL, ReplyFlags.SUPRESS_NOTIFICATIONS)
event:reply("Silent ephemeral message", nil, flags, 0)See Discord Integration for more details.
Subscription Types
Constants for managing player subscriptions:
TYPE_SUPPORTER = 0
TYPE_SUPER_SUPPORTER = 1
TYPE_YEAR_SUBSCRIPTION = 2
TYPE_MONTH_SUBSCRIPTION = 3
TYPE_GROWPASS = 4
TYPE_TIKTOK = 5
TYPE_BOOST = 6
TYPE_STAFF = 7
TYPE_FREE_DAY_SUBSCRIPTION = 8
TYPE_FREE_3_DAY_SUBSCRIPTION = 9
TYPE_FREE_14_DAY_SUBSCRIPTION = 10Usage:
-- Check if player is a supporter
if player:getSubscription(TYPE_SUPPORTER) ~= nil then
player:onConsoleMessage("Thank you for being a supporter!")
end
-- Add a month subscription
local expireTime = os.time() + (30 * 24 * 60 * 60)
player:addSubscription(TYPE_MONTH_SUBSCRIPTION, expireTime)
-- Add permanent GrowPass
player:addSubscription(TYPE_GROWPASS, 0) -- 0 = permanentSee Player Subscriptions for more details.
Item Rarity Levels
Numeric rarity values returned by item:getPricedRarity():
| Value | Rarity Level | Description |
|---|---|---|
| 0 | No Info | No rarity information available |
| 1 | Common | Common items |
| 2 | Uncommon | Uncommon items |
| 3 | Rare | Rare items |
| 4 | Very Rare | Very rare items |
| 5 | Epic | Epic items |
| 6 | Legendary | Legendary items |
| 7 | Mythical | Mythical items |
Usage:
local item = getItem(242) -- World Lock
local rarity = item:getPricedRarity()
if rarity >= 5 then
player:onConsoleMessage("This item is Epic or higher!")
elseif rarity == 0 then
player:onConsoleMessage("Rarity unknown for this item")
else
player:onConsoleMessage("Item rarity level: " .. rarity)
endSee Item Information for more details.
See Also
- World Structure - World methods and properties
- Player Structure - Player methods and subscriptions
- Item Structure - Item properties and rarity
- Discord Integration - Discord bot features