-
Notifications
You must be signed in to change notification settings - Fork 2
Additional informations
The only global variable used by Sewing Machine is Sewn_API
. You can easily check if the player has the mod enable with :
if Sewn_API then
-- Sewing Machine is enabled
end
You can store data in any entities in the game with :
local data = entity:GetData()
data.x = y
For players, familiars and every entities with the flag "FLAG_PERSISTENT" data are persistent between rooms. For others they get reset on new rooms.
Slot machines, and so Sewing Machine, aren't persistent so if you try to store data they will get reset on new rooms. Sometimes you'll need to store things in the machine, for example when Guppy's Hairball enter the machine the mod store it state, so when the player get it back it has the appropriate state.
Sewing Machines have a special variable which is not reset on new rooms, you can access it with :
local mData = machine:GetData().SewingMachineData
The variable SewingMachineData
is persistent and will not get reset on new rooms.
Sewn_noUpgrade : Prevent the familiar from upgrades. It store Sewn_API.Enums.NoUpgrade
, see NoUpgrade enum
local fData = familiar:GetData()
fData.Sewn_noUpgrade = Sewn_API.Enums.NoUpgrade.NONE -- Default, do not prevent upgrades
fData.Sewn_noUpgrade = Sewn_API.Enums.NoUpgrade.MACHINE -- Prevent from machine upgrades
fData.Sewn_noUpgrade = Sewn_API.Enums.NoUpgrade.TEMPORARY -- Prevent from temporary upgrades
fData.Sewn_noUpgrade = Sewn_API.Enums.NoUpgrade.ANY -- Prevent from both upgrades types
Sewn_upgradeLevel : Store the actual level (permanent level) of a familiar
local fData = familiar:GetData()
print(fData.Sewn_upgradeLevel)
Sewn_upgradeLevel_temporary : Store the temporary level of a familiar
local fData = familiar:GetData()
print(fData.Sewn_upgradeLevel_temporary)
For more info, DM me on Discord : valentinL#3711 You can also join the Discord : https://discord.gg/56HzHdAKKG