Interface ElectricalDevice
providerId is a namespaced registration ID and slotId identifies the single device or whole assembly returned by this block's capability. Both remain stable across restarts. This API does not discover multiple simultaneous capability owners at one position; nested components use distinct local node and element IDs, or their native CEE panel and Power Grid circuit-board integration. terminals is a read-only geometry query available without preparing a circuit; implementations return an immutable snapshot and never modify world or electrical state from this method. Server preparation returns captured immutable inputs and does not advance history. WWPG calls commit once per participating server tick, including invalid results when a circuit cannot be solved.
The add-on owns gameplay, synchronization, and serialization. Persist the committed electricalState snapshots with the native block data. Restore those values into initial model inputs when reconstructing elements. Initial values are used only for creation/restoration; unchanged element IDs retain runtime history through parameter edits. Commit must apply gameplay only to valid results; invalid results are never previous readings or artificial zeroes.
-
Method Summary
Modifier and TypeMethodDescriptionvoidcommit(DeviceResults results) Consume accepted results once; save committed history and update native gameplay.prepare(TickContext context) Capture circuit topology and parameters for the supplied authoritative tick.Stable namespaced provider ID, such as example:machine.default StringslotId()Stable identity slot for the capability's single device or whole assembly.Immutable external terminal geometry snapshot; no electrical advancement.
-
Method Details
-
providerId
String providerId()Stable namespaced provider ID, such as example:machine. -
slotId
Stable identity slot for the capability's single device or whole assembly. -
terminals
Immutable external terminal geometry snapshot; no electrical advancement. -
prepare
Capture circuit topology and parameters for the supplied authoritative tick. -
commit
Consume accepted results once; save committed history and update native gameplay.
-