Item States

Currently, separate states of items – like on vs. off flashlight – have to be defined and treated as separate items, with the transform action used to surreptitiously switch one item for another. This leads to a bloat of objects the game has to consider and keep in memory – something that can slow the game down if it gets big enough.

Using states allows avoiding the bloat by managing their properties within the frame of the same item. A state would be part of the item definition, similar to other <type>_data structures in that it could be used to define multiple states at once and expand them if ever necessary – e.g. via mods.

Each state defines a set of properties that differentiate it from the item's default state, which is defined in the item's root. States could be defined as exclusive or complementary in state_data. Switching from one exclusive state to another deactivates the previous state, but doesn't affect complementary states – e.g. you could still listen to music on your smartphone, regardless of whether its flashlight is on or off.

For example, flashlight's only other state would have the flag "LIGHT_<X>", indicating that it emits light of <X> intensity in this state. Thanks to states, the flashlight could now have different states to switch between: visible light and ultraviolet light. Alternatively, the flashlight could have two complementary modes: visible light on/off and self-defense shocker on/off.

Other items could follow the pattern in simple or complex ways. Scarves could be tied tightly or loosely, as right now, or they could have degrees of tightness ("tight", "loose", "hanging"). Remote controls could be switched to emit different types of signal in order to affect different systems – e.g. red/green/blue channels for wireless electronics. Hyperadvanced firearms could force different modes of operations on the ejected projectiles: seeker bullets, incendiary, EM-emitting, explosive...

See also: Cataclysm issuesAges_into for much better rotting and for a ton of dynamic items

Coupled with modular entity handling, it could mean being able to activate attached items. Tactical flashlights and embedded round belts on the firearm, side holster (rather than just a pocket) on the backpack, one of the multiple gear-attached triggers (think nanosuit from Crysis, with its modes of operations)...

Visually, it could be handled like multiple actions of an item are handled currently: with a modal menu where states could be triggered on or off. In the states paradigm, it could be more comfortable for the player to remain in the "actions" modal until they choose to quit. This suggestion runs off the assumption that it would be easier to switch multiple states, exclusive or complementary, that way. Having a persistent states modal would eliminate a minor but persistent annoyance – something that isn't contemptible the first time but will grow obnoxious over time – from user experience.

For items that only have one additional state, switching could be handled just like for single-transformation items right now: activating it in the actions menu.


Different states will require indication.

For each state, there should be three possible options to alter the original item's name: