API - SynapseSL/Synapse GitHub Wiki
The SynapseController is the main object which contains the entire Synapse API.
It contains 3 static objects:
Namespace: Synapse
This object contains the API to interact with many features of SCP:Secret Laboratory.
You can get it with SynapseController.Server or with Server.Get. (The refrence is the same, it's just a shortcut)
Fields:
- Logger
- Map
- Files
- Events
- RoleManager
- ItemManager
- Configs
- PermissionHandler
- Host => The player object of the Server
- Port => The port the server is running on
- Name => The ServerName
- Slots => The amount of player that can join the Server
- FF => Is FriendlyFire enabled?
- Colors => All allowed colors for Player badge colors
- Players => Gives you a list of all Players on the Server
- ServerConsole => Gives you the ServerConsole Object (Vanilla objects. Not recommended to use)
- GameConsole => Gives you the GameConsole Object (Vanilla objects. Not recommended to use)
Methods:
-
Reload()=> Reloads all Synapse configs and translations -
GetObjectsOf<TObject>() => Gives you all Unity objects of that type -
GetObjectOf<TObject>() => Gives you the first object of that type the Server can find -
GetPlayers(Func<Player,bool>)=> Gives you a list of Players with special arguments (Example:GetPlayers(x => x.NickName == "Dimenzio")=> Gives you all players whose name is Dimenzio) -
GetPlayer(string)=> Gives you a Player with that UserId / PlayerId / Nickname -
GetPlayer(int playerid)=> Gives you a Player with that PlayerId
Namespace: Synapse.Api
This object contains methods to send messages in the ServerConsole
You can get it with SynapseController.Server.Logger or with Logger.Get (The refrence is the same, it's just a shortcut)
-
Info(string)=> Sends a LogInfo to the Console -
Warn(string)=> Sends an LogWarn to the Console -
Error(string)=> Sends an LogError to the Console -
Send(string, ConsoleColor)=> Sends a message with a defined color to the Console (Plugin name will not be added).
Namespace: Synapse.Api
You can get it with SynapseController.Server.Map or Map.Get (The refrence is the same, it's just a shortcut)
This Object contains the fields:
- Nuke
- Round
- Decontamination
- Scp914
- HeavyController
- Teslas => A List of all Tesla objects on the Server
- Elevators => A List of all Elevator objects on the Server
- Doors => A List of all Door objects on the Server
- Rooms => A List of all Room objects on the Server
- Generators => A List of all Generator objects on the Server
- WorkStations => A List of all WorkStation objects on the Server
- Ragdolls => A List of all Ragdoll objects on the Server
- Items => A List of all SynapseItem objects on the Server.
- IntercomText => The text which will be displayed in the intercom
- RespawnPoint => The Position where all Roles should spawn
- WalkSpeed => The WalkSpeed of Humans
- SprintSpeed => The SprintSpeed of Humans
- Seed => The current Map Seed
This Methods contains it:
-
GetRoom()=> Gives you a specific room -
GetDoor()=> Gives you a specific door -
CreateDummy()=> Creates a Dummy object -
CreateWorkStation()=> Creates a Workstation object -
CreateRagdoll()=> Creates a Ragdoll object -
SendBroadcast()=> Sends to all Players a Broadcast -
AnnounceScpDeath()=> Announces the Death of an scp -
Cassie()=> Sends an Cassie Message -
GlitchedCassie()=> Sends an glitchy Cassie message -
SpawnGrenade()=> Spawns a Grenade -
Explode()=> Spawns and explode a Grenade
Namespace: Synapse.Api
You can get it with SynapseController.Server.Map.Nuke or Map.Get.Nuke (The refrence is the same, it's just a shortcut)
This fields contains it:
- WarheadController => Vanilla Object for the AlphaWarheadController
- InsidePanel
- OutsidePanel
- CountdownTime => The Current Countdown of the Warhead
- NukeKills => Amount of Players killed by the Nuke
- Active => If the Nuke is currently active
- Detonated => If the Nuke is already detonated
- CanDetonate => If the Nuke can still detonate
The methods it contains:
-
StartDetonation()=> Stars the Detonation -
CancelDetonation()=> Cancel the Detonation -
Detonate()=> Detonated the Warhead -
InstantPrepare()=> Prepares the Nuke to detonate instant -
Shake()=> Shakes the screen of all Players
Namespace: Synapse.Api(.Nuke)
You can get it with SynapseController.Server.Map.Nuke.InsidePanel or Map.Get.Nuke.InsidePanel (The refrence is the same, it's just a shortcut)
This Object represents the AlphaWarheadPanel inside the Facility.
The fields it contains:
- Panel => The Vanilla object for the NukesitePanel
- Enabled => The state of the activation of the panel
- LeverStatus => The current status of the lever
- Locked => If set to true the lever status cant be set
- Lever => the transform of the Lever
Namespace: Synapse.Api(.Nuke)
You can get it with SynapseController.Server.Map.Nuke.OutsidePanel or Map.Get.Nuke.OutsidePanel (The refrence is the same, it's just a shortcut)
This Object represents the AlphaWarheadPanel outside the Facility.
The fields it contains:
- Panel => The Vanilla object for the OutsidePanel
- KeyCardEntered => If a Keycard is already entered and the Nuke can be activated
Namespace: Synapse.Api
You can get it with SynapseController.Server.Map.Round or Map.Get.Round (The refrence is the same, it's just a shortcut)
The Fields it contains:
- CurrentRound => The current Round played since the server started
- LobbyLock => get/set the LobbyLock
- RoundLock => get/set the RoundLock
- EscapedDPersonnel => The Amount of D-Personnel's which escaped
- EscapedScientist => The Amount of Scientist's which escaped
- ScpKills => The Amount of Kills by Scp's
- RoundLength => The timespan the round is already active
- RoundIsActive => If the Round is active
- RoundEnded => If the Round ended
The Method it contains:
-
StartRound()=> Starts the Round -
EndRound()=> Ends the Round -
RestartRound()=> Restarts the Round -
DimScreens()=> Make the Screens from all Players black -
ShowRoundSummary()=> Shows the winning screen -
MtfRespawn()=> Respawns a Mtf/Chaos
Namespace: Synapse.Api
You can get it with SynapseController.Server.Map.Decontamination or Map.Get.Decontamination (The refrence is the same, it's just a shortcut)
The Fields it contains:
- Controller => The Vanilla object which controls the decontamination
- Locked => If the Decontamination should be disabled
- IsDecontaminationInProgress => If the Decontamination is in progress
The Methods it contains:
-
InstantStart()=> Starts the Decontamination
Namespace: Synapse.Api
You can get it with SynapseController.Server.Map.HeavyController or Map.Get.HeavyController (The refrence is the same, it's just a shortcut)
The fields it contains:
- ForcedOvercharge => If the overcharge was forced because all Scp's are death or a Plugin did it
- ActiveGenerators => The Currently engaged Generators
- Is079Recontained => If a Scp079 Recontainment procedure is over
The methods it contains:
-
Recontain079()=> starts the recontainment of SCP 079 -
Overcharge()=> starts a overcharge -
LightsOut()=> disables all lights for a set time
Namespace: Synapse.Api
You can get it with SynapseController.Server.Map.Scp914 or Map.Get.Scp914 (The refrence is the same, it's just a shortcut)
The fields it contains:
- KnobState => Get / Set the current Knob state
- GameObject => The gameobject of 914
- IsActive => If 914 is active
- Intake => The transform of the Intake
- Output => The transfrom of the Output
- Recipes => The recipes of 914 (are empty while Plugins get loaded so use a delay if you use them in your load method)
The methods it contains:
Activate() => Activates Scp914
UpgradeItemID => Gives you the id of the Item it should become with the current Recipes
Namespace: Synapse.Api
This object contains informations about what an Item can become in 914
The fields it contains:
- itemID => The if of the Item which will be changed
- rough => The Items it can become on rough
- coarse => The Items it can become on coarse
- oneToOne => The Items it can become on 1:1
- fine => The Items it can become on fine
- veryfine => The Items it can become on veryFine
Namespace: Synapse.Api
This object represents a tesla gate on the Map.
The fields it contains:
- GameObject => The GameObject of the tesla gate
- Position => The Position of the gate
- SizeOfTrigger => The Radius in which it will get activated when a player is in it
The methods it contains:
-
Trigger()=> Activates the gate -
InstantTrigger()=> Activates the gate instant like Scp-079
Namespace: Synapse.Api
This object represents a lift on the Map.
The fields it contains:
- GameObject => The GameObject of the lift
- Name => The name of the Elevator
- Position => The Position of the Elevator
- Status => the current Status of the Elevator
- Locked => the state of being locked
- MaxDistance => the max distance of the Elevator
The methods it contains:
-
Use()=> Activates the Elevator
Namespace: Synapse.Api
This object represents a Door on the Map.
The fields it contains:
- GameObject => The GameObject of the door
- Name => The name of the door
- Position => The Position of the door.
- Open => The state of being open
- Locked => The state of being locked
- Room => The Room of the door
- PermissionLevels => The Permissions required to open the door
- DoorType => The type of the door
Namespace: Synapse.Api
The fields it contains:
- GameObject => The GameObject of the room
- Position => The position of the room
- RoomName => The name of the room
- Zone => The zone the room is
- RoomType => The Roomtype of the Room
Namespace: Synapse.Api
The fields it contains:
- GameObject => The GameObject of the generator
- MainGenerator => If it is the MainGenerator
- Name => The name of the Generator
- Position => The position of the Generator
- Open => The state of being open
- Locked => The state of being locked
- IsTabletConnected => The state of an tablet being connected
- ConnectedTablet => The Item which is connected (can also be set to something different than a tablet by an Plugin)
- RemainingPowerUp => The Remaining power
- Room => The Room the Generator is in
- TabletEjectionPoint => The Position where teh tablet should get ejected
- IsOvercharged => If the Generator is overcharged
The methods it contains:
-
Overcharge()=> Overcharge the Generator
Namespace: Synapse.Api
The fields it contains:
- GameObject => The GameObject of the workstation
- Name => The name of the bench
- Position => The Position of the bench
- Scale => The Scale of the Workbench
- IsTabletConnected => The state of an tablet connected
- ConnectedTablet => The Item which is connected (can also be set to something different than a tablet by an Plugin)
- TabletOwner => The Player object of the tablet's owner in the workstation
Namespace: Synapse.Api
The fields it contains:
- Gameobject => The GameObject of the ragdoll
- Name => The name of the Ragdoll
- Position => The position of the Ragdoll
- Scale => The Scale of the Ragdoll
- Owner => The Player of the Ragdoll
- AllowRecall => If Scp-049 can revive it
The methods it contains:
-
Destroy()=> Destroys the Ragdoll
Namespace: Synapse.Api
An Object which creates a fake player which you can use for example as an Npc
The fields it contains:
- Role => The Role
- Name => The nickname of the Dummy
- Position => The Position of the Dummy
- Rotation => The Rotation of the Dummy
- Scale => The Scale of the Dummy
- HeldItem => The Item which the Dummy helds
- BadgeName => The BadgeName of the Dummy
- BadgeColor => The BadgeColor of the Dummy
The methods it contains:
-
RotateToPosition()=> Rotates the dummy to a specific location -
Despawns()=> Despawns the Dummy -
Spawn()=> Spawns the Dummy -
Destroy()=> Destroys the dummy
Namespae: Synapse
The fields it contains:
- SynapseDirectory => The Directory of Synapse
- DatabaseDirectory => The Directory of the Database
- MainPluginDirectory => The Main Directory of the Plugins
- PluginDirectory => The Plugin Directory
- SharedPluginDirectory => The shared Plugin Directory
- MainConfigDirectory => The Main Config Directory
- ConfigDirectory => The Config Directory
- SharedConfigDirectory => The shared COnfig Directory
- PermissionFile => The permission file
- ConfigFile => The Config File
The methods it contains:
-
Refresh()=> Refreshes all fields -
GetTranslationFile()=> Gives you the translation file -
GetPluginDirectory()=> Gives you the Directory of an Plugin
Namespace: Synapse.Api.Items
You can get it with SynapseController.Server.ItemManager or Server.Get.ItemManager (The refrence is the same, it's just a shortcut)
The Methods it contains:
-
GetBaseType(int id)=> Gives you the ItemType on which the item with the id is based on -
GetName(int id)=> Gives you the Name of the Item with that id -
GetInfo(int id)=> Gives you theCustomItemInformationsobject with which the item with that id was registered -
RegisterCustomItem()=> Register a new Custom item (for more informations read here) -
IsIDRegistered(int id)=> Gives you a boolean back which is set to true if the Id exitst (also it gives a true by all Vanilla Item ids)
Namespace: Synapse.Config
This Object is used to interact with the config.syml. It's highly unlikely you will ever need this object (except for UpdateSection()) because Synapse Reloads you Config automatic(for more Informations read here)
The methods it conatins:
-
GetOrSetDefault<T>()=> Gets the Cofig for the IConfigSection or create deafults if they not exists -
GetOrSetDefault()=> The same from above but don't need the Type(not recommended to use) -
UpdateSection<T>()=> Writes the configs from the ConfigSection in the config.syml -
Reload()=> Reloads the config.syml
Namespace: Synapse.Permission
This Object is used to interact with the Permission System of Synapse
The methods it contains:
-
Reload()=> Reloads the entire Permission System -
AddServerGroup()=> Creates a new ServerGroup inside the permission.syml -
GetServerGroup()=> Gives you the ServerGroup with that name -
GetPlayerGroup()=> Gives you the ServerGroup of that Player -
GetDefaultGroup()=> Gives you the default ServerGroup which all Players without a group gets -
GetNorthwoodGroup()=> Gives you the Northwood Group which Northwood staffs without a group gets(can be null) -
AddPlayerToGroup()=> Adds a Player to the members of a ServerGroup in the permission.syml -
RemovePlayerGroup()=> Remove a Player from all Groups
Namespace: Synapse.Api.Plugin
You can get it with SynapseController.PluginLoader.
Fields:
- Plugins => Gives you a List of
PluginInformationabout Plugins that are installed
Namespace; Synapse.Command
You can get it with SynapseController.CommandHandlers.
Fields:
- RemoteAdminHandler => CommandHandler object for the remote admin console.
- ClientCommandHandler => CommandHandler object for the client console.
- ServerConsoleHandler => CommandHandler object for the server console.
Namespace: Synapse.Command
It is used to handle commands but it's recommended to read this if you want to create a Command
The fields it contains:
- Commands => A List of all Commands
The methods it contains:
-
TryGetCommand()=> Gives you the Command with that name/alias -
RegisterCommand()=> Register the Command in the CommandHandler (use it only if you dont want to use ISynapseCommand)