File upandaway/components/staticchargeable.lua
Simple component for handling static state transitions.
Author:
Functions
Tables
Functions
- StaticChargeable:Charge (force)
-
Charges if not already.
Parameters
-
force: Forces the charging, even if already charged.
- StaticChargeable:GetOnChargedDelay ()
-
Returns the oncharge delay as a number.
- StaticChargeable:GetOnChargedFn (fn)
-
Returns the oncharge callback.
Parameters
- StaticChargeable:GetOnUnchargedDelay ()
-
Returns the onuncharge delay as a number.
- StaticChargeable:GetOnUnchargedFn (fn)
-
Returns the onuncharge callback.
Parameters
- StaticChargeable:GetStateHoldingDuration ()
-
Returns the duration of the current state holding, and nil otherwise.
- StaticChargeable:HoldState (time)
-
Keeps the current state for a predetermined amount of time. During that period, the state doesn't change with the ambient.
Parameters
- StaticChargeable:IsCharged ()
-
Returns whether it is charged.
- StaticChargeable:IsInHeldState ()
-
Returns whether the current state is unaffected by the ambient.
- StaticChargeable:OnLoad (data)
-
Loads the charged state. Calls Charge() or Uncharge() appropriately.
Parameters
- StaticChargeable:OnSave ()
-
Saves the charged state. Tries to use as little savedata as possible, since we'll have a lot of entities with this component.
- StaticChargeable:ReleaseState ()
-
Reverses the effect of the KeepState.
- StaticChargeable:SetOnChargedDelay (delay)
-
Sets the oncharge delay. Can be a function.
Parameters
- StaticChargeable:SetOnChargedFn (fn)
-
Sets the oncharge callback.
Parameters
- StaticChargeable:SetOnUnchargedDelay (delay)
-
Sets the onuncharge delay. Can be a function.
Parameters
- StaticChargeable:SetOnUnchargedFn (fn)
-
Sets the onuncharge callback.
Parameters
- StaticChargeable:Toggle (force)
-
Toggles the state.
Parameters
- StaticChargeable:Uncharge (force)
-
Uncharges if not already.
Parameters
-
force: Forces the uncharging, even if already uncharged.
Tables
- StaticChargeable
- Simple component for handling static state transitions.