Gui

Gui-related functions.

createDialogGui

sm.crashlander.createDialogGui( text, optionsAmount, optionsTexts, optionsCallback, icon, displayedName, isSelfTalkGui, forceHud )

Client only
Creates a dialog gui with the given parameters.

Arguments:

Returns:


createToolChargeGui

sm.crashlander.createToolChargeGui( iconPath )

Client only
Creates a tool charge gui with the given icon.

Arguments:

Returns:


getNamedIconPath

sm.crashlander.getNamedIconPath( name )

Client only
Returns the path to the icon with the given name, returns nil if the name is invalid.

Valid icon names:
"player"
"playerFemale"
"playerMale"
"loneGuy"
"mark"
"ivan"
"justin"
"hank"

Arguments:

Returns:


getInteractionIconScreenSize

sm.crashlander.getInteractionIconScreenSize()

Client only
Returns the screen size for icons in interaction texts.

Returns:


getDisplayName

sm.crashlander.getDisplayName( name )

Client only
Returns a translated string if a language tag with the given name exists, otherwise returns the given name.

Arguments:

Returns:


addLanguageTagSet

sm.crashlander.addLanguageTagSet( path, language )

Server only
Adds a langugage tag set to crashlander's language tag system.
Allows for easily adding translations for any string.

Arguments:


Weather

Crashlander's weather system.

getCurrentWeatherType

sm.crashlander.getCurrentWeatherType()

Returns the current weather type.
See sm.crashlander.weatherTypes.

Returns:


getCurrentWeatherData

sm.crashlander.getCurrentWeatherData()

Client only
Returns the current translated weather string and weather icon.
See sm.crashlander.weatherTypes.

Returns:


isRaining

sm.crashlander.isRaining()

Returns whether the current weather has rain in it.
See sm.crashlander.weatherTypes.

Returns:


weatherTypes

sm.crashlander.weatherTypes = {
    clear = 0,
    rain = 1,
    cloudy = 2,
    verycloudy = 3,
    fog = 4,
    storm = 5,
}

A table of all weather types.


Equipment

Crashlander's equipment system.

addEquipment

sm.crashlander.addEquipment(uuid, slot, renderable, stats, onUpdate, onUse, setId)

Adds a new equipment item to the equipment system.

Arguments:


getEquipmentList

sm.crashlander.getEquipmentList( character )

Returns a list of equipped items.

Argument:

Returns:


isEquipmentEquipped

sm.crashlander.isEquipmentEquipped( character, uuid )

Returns whether the equipment item is equipped.

Argument:

Returns:


isEquipmentSetEquipped

sm.crashlander.isEquipmentSetEquipped( character, setId )

Returns whether the equipment set is equipped.

Arguments:

Returns:


equipmentSlots

sm.crashlander.equipmentSlots = {
    head = "head",
    torso = "torso",
    leg = "leg",
    foot = "foot",
    accessory = "acc"
}

A list of crashlander's equipment slots.


Utils

Other utilities.

version

sm.crashlander.version

The current version of crashlander as a string.


hasSoundDLC

sm.crashlander.hasSoundDLC()

Whether the Crashlander Audio Enhancement DLC is installed.

Returns:


getCompletedAchievementCount

sm.crashlander.getCompletedAchievementCount()

Returns the amount of completed achievements.

Returns:


npcUuids

sm.crashlander.npcUuids = {
    sm.uuid.new("36b1e8ff-8ffa-4b75-a548-1d6377434d53"),
    sm.uuid.new("4296f22c-1205-4035-bad8-e12120fce5a8"),
    sm.uuid.new("bf3982d8-ac96-47c0-b8b7-224f822180e2"),
    sm.uuid.new("ae6310a3-ea6c-4e8e-ac28-407bb0c2dfb1"),
    sm.uuid.new("538ec386-f714-4cde-bd82-ade0d6f5edbf")
}

A list of crashlander npc uuids.


fetchRecipeByUUID

sm.crashlander.fetchRecipeByUUID( uuid )

Returns the recipe of an item by it's uuid or string uuid.

Arguments:

Returns:


isServer

sm.crashlander.isServer()

Returns whether the function is being run on the server.

Returns:


isActionBound

sm.crashlander.isActionBound( action )

Returns whether the player has a keybind bound to the specified action.

Arguments:

Returns:


isInLiquid

sm.crashlander.isInLiquid( areaTrigger, filter )

Checks whether the given areaTrigger is inside a liquid.

Arguments:

Returns:


getMaterialIndex

sm.crashlander.getMaterialIndex( matString )

Returns the index of a material from its string.

Arguments:

Returns:


getCellPosition

sm.crashlander.getCellPosition( x, y )

Gets cell coordinates from world coordinates.

Arguments:

Returns:


getBiomeAt

sm.crashlander.getBiomeAt( x, y, asString )

Server only
Gets cell biome from world position.

Arguments:

Returns:


doesUnitExist

sm.crashlander.doesUnitExist( uuid )

Server only
Checks if atleast one unit with this character uuid exists.

Arguments:

Returns:


getUnitQuantity

sm.crashlander.getUnitQuantity( uuid )

Server only
Checks how many units with this character uuid exist.

Arguments:

Returns:


killUnitsOfUuid

sm.crashlander.killUnitsOfUuid( uuid )

Server only
Kills all units with this character uuid.

Arguments:


getPlayerByName

sm.crashlander.getPlayerByName( name )

Returns the player with the given name.

Arguments:

Returns:


getPlayersInRange

sm.crashlander.getPlayersInRange( pos, distance, maxAmount )

Returns players that are in a certain distance around a provided point.

Arguments:

Returns:


getRandomColor

sm.crashlander.getRandomColor()

Returns a random color.

Returns:


getIndexOf

sm.crashlander.getIndexOf( item, tbl )

Returns the index of the item in the table.

Arguments:

Returns:


combineTables

sm.crashlander.combineTables( ... )

Returns a table combining the tables provided into the function.

Arguments:

Returns:


getRealLength

sm.crashlander.getRealLength( tbl )

Returns the real length of a table.
Unlike #table, this function also works for tables with keys.

Arguments:

Returns:


getByIndex

sm.crashlander.getByIndex( tbl, index )

Returns an item from the table by a number index.
Unlike table[number], this function gets items from tables using an index even if the table has keys.

Arguments:

Returns:


areAnyOf

sm.crashlander.areAnyOf( tbl, tbl2 )

Returns whether any item from tbl is present in tbl2.

Arguments:

Returns:


getContainerItems

sm.crashlander.getContainerItems( container )

Returns a table of all contents inside the specified container.

Arguments:

Returns:


ordinalizeNumber

sm.crashlander.ordinalizeNumber( num )

Client only
Returns the given number or number string with Ordinal Indication.

Arguments:

Returns:


Documentation Classes

Classes used purely for documenting specific values or table structures.

EquipmentSlot

Any string from sm.crashlander.equipmentSlots.


EquipmentItem

Table contents:


EquipmentStats

Table contents:


EquipmentCallback

Table contents:


EquipmentCallbackArgument

Table contents:


BiomeString

Any of the following strings:


LiquidFilter

Table contents:


LanguageName

Any of the following strings: