Compare commits
	
		
			2 Commits
		
	
	
		
			d48ad24c08
			...
			989d33ff5e
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 989d33ff5e | |||
| 684ebb61a8 | 
							
								
								
									
										15
									
								
								app.lua
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								app.lua
									
									
									
									
									
								
							@ -14,7 +14,11 @@ app.layout = require "views.layout"
 | 
			
		||||
 | 
			
		||||
app:post("/clickme", function(self)
 | 
			
		||||
	self.plane = "P-38L"
 | 
			
		||||
<<<<<<< HEAD
 | 
			
		||||
    mapFunc:populate(map)
 | 
			
		||||
=======
 | 
			
		||||
    mapFunc.populate(self, map)
 | 
			
		||||
>>>>>>> refs/remotes/origin/master
 | 
			
		||||
	return {self.plane, layout = false}
 | 
			
		||||
end)
 | 
			
		||||
 | 
			
		||||
@ -25,6 +29,17 @@ app:get("/", function(self)
 | 
			
		||||
  }
 | 
			
		||||
end)
 | 
			
		||||
 | 
			
		||||
app:match("/map/render", function(self)
 | 
			
		||||
    self.tiles = {}
 | 
			
		||||
    for h=1,10 do
 | 
			
		||||
            self.tiles[h] = {}
 | 
			
		||||
			for i=1,10 do
 | 
			
		||||
			    self.tiles[h][i] = map:find({x = h, y = i})
 | 
			
		||||
			end
 | 
			
		||||
    end
 | 
			
		||||
    return {render = "map", layout = false}
 | 
			
		||||
end)
 | 
			
		||||
 | 
			
		||||
return app
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								database.sqlite3
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								database.sqlite3
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							@ -1,3 +1,27 @@
 | 
			
		||||
<<<<<<< HEAD
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
local map = {
 | 
			
		||||
    map_tiles = {
 | 
			
		||||
        {"-", "-", "w", "w", "-", "-", "-", "-", "-", "-"},
 | 
			
		||||
        {"-", "-", "w", "w", "-", "-", "-", "-", "-", "-"},
 | 
			
		||||
        {"-", "-", "w", "w", "-", "w", "-", "-", "-", "-"},
 | 
			
		||||
        {"w", "-", "-", "-", "w", "w", "-", "-", "-", "-"},
 | 
			
		||||
        {"w", "-", "w", "-", "-", "w", "w", "w", "-", "-"},
 | 
			
		||||
        {"w", "-", "w", "-", "-", "w", "-", "-", "-", "-"},
 | 
			
		||||
        {"-", "-", "w", "-", "-", "w", "-", "w", "-", "-"},
 | 
			
		||||
        {"-", "-", "-", "-", "-", "-", "-", "w", "-", "-"},
 | 
			
		||||
        {"-", "-", "w", "-", "-", "-", "-", "w", "w", "-"},
 | 
			
		||||
        {"-", "-", "w", "-", "-", "-", "-", "-", "w", "-"}
 | 
			
		||||
    },
 | 
			
		||||
	populate = function(self, map)
 | 
			
		||||
		for h=1,10 do 
 | 
			
		||||
			for i=1,10 do
 | 
			
		||||
				local tile = map:create({
 | 
			
		||||
					x = h,
 | 
			
		||||
					y = i,
 | 
			
		||||
					occupied_by_type = self.map_tiles[h][i],
 | 
			
		||||
=======
 | 
			
		||||
local map = {
 | 
			
		||||
	populate = function(self, map)
 | 
			
		||||
		for h=1,100 do 
 | 
			
		||||
@ -6,6 +30,7 @@ local map = {
 | 
			
		||||
					x = h,
 | 
			
		||||
					y = i,
 | 
			
		||||
					occupied_by_type = "",
 | 
			
		||||
>>>>>>> refs/remotes/origin/master
 | 
			
		||||
					occupied_by_id = ""
 | 
			
		||||
				})
 | 
			
		||||
			end
 | 
			
		||||
 | 
			
		||||
@ -12,6 +12,8 @@ http {
 | 
			
		||||
 | 
			
		||||
  init_by_lua_block {
 | 
			
		||||
    require "lpeg"
 | 
			
		||||
    require "lsqlite3"
 | 
			
		||||
    lapis = require "lapis"
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  server {
 | 
			
		||||
 | 
			
		||||
@ -13,6 +13,8 @@ http {
 | 
			
		||||
 | 
			
		||||
  init_by_lua_block {
 | 
			
		||||
    require "lpeg"
 | 
			
		||||
    require "lsqlite3"
 | 
			
		||||
    lapis = require "lapis"
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  server {
 | 
			
		||||
 | 
			
		||||
@ -1,11 +1,15 @@
 | 
			
		||||
<!-- views/index.etlua -->
 | 
			
		||||
<script src="/static/htmx.min.js"></script>
 | 
			
		||||
<div id="clickable">
 | 
			
		||||
    <button hx-post="/clickme" hx-target="#clickable">Start</button>
 | 
			
		||||
</div>
 | 
			
		||||
 | 
			
		||||
<button hx-post="/clickme" hx-target="#clickable">Start</button>
 | 
			
		||||
<p id="clickable"></p>
 | 
			
		||||
<div id="map" hx-get="/map/render" hx-trigger="every 5s">
 | 
			
		||||
 | 
			
		||||
</div>
 | 
			
		||||
 | 
			
		||||
<ol>
 | 
			
		||||
<!--
 | 
			
		||||
<ol>
 | 
			
		||||
<p><% for i, thing in pairs(text) do %>
 | 
			
		||||
     <li><%= thing %></li>
 | 
			
		||||
     <% end %>
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										8
									
								
								views/map.etlua
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								views/map.etlua
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,8 @@
 | 
			
		||||
<p style="text-align: center;">
 | 
			
		||||
<% for h=1,10 do %>
 | 
			
		||||
    <% for i=1,10 do %>
 | 
			
		||||
       <%= tiles[h][i].occupied_by_type %>
 | 
			
		||||
    <% end %>
 | 
			
		||||
    <br>
 | 
			
		||||
<% end %>
 | 
			
		||||
</p>
 | 
			
		||||
		Reference in New Issue
	
	Block a user