Sensor Looks: Thermal, Night Vision and X-ray
README.md
Goggles (module)
A player's own sensor goggles: put them on, cycle through sensor modes (night vision, thermal, x-ray, sonar, any sensorBlocks look or block), take them off. It runs on each machine and changes only what that machine's player sees, while heat and sonar pings stay shared by everyone. GogglesRig drives it from the player's controls; a game can also call it directly (a pickup that gives goggles, a cutscene that forces them off).
local Goggles = require("~sensorGoggles.Goggles")
Goggles.setModes({ "gen3NightVision", "militaryThermal" })
Goggles.setPowerStyle("tube") -- instant | tube | crt | digital
Goggles.setHud("military") -- military | scifi | crt | minimal | none
Goggles.on() -- or Goggles.on("militaryThermal"), Goggles.on(2)
Goggles.next() -- Goggles.previous(), Goggles.next(2)
Goggles.ping() -- a ping from this player, every player sees it
Goggles.off()
Goggles.toggle()
Goggles.onChange(function(event, mode) -- "on", "off", "mode", "empty"
if event == "empty" then print("battery flat") end
end)
print(Goggles.state()) -- { on, mode, index, power, battery, powerStyle, hud }
What it does
- Power on: instant, a tube warm-up (a soft bloom that settles), an old monitor (a line that opens to the picture) or a digital boot (blocks that resolve). Switching modes plays a short re-boot, never a flash.
- Readout: mode name, compass heading, range and the temperature under the reticle (from
Heat.at), and the battery, in a military, sci-fi, old CRT or minimal style, or none. - Battery: drains slowly while on and recharges while off; at zero the goggles switch off and
"empty"fires. - Pings: in a sonar or echolocation mode the goggles ping by themselves every few seconds (echolocation faster and shorter).
- Default modes: gen3NightVision, militaryThermal, sciFiScanner, submarineSonar, horrorInfrared, infraredLandscape, blacklightParty, airportScanner.
Goggles.tick(dt) runs one frame; GogglesRig calls it, so call it yourself only when you drive the goggles without a rig.
Known limits
- One pair of goggles per machine (the local player's).
- Battery and mode are not saved between sessions.