-
Notifications
You must be signed in to change notification settings - Fork 2
Sewing Machine Mod Callbacks
Sewing Machine Mod has callbacks you can use to run code depending on events. To register a callback you can use this function :
Sewn_API:AddCallback(callbackId, functionToCall, familiarVariant, levelFlag, ...)
Sewn_API.AddCallback
takes several arguments as :
- [Sewn_API.Enums.ModCallbacks] : The Callback id
- [function] : the function which will be called
- [number] (optional) : A familiar variant, specify this so the callback will only be called for this familiar. If it is not set it will be called for every familiars
- [Sewn_API.Enums.FamiliarLevelFlag] (optional) : Specify the level of the familiar, the function will be called only for the familiar with this level. By default it is
Sewn_API.Enums.FamiliarLevelFlag.FLAG_SUPER | Sewn_API.Enums.FamiliarLevelFlag.FLAG_ULTRA
, so it is called only for upgraded familiars - [...] : Aditional arguments depending on callbacks
All those callbacks are accessible with :
Sewn_API.Enums.ModCallbacks.[Name of the callback]
You can find a list of all callbacks IDs in API functions
Description :
Called each frames for each machines in the room.
Function argument(s) :
- [Entity] : the slot machine
Optional argument(s) :
- [number] : the slot machine variant. It will only be called for this machine variants (default : -1)
- [boolean] : Does the callback should be called when the machine is broken ? (default : false)
Description :
Called when a player touch a machine. This is not called only once the player touch the machine, as long as the player is close enough to the machine the function is called.
Function argument(s) :
- [EntityPlayer] : the player who touch the machine
- [Entity] : the slot machine which is touched by the player
Optional argument(s) :
- [number] : the slot machine variant. It will only be called for this machine variants (default : -1)
Description :
Called when a machine broke.
Function argument(s) :
- [Entity] : the slot machine which broke
Optional argument(s) :
- [number] : the slot machine variant. It will only be called for this machine variants (default : -1)
Return value :
Returning true remove pickups which spawn by default from the machine. Returning false spawn pickups. The last function to be called wins
Description :
Called on the first frame of a tear. The original "POST_TEAR_INIT" is broken, this one does the same thing but everything is set properly here.
Function argument(s) :
- [EntityTear] : the tear
Description :
Called when a familiar fire a tear.
Function argument(s) :
- [EntityFamiliar] : the familiar who fire
- [EntityTear] : the fired tear
Optional argument(s) :
- [FamiliarVariant] : Familiar Variant so it is called only for the specified familiar
- [FamiliarLevelFlag] (optional) : A flag which correspond to the level of the familiar. The function will be called as long as the familiar level match this flag. By default the flag is set to Super + Ultra
Description :
Called on the first frame of a laser. The original "POST_LASER_INIT" is broken, this one does the same thing but everything is set properly here.
Function argument(s) :
- [EntityLaser] : the fired laser
Description :
Called when a familiar fire a laser.
Function argument(s) :
- [EntityFamiliar] : the familiar who fire
- [EntityLaser] : the fired laser
Optional argument(s) :
- [FamiliarVariant] : Familiar Variant so it is called only for the specified familiar
- [FamiliarLevelFlag] (optional) : A flag which correspond to the level of the familiar. The function will be called as long as the familiar level match this flag. By default the flag is set to Super + Ultra
Description :
Called each frames when a familiar tear is updated.
Function argument(s) :
- [EntityFamiliar] : the familiar who fire
- [EntityLaser] : the fired laser
Optional argument(s) :
- [FamiliarVariant] : Familiar Variant so it is called only for the specified familiar
- [FamiliarLevelFlag] (optional) : A flag which correspond to the level of the familiar. The function will be called as long as the familiar level match this flag. By default the flag is set to Super + Ultra
Description :
Called when a player get or lose a collectible. Note the collectible has to be set.
Function argument(s) :
- [EntityPlayer] : the player who get/lose the item
- [boolean] : true if he get the item, false if he lose it
Required argument(s) :
- [CollectibleType] : The ID of the collectible
Description :
Called when a player get or lose a trinket. Note the trinket has to be set.
Function argument(s) :
- [EntityPlayer] : the player who get/lose the trinket
- [boolean] : true if he get the trinket, false if he lose it
Required argument(s) :
- [TrinketType] : The ID of the trinket
Description :
Called after a player touch a Sewing Machine to get a familiar from the machine. At this point the familiar does not exist.
Function argument(s) :
- [Entity] : The sewing machine
- [EntityPlayer] : The player who try to retrieve the familiar back
- [FamiliarVariant] : The variant of the familiar in the machine
- [FamiliarLevel] : The actual level of the familiar in the machine
- [boolean] : True if the player try to get the familiar back with an upgrade, false otherwise. It can be false when the player get the familiar back with Pin Cushion
Optional argument(s) :
- [FamiliarVariant] : Familiar Variant so it is called only for the specified familiar
Return value :
Return true to prevent from upgrading the familiar
Description :
Called after a familiar is taken back from a Sewing Machine.
Function argument(s) :
- [EntityFamiliar] : The familiar which just spawns
- [EntityPlayer] : The player who retrieve the familiar
- [Entity] : The sewing machine
- [bool] : True if the familiar is upgraded, false otherwise (It can be false when the familiar has been retrieve with a bomb)
- [FamiliarLevel] : The new level of the familiar
Optional argument(s) :
- [FamiliarVariant] : Familiar Variant so it is called only for the specified familiar
Return value :
Return true to prevent the machine to explode. Return false or nil will do the standard behaviour.
Description :
Called each frames for a familiar.
Function argument(s) :
- [EntityFamiliar] : The familiar
Optional argument(s) :
- [FamiliarVariant] : Familiar Variant so it is called only for the specified familiar
- [FamiliarLevelFlag] (optional) : A flag which correspond to the level of the familiar. The function will be called as long as the familiar level match this flag. By default the flag is set to Super + Ultra
Description :
Called when a familiar hit an enemy. It is also called when a tear, a laser or any effect which came from a familiar hit an enemy.
Function argument(s) :
- [EntityFamiliar] : The familiar which hit the npc
- [Entity] : The entity who take damage
- [float] : Damage amount
- [DamageFlags] : Damage flags
- [EntityRef] : The source of damage
- [int] : Damage countdown frames
Optional argument(s) :
- [FamiliarVariant] : Familiar Variant so it is called only for the specified familiar
- [FamiliarLevelFlag] (optional) : A flag which correspond to the level of the familiar. The function will be called as long as the familiar level match this flag. By default the flag is set to Super + Ultra
Return value : Return false to ignore the damage.
Description :
Called when a familiar kill an enemy. It is also called when a tear, a laser or any effect which came from a familiar kill an enemy.
Function argument(s) :
- [EntityFamiliar] : The familiar which kill the npc
- [Entity] : The entity who die
Optional argument(s) :
- [FamiliarVariant] : Familiar Variant so it is called only for the specified familiar
- [FamiliarLevelFlag] (optional) : A flag which correspond to the level of the familiar. The function will be called as long as the familiar level match this flag. By default the flag is set to Super + Ultra
Description :
Called when a familiar play the specified animation.
Function argument(s) :
- [EntityFamiliar] : The familiar which kill the npc
- [Sprite] : The sprite of the entity
Optional argument(s) :
- [FamiliarVariant] : Familiar Variant so it is called only for the specified familiar
- [FamiliarLevelFlag] (optional) : A flag which correspond to the level of the familiar. The function will be called as long as the familiar level match this flag. By default the flag is set to Super + Ultra, set this to nil to use the default value.
- [string] : The name of the animation
- [...] : You can set several string so it will check each of them
Description :
Called on a new room, for each familiars.
Function argument(s) :
- [EntityFamiliar] : The familiar
Optional argument(s) :
- [FamiliarVariant] : Familiar Variant so it is called only for the specified familiar
- [FamiliarLevelFlag] (optional) : A flag which correspond to the level of the familiar. The function will be called as long as the familiar level match this flag. By default the flag is set to Super + Ultra
Description :
Called on a new level (stage), for each familiars.
Function argument(s) :
- [EntityFamiliar] : The familiar
Optional argument(s) :
- [FamiliarVariant] : Familiar Variant so it is called only for the specified familiar
- [FamiliarLevelFlag] (optional) : A flag which correspond to the level of the familiar. The function will be called as long as the familiar level match this flag. By default the flag is set to Super + Ultra
Description :
Called when a familiar is upgraded. Warning : this is called for permanent and temporary upgrades (Sewing Box for example).
Function argument(s) :
- [EntityFamiliar] : The familiar who is upgraded
- [boolean] : True if it is a permanent upgrade, false if it is a temporary upgrade
Optional argument(s) :
- [FamiliarVariant] : Familiar Variant so it is called only for the specified familiar
- [FamiliarLevelFlag] (optional) : A flag which correspond to the level of the familiar. The function will be called as long as the familiar level match this flag. By default the flag is set to Super + Ultra
Description :
Called when a familiar tear collide with something else.
Function argument(s) :
- [EntityFamiliar] : The parent familiar of the tear
- [EntityTear] : The tear which collide
- [Entity] : The collider
Optional argument(s) :
- [FamiliarVariant] : Familiar Variant so it is called only for the specified familiar
- [FamiliarLevelFlag] (optional) : A flag which correspond to the level of the familiar. The function will be called as long as the familiar level match this flag. By default the flag is set to Super + Ultra
Return value :
Return true to ignore the collision
Description :
Called for each familiars, when the player clean a room.
Function argument(s) :
- [EntityFamiliar] : The familiar
Optional argument(s) :
- [FamiliarVariant] : Familiar Variant so it is called only for the specified familiar
- [FamiliarLevelFlag] (optional) : A flag which correspond to the level of the familiar. The function will be called as long as the familiar level match this flag. By default the flag is set to Super + Ultra
Description :
Called just before the familiar is put in the machine. Can be used to clean effects (Cube Baby frozen effect)
Function argument(s) :
- [EntityFamiliar] : The familiar
- [Entity] : The Sewing machine
Optional argument(s) :
- [FamiliarVariant] : Familiar Variant so it is called only for the specified familiar
Description :
Called when a familiar lose it upgrades (lose it crown)
Function argument(s) :
- [EntityFamiliar] : The familiar
- [boolean] : True if it lose a permanent upgrade, false if it lose a temporary upgrade
Optional argument(s) :
- [FamiliarVariant] : Familiar Variant so it is called only for the specified familiar
Description :
When the game evaluate the cache of a player, call this to player's familiars
Function argument(s) :
- [EntityFamiliar] : The familiar
- [CacheFlags] : The evaluated cache flags
Optional argument(s) :
- [FamiliarVariant] : Familiar Variant so it is called only for the specified familiar
- [FamiliarLevelFlag] (optional) : A flag which correspond to the level of the familiar. The function will be called as long as the familiar level match this flag. By default the flag is set to Super + Ultra
- [CacheFlags] : A cache flag so it is called only when this cache flag is evaluated
Description :
Called when a familiar collide with something else.
Function argument(s) :
- [EntityFamiliar] : The familiar
- [Entity] : The entity which whom the familiar collide
Optional argument(s) :
- [FamiliarVariant] : Familiar Variant so it is called only for the specified familiar
- [FamiliarLevelFlag] (optional) : A flag which correspond to the level of the familiar. The function will be called as long as the familiar level match this flag. By default the flag is set to Super + Ultra
Description :
Called when a the player's familiar take damage
Function argument(s) :
- [EntityFamiliar] : The familiar
- [EntityPlayer] : The player who take damage
- [DamageFlags] : The damage flags
- [EntityRef] : The damage source
Optional argument(s) :
- [FamiliarVariant] : Familiar Variant so it is called only for the specified familiar
- [FamiliarLevelFlag] (optional) : A flag which correspond to the level of the familiar. The function will be called as long as the familiar level match this flag. By default the flag is set to Super + Ultra
Description :
Called on the first familiar frame
Function argument(s) :
- [EntityFamiliar] : The familiar
Optional argument(s) :
- [FamiliarVariant] : Familiar Variant so it is called only for the specified familiar
- [FamiliarLevelFlag] (optional) : A flag which correspond to the level of the familiar. The function will be called as long as the familiar level match this flag. By default the flag is set to Super + Ultra
For more info, DM me on Discord : valentinL#3711 You can also join the Discord : https://discord.gg/56HzHdAKKG