Lua API ReferenceConstants & Enums

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 world

Usage:

-- 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)
end

See World Punishments for more details.


World Flags

Flag IDs used with world:hasFlag(id) to check world properties:

Flag IDPropertyDescription
0Open to publicWorld is publicly accessible
1Signal jammerSignal is jammed
2Punch jammerPunching is disabled
3Zombie jammerZombies are disabled
4Balloon jammerBalloons are disabled
5AntigravityGravity is reversed/disabled
6Ghost jammedGhosts are disabled
7Pineapple guardianProtected by pineapple guardian
8FirehouseFirehouse active
9Mini-modMini-mod enabled
10Xenonite crystalXenonite crystal active
11SilencedWorld chat is silenced
12Silenced, but admins ignoreSilenced except for admins
13Instant collect gemsGems collected instantly
14Block dropped itemsItems cannot be dropped
15Disable ghostGhosts disabled
16Disable cheatsCheats/mods disabled
17Disable one-hitOne-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")
end

See 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:

FlagValueDescription
EPHEMERALbit.lshift(1, 6)Message only visible to the user who triggered it
SUPRESS_EMBEDSbit.lshift(1, 2)Don’t show link previews/embeds
SUPRESS_NOTIFICATIONSbit.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 = 10

Usage:

-- 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 = permanent

See Player Subscriptions for more details.


Item Rarity Levels

Numeric rarity values returned by item:getPricedRarity():

ValueRarity LevelDescription
0No InfoNo rarity information available
1CommonCommon items
2UncommonUncommon items
3RareRare items
4Very RareVery rare items
5EpicEpic items
6LegendaryLegendary items
7MythicalMythical 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)
end

See Item Information for more details.


See Also