SHOW:
|
|
- or go back to the newest paste.
| 1 | rednet.open("top")
| |
| 2 | local side = "back" | |
| 3 | local int = 0 | |
| 4 | local name = "null" | |
| 5 | local state = "false" | |
| 6 | ||
| 7 | active = | |
| 8 | {
| |
| 9 | ["test"] = false, | |
| 10 | ["cow"] = false, | |
| 11 | ["wither"] = false, | |
| 12 | ["sheep"] = false, | |
| 13 | ["squid"] = false, | |
| 14 | ["ghast"] = false, | |
| 15 | ["blaze"] = false, | |
| 16 | ["creeper"] = false, | |
| 17 | ["witch"] = false, | |
| 18 | ["pigman"] = false, | |
| 19 | ["enderman"] = false, | |
| 20 | ["golem"] = false, | |
| 21 | ["blizz"] = false, | |
| 22 | ["zombie"] = false | |
| 23 | } | |
| 24 | ||
| 25 | redstone.setBundledOutput(side, 0) | |
| 26 | ||
| 27 | function update() | |
| 28 | if int >= 0 then | |
| 29 | redstone.setBundledOutput(side, int) | |
| 30 | else | |
| 31 | int = 0 | |
| 32 | print("ERROR://INT=MINUS")
| |
| 33 | end | |
| 34 | end | |
| 35 | ||
| 36 | while true do | |
| 37 | id, cmd = rednet.receive() | |
| 38 | ||
| 39 | -- Sheep, white | |
| 40 | if cmd == "sheep on" then | |
| 41 | if active["sheep"] == false then | |
| 42 | int = int + 1 | |
| 43 | active["sheep"] = true | |
| 44 | update() | |
| 45 | end | |
| 46 | elseif cmd == "sheep off" then | |
| 47 | if active["sheep"] == true then | |
| 48 | int = int - 1 | |
| 49 | active["sheep"] = false | |
| 50 | update() | |
| 51 | end | |
| 52 | -- Wither skeletons, black | |
| 53 | elseif cmd == "wither on" then | |
| 54 | if active["wither"] == false then | |
| 55 | int = int + 32768 | |
| 56 | active["wither"] = true | |
| 57 | update() | |
| 58 | end | |
| 59 | elseif cmd == "wither off" then | |
| 60 | if active["wither"] == true then | |
| 61 | int = int - 32768 | |
| 62 | active["wither"] = false | |
| 63 | update() | |
| 64 | end | |
| 65 | -- Squid, blue | |
| 66 | elseif cmd == "squid on" then | |
| 67 | if active["squid"] == false then | |
| 68 | int = int + 2048 | |
| 69 | active["squid"] = true | |
| 70 | update() | |
| 71 | end | |
| 72 | elseif cmd == "squid off" then | |
| 73 | if active["squid"] == true then | |
| 74 | int = int - 2048 | |
| 75 | active["squid"] = false | |
| 76 | update() | |
| 77 | end | |
| 78 | -- Cow, brown | |
| 79 | elseif cmd == "cow on" then | |
| 80 | if active["cow"] == false then | |
| 81 | int = int + 4096 | |
| 82 | active["cow"] = true | |
| 83 | update() | |
| 84 | end | |
| 85 | elseif cmd == "cow off" then | |
| 86 | if active["cow"] == true then | |
| 87 | int = int - 4096 | |
| 88 | active["cow"] = false | |
| 89 | update() | |
| 90 | end | |
| 91 | -- TEST, yellow | |
| 92 | elseif cmd == "test on" then | |
| 93 | if active["test"] == false then | |
| 94 | int = int + 16 | |
| 95 | active["test"] = true | |
| 96 | update() | |
| 97 | end | |
| 98 | elseif cmd == "test off" then | |
| 99 | if active["test"] == true then | |
| 100 | int = int - 16 | |
| 101 | active["test"] = false | |
| 102 | update() | |
| 103 | end | |
| 104 | -- Ghast, light gray | |
| 105 | elseif cmd == "ghast on" then | |
| 106 | if active["ghast"] == false then | |
| 107 | int = int + 256 | |
| 108 | active["ghast"] = true | |
| 109 | update() | |
| 110 | end | |
| 111 | elseif cmd == "ghast off" then | |
| 112 | if active["ghast"] == true then | |
| 113 | int = int - 256 | |
| 114 | active["ghast"] = false | |
| 115 | update() | |
| 116 | end | |
| 117 | -- Blaze, red | |
| 118 | elseif cmd == "blaze on" then | |
| 119 | if active["blaze"] == false then | |
| 120 | int = int + 16384 | |
| 121 | active["blaze"] = true | |
| 122 | update() | |
| 123 | end | |
| 124 | elseif cmd == "blaze off" then | |
| 125 | if active["blaze"] == true then | |
| 126 | int = int - 16384 | |
| 127 | active["blaze"] = false | |
| 128 | update() | |
| 129 | end | |
| 130 | -- Creeper, green | |
| 131 | elseif cmd == "creeper on" then | |
| 132 | if active["creeper"] == false then | |
| 133 | int = int + 8192 | |
| 134 | active["creeper"] = true | |
| 135 | update() | |
| 136 | end | |
| 137 | elseif cmd == "creeper off" then | |
| 138 | if active["creeper"] == true then | |
| 139 | int = int - 8192 | |
| 140 | active["creeper"] = false | |
| 141 | update() | |
| 142 | end | |
| 143 | -- Witch, purple | |
| 144 | elseif cmd == "witch on" then | |
| 145 | if active["witch"] == false then | |
| 146 | int = int + 1024 | |
| 147 | active["witch"] = true | |
| 148 | update() | |
| 149 | end | |
| 150 | elseif cmd == "witch off" then | |
| 151 | if active["witch"] == true then | |
| 152 | int = int - 1024 | |
| 153 | active["witch"] = false | |
| 154 | update() | |
| 155 | end | |
| 156 | -- Pigman, orange | |
| 157 | elseif cmd == "pigman on" then | |
| 158 | if active["pigman"] == false then | |
| 159 | int = int + 2 | |
| 160 | active["pigman"] = true | |
| 161 | update() | |
| 162 | end | |
| 163 | elseif cmd == "pigman off" then | |
| 164 | if active["pigman"] == true then | |
| 165 | int = int - 2 | |
| 166 | active["pigman"] = false | |
| 167 | update() | |
| 168 | end | |
| 169 | -- Enderman, light blue | |
| 170 | elseif cmd == "enderman on" then | |
| 171 | if active["enderman"] == false then | |
| 172 | int = int + 8 | |
| 173 | active["enderman"] = true | |
| 174 | update() | |
| 175 | end | |
| 176 | elseif cmd == "enderman off" then | |
| 177 | if active["enderman"] == true then | |
| 178 | int = int - 8 | |
| 179 | active["enderman"] = false | |
| 180 | update() | |
| 181 | end | |
| 182 | -- Golem, gray | |
| 183 | elseif cmd == "golem on" then | |
| 184 | if active["golem"] == false then | |
| 185 | int = int + 128 | |
| 186 | active["golem"] = true | |
| 187 | update() | |
| 188 | end | |
| 189 | elseif cmd == "golem off" then | |
| 190 | if active["golem"] == true then | |
| 191 | int = int - 128 | |
| 192 | active["golem"] = false | |
| 193 | update() | |
| 194 | end | |
| 195 | -- Zombie, lime green | |
| 196 | elseif cmd == "zombie on" then | |
| 197 | if active["zombie"] == false then | |
| 198 | int = int + 32 | |
| 199 | active["zombie"] = true | |
| 200 | update() | |
| 201 | end | |
| 202 | elseif cmd == "zombie off" then | |
| 203 | if active["zombie"] == true then | |
| 204 | int = int - 32 | |
| 205 | active["zombie"] = false | |
| 206 | update() | |
| 207 | end | |
| 208 | -- Blizz, magenta | |
| 209 | elseif cmd == "blizz on" then | |
| 210 | if active["blizz"] == false then | |
| 211 | int = int + 4 | |
| 212 | active["blizz"] = true | |
| 213 | update() | |
| 214 | end | |
| 215 | elseif cmd == "blizz off" then | |
| 216 | if active["blizz"] == true then | |
| 217 | int = int - 4 | |
| 218 | active["blizz"] = false | |
| 219 | update() | |
| 220 | end | |
| 221 | end | |
| 222 | end |