Lua Events
To make modding with Depraved Sense easier, the framework has a ton of Lua events in store for other modders to use. Here’s the list of them.
Shared Events
Shared events are events that are triggered both on Client, and Server.
OnGraphLoaded
Triggered when the graph finishes loading.
Parameters
| Name | Type | Notes |
|---|---|---|
| graph | DS_GraphManager | The graph itself |
Client Events
Events that are only triggered on the Client or Singleplayer.
OnCharacterEnteredBus
Triggered when a character enters an AnimBus.
Parameters
| Name | Type | Notes |
|---|---|---|
| character | IsoGameCharacter | The character entering the bus |
OnCharacterExitedBus
Triggered when a character exits an AnimBus.
Parameters
| Name | Type | Notes |
|---|---|---|
| character | IsoGameCharacter | The character exiting the bus |
OnDepravedDataModified
Triggered when the DepravedData of a character has been altered. Often by syncing the data from the Server.
Parameters
| Name | Type | Notes |
|---|---|---|
| data | DS_DepravedData | The DepravedData module |
| character | IsoGameCharacter | The character who had its data updated |
OnPlayerBitten
Triggered when a player was bitten. This is right before the damage is applied, but nothing will avoid the vanilla logic. if you want to change the logic itself, check media/lua/shared/DepravedSense/AnimEvents/zombie/OnZombieAttack.lua
Parameters
| Name | Type | Notes |
|---|---|---|
| player | IsoPlayer | The player that is being bitten |
OnCharacterHasClimaxed
Triggered when a character climaxes.
Parameters
| Name | Type | Notes |
|---|---|---|
| character | IsoGameCharacter | The character who climaxed |
Server Events
OnAnimBusCreated
Triggered when an AnimBus is created.
Parameters
| Name | Type | Notes |
|---|---|---|
| animbus | DS_AnimBus | The AnimBus itself |
OnAnimBusUpdated
Triggered when an AnimBus is updated.
Parameters
| Name | Type | Notes |
|---|---|---|
| animbus | DS_AnimBus | The updated AnimBus |
OnAnimBusRemoved
Triggered when an AnimBus is removed from the BusManager.
Parameters
| Name | Type | Notes |
|---|---|---|
| animbus | DS_AnimBus | The AnimBus itself |
OnActorForcedRemoval
Triggered when an Actor is forced out of an AnimBus. Often by external sources.
Parameters
| Name | Type | Notes |
|---|---|---|
| animbus | DS_AnimBus | The AnimBus itself |
| actor | DS_AnimActor | The actor that was forced out |
Calling The Events
In order to call these events, it is necessary to require the enum storing the events names. For example, this is how you would add an event call on the Server:
local ServerEvents = require("DepravedSense/Events/ServerEvents")
---@param animbus DS_AnimBus
local function cool_function(animbus)
-- CODE!
end
-- Attention with the "[]"!
Events[ServerEvents.OnAnimBusCreated].Add(cool_function)