SHOW:
|
|
- or go back to the newest paste.
| 1 | - | --Equipt Overlay Glasses & Clock Peripherals |
| 1 | + | --[[ |
| 2 | Purpose: To remind the player that the Astral Sorcery Horologium constellation is coming. | |
| 3 | Uses CC:Tweaked and Plethora mods to track the in-game Eclipse | |
| 4 | Made with the Engimatica 2:Expert modpack for Minecraft 1.12.2 | |
| 5 | Wiki says eclipse occurs every 36 days, but only after the first eclipse | |
| 6 | I found the first eclipse in my testing world occured at 34 days | |
| 7 | --]] | |
| 8 | - | --Group box and text objects together |
| 8 | + | |
| 9 | --Requires the Overlay Glasses, Clock & Daylight Sensor | |
| 10 | - | local rect = iGroup.addRectangle(0,0,180,32, 0x00FF002F) |
| 10 | + | --Peripherals to be installed in the Neural Connector |
| 11 | local interface = peripheral.wrap("back")
| |
| 12 | ||
| 13 | --Canvas to draw objects on | |
| 14 | local canvas = interface.canvas() | |
| 15 | canvas.clear() | |
| 16 | - | local tracker = 0 |
| 16 | + | |
| 17 | - | local flag = 0 |
| 17 | + | --Group box and text objects together, all will be drawn on the canvas |
| 18 | - | local daysLeft |
| 18 | + | |
| 19 | local rect = iGroup.addRectangle(0,0,180,25, 0x00FF002F) | |
| 20 | local text = iGroup.addText({5,5}, "")
| |
| 21 | local dbg = iGroup.addText({5,15}, "")
| |
| 22 | ||
| 23 | local day | |
| 24 | local nextDay = 0 | |
| 25 | - | if day ~= tracker then |
| 25 | + | local eclipseFlag = 0 |
| 26 | - | tracker = day |
| 26 | + | |
| 27 | - | flag = 0 |
| 27 | + | |
| 28 | - | --daysLeft = (36-day%36) |
| 28 | + | |
| 29 | - | --text.setText("Day: " .. day .. " | " .. daysLeft .. " Days to " .. tracker)
|
| 29 | + | |
| 30 | angle = math.floor(interface.getCelestialAngle() + 0.5) | |
| 31 | - | if (angle > 355 or angle < 5) then |
| 31 | + | |
| 32 | - | if light <= 8 then |
| 32 | + | |
| 33 | - | text.setText("Eclipse!")
|
| 33 | + | --Initialize variables for a new day |
| 34 | - | flag = 1 |
| 34 | + | if day ~= nextDay then |
| 35 | - | end |
| 35 | + | nextDay = day |
| 36 | - | else |
| 36 | + | eclipseFlag = 0 |
| 37 | - | text.setText("")
|
| 37 | + | rect.setColour(0x00FF002F) |
| 38 | end | |
| 39 | - | if (flag == 1 and angle > 95 and angle < 245) then |
| 39 | + | |
| 40 | - | text.setText("Get Ready for Holog")
|
| 40 | + | |
| 41 | if eclipseFlag == 0 then | |
| 42 | - | dbg.setText("A: "..angle.." L: "..light.." F: "..flag.." T: "..tracker)
|
| 42 | + | --Sets eclipseFlag based on celestial angle and sky light |
| 43 | - | |
| 43 | + | if (angle > 355 or angle < 5) then |
| 44 | if light <= 8 then | |
| 45 | - | end |
| 45 | + | text.setText("Status: Eclipse!")
|
| 46 | eclipseFlag = 1 | |
| 47 | end | |
| 48 | else | |
| 49 | text.setText("Status: ")
| |
| 50 | end | |
| 51 | end | |
| 52 | ||
| 53 | --If it's night, Horologium should be visible | |
| 54 | if (eclipseFlag == 1 and angle > 95 and angle < 245) then | |
| 55 | text.setText("Status: Horologium is in the sky!")
| |
| 56 | rect.setColour(0xFF0000FF) | |
| 57 | end | |
| 58 | ||
| 59 | --Data for debugging | |
| 60 | dbg.setText("A: "..angle.." L: "..light.." E: "..eclipseFlag.." ND: "..nextDay)
| |
| 61 | sleep(5) | |
| 62 | end | |
| 63 | ||
| 64 | --daysLeft = (36-day%36) | |
| 65 | --text.setText("Day: " .. day .. " | " .. daysLeft .. " Days to " .. tracker) |