I dug around in the JSONs quick, and it looks like there’s a property just for this kind of thing. If you want it to do something special while it’s on, you’ll probably need to edit the code, but just making an item turn on and off looks easy.
An excerpt from the flashlight item JSON:
...
"use_action": {
"type": "transform",
"msg": "You turn the flashlight on.",
"target": "flashlight_on",
"active": true,
"need_charges": 1,
"need_charges_msg": "The flashlights batteries are dead."
}
And flashlight_on:
...
"max_charges": 100,
"initial_charges": 100,
"charges_per_use": 0,
"turns_per_charge": 15,
"ammo": "battery",
"revert_to": "flashlight", (assuming this is what turns a flashlight off if it runs out of batteries)
"use_action": {
"type": "auto_transform",
"msg": "You turn the flashlight off.",
"target": "flashlight"
}
Also, the Radio item has this in its On state:
"use_action": "RADIO_ON"
I assume that means that whenever the radio uses a charge it performs the “RADIO_ON” action in the code.