Tables: server.Core - Sceleratis/Adonis Wiki

This is the "Core" table. It houses functions and variables that are essential to the core functionality of Adonis. If something happened to this table or its contents the entire system would become unusable. Functions within this table handle things like initial setup of the RemoteEvent/RemoteFunction, client loading, etc.

(Table) Variables:

Contains Core-related variables, such as the TimeBans table.

Datastore-related variables

--// Datastore update/queue timers/delays
DS_SetDataQueueDelay = 0.5;
DS_UpdateQueueDelay = 1;
DS_AllPlayerDataSaveInterval = 30;
DS_AllPlayerDataSaveQueueDelay = 0.5;

--// Used to change/"reset" specific datastore keys
DS_RESET_SALTS = {
	SavedSettings = "32K5j4";
	SavedTables = 	"32K5j4";
};

DisconnectEvent ()

Disconnects and destroys all events related to security and the RemoteEvent

MakeEvent ()

Creates the RemoteEvent and RemoteFunction used for server-client communication.

UpdateConnections ()

Updates the list of NetworkServer - Player connections

UpdateConnection (userdata: Player)

Same as UpdateConnections but for a specific player.

GetNetworkClient (userdata: Player)

Returns the NetworkClient belonging to 'Player'

SetupEvent (userdata: Player)

Creates a new player-specific RemoteEvent to be used for client-server communication. Not currently used.

PrepareClient ()

Creates a client loader in ReplicatedFirst. Not currently used in favor of handling the client loading process via HookClient(Player)

HookClient (userdata: Player)

When a player joins this function is called and handles the process of preparing the client and parenting it to the player.

LoadClientLoader (userdata: Player)

Handles the loading of existing players at server startup. Calls Process.PlayerAdded(Player)

MakeClient ()

Places the client into StarterPlayerScripts. Not currently used in favor of HookClient

ExecutePermission (userdata: SourceScriptObject, string: Code, bool: isLocal)

Determines if the given script object 'SourceScriptObject' is allowed to run. If 'Code' is provided it will be used as a pseudo-password. If 'isLocal' is true it will be treated as a LocalScript.

Returns: if allowed, table containing Source, noCache, runLimit, number of Executions

GetScript (userdata: ScriptObject, string: Code)

Returns the registered script object matching 'ScriptObject' or 'Code'

UnRegisterScript (userdata: ScriptObject)

Unregisters 'ScriptObject' for execution.

RegisterScript (table: Data)

Registers Data.Script as being allowed to execute along with it's related information.

GetLoadstring ()

Returns a new loadstring module.

Bytecode (string: LuaCode)

Converts 'LuaCode' into bytecode and returns the result. This is used before sending any code to run to the client.

NewScript (string: Class, string: Source, bool: AllowCodes, bool: NoCache, int: RunLimit)

Creates, registers, and returns a new script of class 'Class'

SavePlayer (userdata: Player, table: Data)

Updates Player's data (in Core.PlayerData) do 'Data'

DefaultPlayerData (userdata: Player)

Returns the default player data for 'Player'

GetPlayer (userdata: Player)

Returns the PlayerData for 'Player' Also updates the PlayerData cache and will retrieve data from the datastore if not already cached.

ClearPlayer (userdata: Player)

Clears data related to a player, resetting it to the default values.

SavePlayerData (userdata: Player, (opt)table: CustomData)

Save's data for 'Player' to the datastore.

SaveAllPlayerData ()

Saves all player data.

GetDataStore ()

Returns the DataStore.

DataStoreEncode (string: Key)

Returns the salted, encrypted, Base64 encoded version of a given key to be used in the datastore.

SaveData (...)

Calls Core.SetData(...)

RemoveData (string: Key)

Removes 'Key' and related data from the datastore.

SetData (string: Key, Value)

Sets 'Key' to 'Value' in the datastore cache & datastore (when the datastore is updated)

UpdateData (string: Key, function: Function)

Calls UpdateAsync for the given 'Key' with 'Function'

GetData (string: Key)

Returns data related to 'Key' from the DataCache/datastore

IndexPathToTable (string,table: TableAncestry)

Attempts to find the given table based on the path provided. Returns: foundTable, foundTableIndex

DoSave(table: Data)

Saves settings or tables to the datastore based on information provided in 'Data'

LoadData (string: Key, table: Data)

Loads saved settings, tables, etc.

StartAPI ()

Handles the creation and monitoring of _G.Adonis