This component allows your prefab to be “frozen” in a block of ice from ice-type attacks. You can use MakeSmallFreezableCharacter(inst, symbol), MakeMediumFreezableCharacter(…) and MakeLargeFreezableCharacter(…) too.
Component Freezable Fields
Type | Name | Description |
---|---|---|
number | resistance | how often the prefab needs to get hit |
number | coldness | how much the prefab has been hit already |
number | wearofftime | how long it takes to lose a "coldness" |
string | state | whether your prefab is normal, frozen or thawing |
Component Freezable Methods
Name | Parameter | Returns | Description |
---|---|---|---|
SetResistance | resist | nil | sets the resistance field |
SetDefaultWearOffTime | wearofftime | nil | sets the wearofftime field |
AddShatterFX | prefab, offset, followsymbol | nil | adds a fancy effect when breaking free |
SetShatterFXLevel | level, percent | nil | sets how big the shatter shall be |
SpawnShatterFX | nil | nil | releases the fancy effects |
IsFrozen | nil | boolean | same as freezable.state ~= "NORMAL" |
AddColdness | coldness, freezetime | nil | tints the prefab and can freeze it |
StartWearingOff | wearofftime | nil | reduces coldness over time |
UpdateTint | nil | nil | prefabs get blue when close to freezing |
Freeze | freezetime | nil | stops the prefab, freezetime is how long it takes to wear off |
Unfreeze | nil | nil | entirely removes frost |
Thaw | thawtime | nil | sets the prefab about to break free |
Component Freezable Events
Name | Data | Fires in/when... |
---|---|---|
freeze | nil | Freeze |
unfreeze | nil | Unfreeze |
onthaw | nil | Thaw |
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
local function SetSmall(inst) [...] if inst.components.freezable then inst.components.freezable:SetShatterFXLevel(3) inst.components.freezable:SetResistance(2) end end [...] --the above for every stage local function MakeSpiderDenFn(den_level) local spiderden_fn = function(Sim) local inst = CreateEntity() [...] MakeMediumFreezableCharacter(inst) --usually all you need [...] return inst end return spiderden_fn end |