Costs & upkeep
A power can charge the player in two ways:
- Per use: paid once each time a keybind ability fires.
- Upkeep: paid on a beat while a power stays on.
Both use the same keys: hunger_cost (food points; one shank is 2), resource_cost (the id of a neoorigins:resource power) and resource_cost_amount. For a worked walkthrough, see Give an ability a cost.
Who reads the cost keys
active_ability (plus the retired types that load as it: active_launch, active_aoe_effect, healing_mist, repulse) and tame_mob charge hunger_cost / resource_cost / resource_cost_amount once per use. Every toggle type and effect_over_time read the same keys as an upkeep, charged while the power is on: see Toggle upkeep. extra_inventory charges them as an upkeep while its menu is open. active_teleport, active_phase, active_place_block, ground_slam, tidal_wave, shadow_orb and summon_minion charge them once per use too, as of 2.2.33; on summon_minion (like tame_mob) a resource cost replaces hunger_cost rather than adding to it. Every other type, active_dash and active_bolt among them, ignores both resource keys silently: the power loads and costs nothing from the resource. To charge one of those, gate it on a neoorigins:resource condition and spend with neoorigins:change_resource (see Give an ability a cost).
Per-use costs
active_ability checks the cost before it fires. If the player can’t pay, the key does nothing and no cooldown starts; see the hunger_cost and resource_cost_amount rows in active_ability. active_teleport, active_phase, active_place_block, ground_slam, tidal_wave and shadow_orb behave the same way, and also charge nothing when the ability finds nothing to do, such as a teleport with no target in range or a blocked destination: the cost is spent only once the ability has gone off. summon_minion also refuses when the player can’t pay, and says why; it charges once per activation however many minions spawn (see summon_minion). tame_mob charges once per mob tamed, not once per activation; see tame_mob.
Upkeep while a power is on
Every toggle type (toggle, flight, creative_flight, item_magnetism, no_mob_spawns_nearby, phantom_form, stealth, wraith_phase, pose, persistent_effect and condition_passive, plus the aliases that load as those last two) accepts an optional upkeep: a hunger and/or resource cost charged at intervals while the power is on. Every field is optional and the defaults are free, so a toggle without them behaves exactly as before. extra_inventory takes the same hunger_cost, resource_cost, resource_cost_amount and upkeep_interval (but not upkeep_condition) and charges them while its menu is open: see its table.
| Field | Type | Default | Description |
|---|---|---|---|
hunger_cost | int | 0 | Food points charged per charge. Saturation is spent first, as sprinting spends it. |
resource_cost | string | "" | Id of a neoorigins:resource power to drain. While resource bars are disabled server-wide (disable_resource_bars), the amount is charged as hunger instead. |
resource_cost_amount | int | 0 | Amount of resource_cost drained per charge. |
upkeep_interval | int | 20 | Ticks between charges, clamped to at least 1. |
upkeep_condition | condition | always true | Charge only on charge ticks where this passes. A tick where it fails costs nothing, and the power keeps running. |
How the upkeep is charged:
- On a fixed beat. Charges fall on every
upkeep_interval-th tick of the player’s own tick counter while the power is on (and itspower_condition, if any, holds). Switching a toggle on is free and the first charge comes on the next beat, so flipping it off and on again can never charge twice. - All or nothing. If the player can’t cover the whole charge, hunger and resource together, nothing is deducted.
- A toggle that can’t pay switches off, with the same red message a keypress gives, and its effect is torn down as if the key had been pressed. Switch it back on once the bar has refilled; it shuts off again at the next charge it can’t pay.
- A power with no toggle lapses instead.
condition_passive,persistent_effectandposecan be authored with"toggleable": false; with nothing to switch off, a missed charge stops the effect (periodic actions are skipped, effects are cleared, the pose is released) until a later charge it can pay, or one whereupkeep_conditionfails.wraith_phasewith"always_on": trueignores the upkeep fields. upkeep_conditionis not the power’s owncondition. Oncreative_flight,conditiondecides whether the player may fly at all, and the upkeep is charged whenever the toggle is on, airborne or not. Set"upkeep_condition": {"type": "neoorigins:creative_flying"}to charge only while the player is actually flying (see the example undercreative_flight).- Keyless toggles stay where they are. A toggle with an upkeep is never switched back on at login: see Toggles and keys at login.
effect_over_time takes hunger_cost, resource_cost, resource_cost_amount and upkeep_condition too, but charges once per pulse rather than on an upkeep_interval: see its table.
Resource bars switched off
While disable_resource_bars is on in content.toml, every resource_cost is charged as hunger instead, per use and as upkeep alike.
Types with no cost keys
A type that ignores the cost keys can still be charged by hand: gate it on a neoorigins:resource condition and spend from an action_on_event listening to power_activated. The full pattern is in Give an ability a cost.