Browse Source

unknown wips

Tangent 3 years ago
parent
commit
330602f0fc
6 changed files with 74 additions and 0 deletions
  1. 24
    0
      patternsidea.lua
  2. 2
    0
      src/Floor.moon
  3. 1
    0
      test.txt
  4. BIN
      test.zip
  5. 1
    0
      unrelatred.txt
  6. 46
    0
      wip.lua

+ 24
- 0
patternsidea.lua View File

@@ -0,0 +1,24 @@
1
+-- PATTERN: table of patterns to be sent on initialization and/or
2
+--          after "program" channel receives a pattern table
3
+-- Patterns individually sent on "setsort"
4
+-- Completion message sent on "status"
5
+
6
+function send()
7
+  if mem.send > 0 then
8
+    digiline_send("setsort", PATTERN[mem.send])
9
+    mem.send = mem.send - 1
10
+    interrupt(1.2)
11
+  elseif mem.send == 0 then
12
+    digiline_send("status", "Programming complete.")
13
+  else
14
+    mem.send = #PATTERN
15
+    interrupt(1.2)
16
+  end
17
+end
18
+
19
+if (event.type == "program" and PATTERN) or event.type == "interrupt" then
20
+  send()
21
+elseif event.type == "digiline" and event.channel == "program" then
22
+  PATTERN = event.msg
23
+  send()
24
+end

+ 2
- 0
src/Floor.moon View File

@@ -0,0 +1,2 @@
1
+class Floor
2
+  new: =>

+ 1
- 0
test.txt View File

@@ -0,0 +1 @@
1
+The test worked!

BIN
test.zip View File


+ 1
- 0
unrelatred.txt View File

@@ -0,0 +1 @@
1
+The RFC says that if there's no MX the mail client should fall back to the A record

+ 46
- 0
wip.lua View File

@@ -0,0 +1,46 @@
1
+-- assume that the engine will create these
2
+local floor = {}
3
+floor.entity = {}
4
+fn = function(code)
5
+  -- TODO sandbox code appropriately
6
+end
7
+floor.get = function(self, x, y)
8
+  -- TODO whatever is returned by this can be compared with a string to see if its character matches
9
+  -- TODO this should return a second value, a table of entities! or empty table
10
+end
11
+
12
+-- below here is created by the user
13
+floor.entity[1] = { x = 0, y = 0, character = "@" } -- entity drawing defaults: character="e",color={1,1,1,1},background={0,0,0,1}
14
+floor.global_functions = {}
15
+floor.global_functions.action = function(x, y)
16
+  local player = floor.entity[1]
17
+  local target, entities = floor:get(x, y)
18
+  if target == " " and #entities == 0 then
19
+    player.x = x
20
+    player.y = y
21
+  -- TODO elseif entities / other things
22
+  end
23
+end
24
+
25
+-- assumes engine will call it to initialize a floor before it is used
26
+floor.init = function()
27
+  for name, code in pairs(floor.global_functions) do
28
+    _G[name] = fn(code)
29
+  end
30
+  if not floor.generated then
31
+    -- TODO generate this floor!
32
+  end
33
+end
34
+
35
+floor.update = function(key)
36
+  local player = floor.entity[1]
37
+  if key == "up" then
38
+    action(player.x, player.y - 1)
39
+  elseif key == "left" then
40
+    action(player.x - 1, player.y)
41
+  elseif key == "down" then
42
+    action(player.x, player.y + 1)
43
+  elseif key == "right" then
44
+    action(player.x + 1, player.y)
45
+  end
46
+end