Add door and source objects
parent
dc831e0948
commit
666230517e
|
@ -1,6 +1,8 @@
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const Vec2 = std.meta.Vector(2,i32);
|
const Vec2 = std.meta.Vector(2,i32);
|
||||||
const Wire = struct { p1: Vec2, p2: Vec2, a1: bool, a2: bool };
|
const Wire = struct { p1: Vec2, p2: Vec2, a1: bool, a2: bool };
|
||||||
pub const solid: [400]u8 = .{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 1, 1, 1, 55, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 37, 1, 39, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 37, 1, 36, 19, 52, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 21, 36, 1, 39, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 50, 54, 36, 1, 39, 1, 50, 19, 19, 19, 22, 22, 22, 19, 19, 19, 19, 52, 1, 1, 1, 1, 37, 1, 39, 1, 1, 1, 1, 1, 37, 1, 55, 1, 1, 1, 1, 1, 1, 1, 1, 1, 37, 1, 1, 22, 52, 1, 1, 1, 37, 39, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 37, 1, 1, 39, 1, 1, 1, 1, 37, 54, 19, 19, 52, 1, 1, 1, 1, 1, 1, 1, 37, 1, 1, 39, 1, 1, 1, 50, 67, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 37, 1, 1, 39, 1, 1, 1, 1, 20, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 37, 1, 1, 36, 52, 1, 1, 1, 20, 1, 1, 17, 19, 19, 19, 19, 19, 19, 18, 1, 37, 1, 1, 39, 1, 1, 1, 1, 20, 1, 1, 20, 1, 1, 1, 1, 1, 1, 20, 1, 37, 1, 1, 39, 1, 1, 1, 50, 67, 1, 1, 20, 1, 1, 1, 1, 1, 1, 20, 1, 37, 1, 1, 39, 1, 1, 1, 1, 20, 1, 1, 20, 1, 1, 1, 1, 1, 1, 20, 1, 37, 1, 54, 66, 52, 1, 1, 1, 51, 1, 1, 51, 1, 50, 19, 19, 19, 19, 34, 1, 33, 54, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 51, 1, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
|
pub const solid: [400]u8 = .{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 1, 1, 1, 55, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 37, 1, 39, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 37, 1, 36, 19, 52, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 21, 36, 1, 39, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 50, 54, 36, 1, 39, 1, 50, 19, 19, 19, 22, 22, 22, 19, 19, 19, 19, 52, 1, 1, 1, 1, 37, 1, 39, 1, 1, 1, 1, 1, 37, 1, 55, 1, 1, 1, 1, 1, 1, 1, 1, 1, 37, 1, 1, 22, 52, 1, 1, 1, 37, 39, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 37, 1, 1, 39, 1, 1, 1, 1, 37, 54, 19, 19, 52, 1, 1, 1, 1, 1, 1, 1, 37, 1, 1, 39, 1, 1, 1, 50, 67, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 37, 1, 1, 39, 1, 1, 1, 1, 20, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 37, 1, 1, 36, 52, 1, 1, 1, 20, 1, 1, 17, 19, 19, 19, 19, 19, 19, 19, 19, 36, 1, 1, 39, 1, 1, 1, 1, 20, 1, 1, 20, 1, 1, 1, 1, 1, 1, 1, 1, 37, 1, 1, 39, 1, 1, 1, 50, 67, 1, 1, 51, 1, 1, 1, 1, 1, 1, 1, 1, 37, 1, 1, 39, 1, 1, 1, 1, 20, 1, 1, 35, 1, 1, 1, 1, 1, 1, 1, 1, 37, 1, 54, 66, 52, 1, 1, 1, 51, 1, 50, 19, 19, 19, 19, 19, 19, 19, 19, 19, 66, 54, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 35, 1, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
|
||||||
pub const conduit: [400]u8 = .{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 131, 131, 180, 0, 0, 0, 0, 0, 0, 178, 180, 0, 0, 0, 0, 0, 0, 178, 130, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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{.a1 = true, .a2 = true,.p1 = Vec2{ 20, 20 },.p2 = Vec2{ 76, 20 },}, .{.a1 = true, .a2 = false,.p1 = Vec2{ 84, 20 },.p2 = Vec2{ 140, 20 },}, .{.a1 = true, .a2 = false,.p1 = Vec2{ 68, 68 },.p2 = Vec2{ 140, 68 },}, };
|
pub const wire: [3]Wire = [_]Wire{.{.a1 = true, .a2 = true,.p1 = Vec2{ 20, 20 },.p2 = Vec2{ 76, 20 },}, .{.a1 = true, .a2 = false,.p1 = Vec2{ 84, 20 },.p2 = Vec2{ 140, 20 },}, .{.a1 = true, .a2 = true,.p1 = Vec2{ 84, 68 },.p2 = Vec2{ 140, 68 },}, };
|
||||||
|
pub const doors: [2]Vec2 = [_]Vec2{Vec2{ 18, 17 },Vec2{ 9, 15 },};
|
||||||
|
pub const sources: [1]Vec2 = [_]Vec2{Vec2{ 0, 4 },};
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
"infinite":false,
|
"infinite":false,
|
||||||
"layers":[
|
"layers":[
|
||||||
{
|
{
|
||||||
"data":[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 1, 1, 1, 55, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 37, 1, 39, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 37, 1, 36, 19, 52, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 21, 36, 1, 39, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 50, 54, 36, 1, 39, 1, 50, 19, 19, 19, 22, 22, 22, 19, 19, 19, 19, 52, 1, 1, 1, 1, 37, 1, 39, 1, 1, 1, 1, 1, 37, 1, 55, 1, 1, 1, 1, 1, 1, 1, 1, 1, 37, 1, 1, 22, 52, 1, 1, 1, 37, 39, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 37, 1, 1, 39, 1, 1, 1, 1, 37, 54, 19, 19, 52, 1, 1, 1, 1, 1, 1, 1, 37, 1, 1, 39, 1, 1, 1, 50, 67, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 37, 1, 1, 39, 1, 1, 1, 1, 20, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 37, 1, 1, 36, 52, 1, 1, 1, 20, 1, 1, 17, 19, 19, 19, 19, 19, 19, 18, 1, 37, 1, 1, 39, 1, 1, 1, 1, 20, 1, 1, 20, 1, 1, 1, 1, 1, 1, 20, 1, 37, 1, 1, 39, 1, 1, 1, 50, 67, 1, 1, 20, 1, 1, 1, 1, 1, 1, 20, 1, 37, 1, 1, 39, 1, 1, 1, 1, 20, 1, 1, 20, 1, 1, 1, 1, 1, 1, 20, 1, 37, 1, 54, 66, 52, 1, 1, 1, 51, 1, 1, 51, 1, 50, 19, 19, 19, 19, 34, 1, 33, 54, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 51, 1, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
|
"data":[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 1, 1, 1, 55, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 37, 1, 39, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 37, 1, 36, 19, 52, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 21, 36, 1, 39, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 50, 54, 36, 1, 39, 1, 50, 19, 19, 19, 22, 22, 22, 19, 19, 19, 19, 52, 1, 1, 1, 1, 37, 1, 39, 1, 1, 1, 1, 1, 37, 1, 55, 1, 1, 1, 1, 1, 1, 1, 1, 1, 37, 1, 1, 22, 52, 1, 1, 1, 37, 39, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 37, 1, 1, 39, 1, 1, 1, 1, 37, 54, 19, 19, 52, 1, 1, 1, 1, 1, 1, 1, 37, 1, 1, 39, 1, 1, 1, 50, 67, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 37, 1, 1, 39, 1, 1, 1, 1, 20, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 37, 1, 1, 36, 52, 1, 1, 1, 20, 1, 1, 17, 19, 19, 19, 19, 19, 19, 19, 19, 36, 1, 1, 39, 1, 1, 1, 1, 20, 1, 1, 20, 1, 1, 1, 1, 1, 1, 1, 1, 37, 1, 1, 39, 1, 1, 1, 50, 67, 1, 1, 51, 1, 1, 1, 1, 1, 1, 1, 1, 37, 1, 1, 39, 1, 1, 1, 1, 20, 1, 1, 35, 1, 1, 1, 1, 1, 1, 1, 1, 37, 1, 54, 66, 52, 1, 1, 1, 51, 1, 50, 19, 19, 19, 19, 19, 19, 19, 19, 19, 66, 54, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 35, 1, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
|
||||||
"height":20,
|
"height":20,
|
||||||
"id":1,
|
"id":1,
|
||||||
"name":"solid",
|
"name":"solid",
|
||||||
|
@ -15,7 +15,7 @@
|
||||||
"y":0
|
"y":0
|
||||||
},
|
},
|
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0, 0, 0, 0, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 163, 0, 0, 0, 0, 0, 0, 0, 0, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 163, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
||||||
"height":20,
|
"height":20,
|
||||||
"id":2,
|
"id":2,
|
||||||
"name":"conduit",
|
"name":"conduit",
|
||||||
|
@ -83,7 +83,7 @@
|
||||||
"name":"",
|
"name":"",
|
||||||
"polyline":[
|
"polyline":[
|
||||||
{
|
{
|
||||||
"x":8,
|
"x":24,
|
||||||
"y":-0.181818181818187
|
"y":-0.181818181818187
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -94,7 +94,7 @@
|
||||||
{
|
{
|
||||||
"name":"anchor2",
|
"name":"anchor2",
|
||||||
"type":"bool",
|
"type":"bool",
|
||||||
"value":false
|
"value":true
|
||||||
}],
|
}],
|
||||||
"rotation":0,
|
"rotation":0,
|
||||||
"type":"wire",
|
"type":"wire",
|
||||||
|
@ -102,6 +102,42 @@
|
||||||
"width":0,
|
"width":0,
|
||||||
"x":60,
|
"x":60,
|
||||||
"y":68.1818181818182
|
"y":68.1818181818182
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"height":0,
|
||||||
|
"id":9,
|
||||||
|
"name":"",
|
||||||
|
"point":true,
|
||||||
|
"rotation":0,
|
||||||
|
"type":"source",
|
||||||
|
"visible":true,
|
||||||
|
"width":0,
|
||||||
|
"x":4,
|
||||||
|
"y":36
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"height":0,
|
||||||
|
"id":10,
|
||||||
|
"name":"",
|
||||||
|
"point":true,
|
||||||
|
"rotation":0,
|
||||||
|
"type":"door",
|
||||||
|
"visible":true,
|
||||||
|
"width":0,
|
||||||
|
"x":148,
|
||||||
|
"y":140
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"height":0,
|
||||||
|
"id":11,
|
||||||
|
"name":"",
|
||||||
|
"point":true,
|
||||||
|
"rotation":0,
|
||||||
|
"type":"door",
|
||||||
|
"visible":true,
|
||||||
|
"width":0,
|
||||||
|
"x":76,
|
||||||
|
"y":124
|
||||||
}],
|
}],
|
||||||
"opacity":1,
|
"opacity":1,
|
||||||
"type":"objectgroup",
|
"type":"objectgroup",
|
||||||
|
@ -110,7 +146,7 @@
|
||||||
"y":0
|
"y":0
|
||||||
}],
|
}],
|
||||||
"nextlayerid":5,
|
"nextlayerid":5,
|
||||||
"nextobjectid":9,
|
"nextobjectid":12,
|
||||||
"orientation":"orthogonal",
|
"orientation":"orthogonal",
|
||||||
"renderorder":"right-down",
|
"renderorder":"right-down",
|
||||||
"tiledversion":"1.7.2",
|
"tiledversion":"1.7.2",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<map version="1.5" tiledversion="1.7.2" orientation="orthogonal" renderorder="right-down" width="20" height="20" tilewidth="8" tileheight="8" infinite="0" nextlayerid="5" nextobjectid="9">
|
<map version="1.5" tiledversion="1.7.2" orientation="orthogonal" renderorder="right-down" width="20" height="20" tilewidth="8" tileheight="8" infinite="0" nextlayerid="5" nextobjectid="12">
|
||||||
<editorsettings>
|
<editorsettings>
|
||||||
<export target="test.json" format="json"/>
|
<export target="test.json" format="json"/>
|
||||||
</editorsettings>
|
</editorsettings>
|
||||||
|
@ -18,12 +18,12 @@
|
||||||
1,39,1,1,1,1,37,54,19,19,52,1,1,1,1,1,1,1,37,1,
|
1,39,1,1,1,1,37,54,19,19,52,1,1,1,1,1,1,1,37,1,
|
||||||
1,39,1,1,1,50,67,1,1,1,1,1,1,1,1,1,1,1,37,1,
|
1,39,1,1,1,50,67,1,1,1,1,1,1,1,1,1,1,1,37,1,
|
||||||
1,39,1,1,1,1,20,1,1,1,1,1,1,1,1,1,1,1,37,1,
|
1,39,1,1,1,1,20,1,1,1,1,1,1,1,1,1,1,1,37,1,
|
||||||
1,36,52,1,1,1,20,1,1,17,19,19,19,19,19,19,18,1,37,1,
|
1,36,52,1,1,1,20,1,1,17,19,19,19,19,19,19,19,19,36,1,
|
||||||
1,39,1,1,1,1,20,1,1,20,1,1,1,1,1,1,20,1,37,1,
|
1,39,1,1,1,1,20,1,1,20,1,1,1,1,1,1,1,1,37,1,
|
||||||
1,39,1,1,1,50,67,1,1,20,1,1,1,1,1,1,20,1,37,1,
|
1,39,1,1,1,50,67,1,1,51,1,1,1,1,1,1,1,1,37,1,
|
||||||
1,39,1,1,1,1,20,1,1,20,1,1,1,1,1,1,20,1,37,1,
|
1,39,1,1,1,1,20,1,1,35,1,1,1,1,1,1,1,1,37,1,
|
||||||
54,66,52,1,1,1,51,1,1,51,1,50,19,19,19,19,34,1,33,54,
|
54,66,52,1,1,1,51,1,50,19,19,19,19,19,19,19,19,19,66,54,
|
||||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,51,1,
|
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,35,1,
|
||||||
22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,
|
22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,
|
||||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
|
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
|
||||||
</data>
|
</data>
|
||||||
|
@ -32,20 +32,20 @@
|
||||||
<data encoding="csv">
|
<data encoding="csv">
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
131,131,180,0,0,0,0,0,0,178,180,0,0,0,0,0,0,178,130,0,
|
0,129,153,0,0,0,0,0,0,154,153,0,0,0,0,0,0,154,130,0,
|
||||||
|
0,135,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,132,0,
|
||||||
|
131,146,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,132,0,
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,132,0,
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,132,0,
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,132,0,
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,132,0,
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,132,0,
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,132,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,129,153,0,0,0,0,0,0,154,179,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,132,0,0,0,0,0,0,0,0,132,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,132,0,0,0,0,0,0,0,0,132,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,132,0,0,0,0,0,0,0,0,132,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,132,0,0,0,0,0,0,0,0,132,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,132,0,0,0,0,0,0,0,0,132,0,
|
||||||
|
0,0,0,0,0,0,0,0,0,163,0,0,0,0,0,0,0,0,132,0,
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,132,0,
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,132,0,
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,132,0,
|
|
||||||
0,0,0,0,0,0,0,0,147,0,0,0,0,0,0,0,0,0,132,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,132,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,132,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,132,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,132,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,132,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,135,162,131,146,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,151,162,131,130,0,
|
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,163,0,
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,163,0,
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
@ -64,9 +64,18 @@
|
||||||
</object>
|
</object>
|
||||||
<object id="7" type="wire" x="60" y="68.1818">
|
<object id="7" type="wire" x="60" y="68.1818">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="anchor2" type="bool" value="false"/>
|
<property name="anchor2" type="bool" value="true"/>
|
||||||
</properties>
|
</properties>
|
||||||
<polyline points="8,-0.181818 80,-0.181818"/>
|
<polyline points="24,-0.181818 80,-0.181818"/>
|
||||||
|
</object>
|
||||||
|
<object id="9" type="source" x="4" y="36">
|
||||||
|
<point/>
|
||||||
|
</object>
|
||||||
|
<object id="10" type="door" x="148" y="140">
|
||||||
|
<point/>
|
||||||
|
</object>
|
||||||
|
<object id="11" type="door" x="76" y="124">
|
||||||
|
<point/>
|
||||||
</object>
|
</object>
|
||||||
</objectgroup>
|
</objectgroup>
|
||||||
</map>
|
</map>
|
||||||
|
|
BIN
assets/tiles.png
BIN
assets/tiles.png
Binary file not shown.
Before Width: | Height: | Size: 691 B After Width: | Height: | Size: 721 B |
File diff suppressed because one or more lines are too long
85
map2src.zig
85
map2src.zig
|
@ -16,10 +16,11 @@ const Object = struct {
|
||||||
height: u64 = 0,
|
height: u64 = 0,
|
||||||
id: u64 = 0,
|
id: u64 = 0,
|
||||||
name: []const u8,
|
name: []const u8,
|
||||||
polyline: []Point,
|
point: bool = false,
|
||||||
|
polyline: []Point = &.{},
|
||||||
properties: []Property = &.{},
|
properties: []Property = &.{},
|
||||||
rotation: f64 = 0,
|
rotation: f64 = 0,
|
||||||
@"type": enum { wire },
|
@"type": enum { wire, source, door },
|
||||||
visible: bool = true,
|
visible: bool = true,
|
||||||
width: u64 = 0,
|
width: u64 = 0,
|
||||||
x: f64 = 0,
|
x: f64 = 0,
|
||||||
|
@ -116,26 +117,26 @@ pub fn do() !void {
|
||||||
_ = try outlist.appendSlice(outcontent);
|
_ = try outlist.appendSlice(outcontent);
|
||||||
},
|
},
|
||||||
.objectgroup => {
|
.objectgroup => {
|
||||||
var outcontent = try std.fmt.bufPrint(&outbuffer, "pub const {s}: [{}]Wire = [_]Wire{{", .{ layer.name, layer.objects.len });
|
var wirelist = std.ArrayList(Object).init(alloc);
|
||||||
try outlist.appendSlice(outcontent);
|
defer wirelist.deinit();
|
||||||
|
|
||||||
|
var doorlist = std.ArrayList(Object).init(alloc);
|
||||||
|
defer doorlist.deinit();
|
||||||
|
|
||||||
|
var sourcelist = std.ArrayList(Object).init(alloc);
|
||||||
|
defer sourcelist.deinit();
|
||||||
|
|
||||||
for (layer.objects) |obj| {
|
for (layer.objects) |obj| {
|
||||||
try outlist.appendSlice(".{");
|
switch (obj.@"type") {
|
||||||
var a1 = true;
|
.wire => try wirelist.append(obj),
|
||||||
var a2 = true;
|
.door => try doorlist.append(obj),
|
||||||
for (obj.properties) |p| {
|
.source => try sourcelist.append(obj),
|
||||||
if (std.mem.eql(u8, p.name, "anchor1")) a1 = p.value.@"bool";
|
|
||||||
if (std.mem.eql(u8, p.name, "anchor2")) a2 = p.value.@"bool";
|
|
||||||
}
|
}
|
||||||
var of = try std.fmt.bufPrint(&outbuffer, ".a1 = {}, .a2 = {},", .{ a1, a2 });
|
|
||||||
try outlist.appendSlice(of);
|
|
||||||
for (obj.polyline) |point, i| {
|
|
||||||
var pointf = try std.fmt.bufPrint(&outbuffer, ".p{} = Vec2{{ {}, {} }},", .{ i + 1, @floatToInt(i32, obj.x + point.x), @floatToInt(i32, obj.y + point.y) });
|
|
||||||
try outlist.appendSlice(pointf);
|
|
||||||
}
|
|
||||||
try outlist.appendSlice("}, ");
|
|
||||||
}
|
}
|
||||||
try outlist.appendSlice("};\n");
|
|
||||||
|
try appendWires(&outlist, wirelist);
|
||||||
|
try appendDoors(&outlist, doorlist);
|
||||||
|
try appendSources(&outlist, sourcelist);
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -143,3 +144,51 @@ pub fn do() !void {
|
||||||
_ = try output.writeAll(outlist.items);
|
_ = try output.writeAll(outlist.items);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn appendWires(outlist: *std.ArrayList(u8), wirelist: std.ArrayList(Object)) !void {
|
||||||
|
var outbuffer: [4 * KB]u8 = undefined;
|
||||||
|
var outcontent = try std.fmt.bufPrint(&outbuffer, "pub const wire: [{}]Wire = [_]Wire{{", .{wirelist.items.len});
|
||||||
|
try outlist.appendSlice(outcontent);
|
||||||
|
|
||||||
|
for (wirelist.items) |obj| {
|
||||||
|
try outlist.appendSlice(".{");
|
||||||
|
var a1 = true;
|
||||||
|
var a2 = true;
|
||||||
|
for (obj.properties) |p| {
|
||||||
|
if (std.mem.eql(u8, p.name, "anchor1")) a1 = p.value.@"bool";
|
||||||
|
if (std.mem.eql(u8, p.name, "anchor2")) a2 = p.value.@"bool";
|
||||||
|
}
|
||||||
|
var of = try std.fmt.bufPrint(&outbuffer, ".a1 = {}, .a2 = {},", .{ a1, a2 });
|
||||||
|
try outlist.appendSlice(of);
|
||||||
|
for (obj.polyline) |point, i| {
|
||||||
|
var pointf = try std.fmt.bufPrint(&outbuffer, ".p{} = Vec2{{ {}, {} }},", .{ i + 1, @floatToInt(i32, obj.x + point.x), @floatToInt(i32, obj.y + point.y) });
|
||||||
|
try outlist.appendSlice(pointf);
|
||||||
|
}
|
||||||
|
try outlist.appendSlice("}, ");
|
||||||
|
}
|
||||||
|
try outlist.appendSlice("};\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn appendDoors(outlist: *std.ArrayList(u8), doorlist: std.ArrayList(Object)) !void {
|
||||||
|
var outbuffer: [4 * KB]u8 = undefined;
|
||||||
|
var outcontent = try std.fmt.bufPrint(&outbuffer, "pub const doors: [{}]Vec2 = [_]Vec2{{", .{doorlist.items.len});
|
||||||
|
try outlist.appendSlice(outcontent);
|
||||||
|
|
||||||
|
for (doorlist.items) |obj| {
|
||||||
|
var doorf = try std.fmt.bufPrint(&outbuffer, "Vec2{{ {}, {} }},", .{ @floatToInt(i32, @divTrunc(obj.x, 8)), @floatToInt(i32, @divTrunc(obj.y, 8)) });
|
||||||
|
try outlist.appendSlice(doorf);
|
||||||
|
}
|
||||||
|
try outlist.appendSlice("};\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn appendSources(outlist: *std.ArrayList(u8), sourcelist: std.ArrayList(Object)) !void {
|
||||||
|
var outbuffer: [4 * KB]u8 = undefined;
|
||||||
|
var outcontent = try std.fmt.bufPrint(&outbuffer, "pub const sources: [{}]Vec2 = [_]Vec2{{", .{sourcelist.items.len});
|
||||||
|
try outlist.appendSlice(outcontent);
|
||||||
|
|
||||||
|
for (sourcelist.items) |obj| {
|
||||||
|
var sourcef = try std.fmt.bufPrint(&outbuffer, "Vec2{{ {}, {} }},", .{ @floatToInt(i32, @divTrunc(obj.x, 8)), @floatToInt(i32, @divTrunc(obj.y, 8)) });
|
||||||
|
try outlist.appendSlice(sourcef);
|
||||||
|
}
|
||||||
|
try outlist.appendSlice("};\n");
|
||||||
|
}
|
||||||
|
|
24
src/main.zig
24
src/main.zig
|
@ -175,7 +175,7 @@ export fn start() void {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var indicator: ?Vec2 = null;
|
var indicator: ?struct { pos: Vec2, t: enum { wire, plug } } = null;
|
||||||
var time: usize = 0;
|
var time: usize = 0;
|
||||||
|
|
||||||
export fn update() void {
|
export fn update() void {
|
||||||
|
@ -208,7 +208,8 @@ export fn update() void {
|
||||||
|
|
||||||
world.process(1, &.{.wire}, wireDrawProcess);
|
world.process(1, &.{.wire}, wireDrawProcess);
|
||||||
|
|
||||||
if (indicator) |pos| {
|
if (indicator) |details| {
|
||||||
|
const pos = details.pos;
|
||||||
const stage = @divTrunc((time % 60), 30);
|
const stage = @divTrunc((time % 60), 30);
|
||||||
var size = Vec2{ 0, 0 };
|
var size = Vec2{ 0, 0 };
|
||||||
switch (stage) {
|
switch (stage) {
|
||||||
|
@ -220,7 +221,10 @@ export fn update() void {
|
||||||
w4.DRAW_COLORS.* = 0x0020;
|
w4.DRAW_COLORS.* = 0x0020;
|
||||||
var half = Vec2{ @divTrunc(size[0], 2), @divTrunc(size[1], 2) };
|
var half = Vec2{ @divTrunc(size[0], 2), @divTrunc(size[1], 2) };
|
||||||
// w4.trace("{}", .{half});
|
// w4.trace("{}", .{half});
|
||||||
w4.oval(pos - half, size);
|
switch (details.t) {
|
||||||
|
.wire => w4.oval(pos - half, size),
|
||||||
|
.plug => w4.rect(pos - half, size),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
indicator = null;
|
indicator = null;
|
||||||
|
@ -229,7 +233,7 @@ export fn update() void {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_plug(tile: u8) bool {
|
fn is_plug(tile: u8) bool {
|
||||||
return tile == 177 or tile == 178 or tile == 179 or tile == 180 or tile == 147;
|
return (tile >= 149 and tile <= 153) or tile == 147;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// pos should be in tile coordinates, not world coordinates
|
/// pos should be in tile coordinates, not world coordinates
|
||||||
|
@ -259,7 +263,7 @@ fn wireManipulationProcess(_: f32, id: usize, pos: *Pos, control: *Control) void
|
||||||
var length = wireLength(wire);
|
var length = wireLength(wire);
|
||||||
|
|
||||||
if (length > maxLength * 1.5) {
|
if (length > maxLength * 1.5) {
|
||||||
nodes[details.which].pinned = false; // = pos.pos + Vec2f{ 0, -4 };
|
nodes[details.which].pinned = false;
|
||||||
control.grabbing = null;
|
control.grabbing = null;
|
||||||
world.set(details.id, e);
|
world.set(details.id, e);
|
||||||
return;
|
return;
|
||||||
|
@ -269,11 +273,11 @@ fn wireManipulationProcess(_: f32, id: usize, pos: *Pos, control: *Control) void
|
||||||
|
|
||||||
var mapPos = vec2ftovec2((pos.pos + offset) / @splat(2, @as(f32, 8)));
|
var mapPos = vec2ftovec2((pos.pos + offset) / @splat(2, @as(f32, 8)));
|
||||||
if (is_plug(get_conduit(mapPos) orelse 0)) {
|
if (is_plug(get_conduit(mapPos) orelse 0)) {
|
||||||
indicator = mapPos * @splat(2, @as(i32, 8)) + Vec2{ 4, 4 };
|
indicator = .{ .t = .plug, .pos = mapPos * @splat(2, @as(i32, 8)) + Vec2{ 4, 4 } };
|
||||||
if (input.btnp(.one, .two)) {
|
if (input.btnp(.one, .two)) {
|
||||||
e.wire.?.nodes.slice()[details.which].pinned = true;
|
e.wire.?.nodes.slice()[details.which].pinned = true;
|
||||||
e.wire.?.nodes.slice()[details.which].pos = vec2tovec2f(indicator.?);
|
e.wire.?.nodes.slice()[details.which].pos = vec2tovec2f(indicator.?.pos);
|
||||||
e.wire.?.nodes.slice()[details.which].last = vec2tovec2f(indicator.?);
|
e.wire.?.nodes.slice()[details.which].last = vec2tovec2f(indicator.?.pos);
|
||||||
control.grabbing = null;
|
control.grabbing = null;
|
||||||
}
|
}
|
||||||
} else if (input.btnp(.one, .two)) {
|
} else if (input.btnp(.one, .two)) {
|
||||||
|
@ -297,12 +301,12 @@ fn wireManipulationProcess(_: f32, id: usize, pos: *Pos, control: *Control) void
|
||||||
var endDist = distancef(end, pos.pos + offset);
|
var endDist = distancef(end, pos.pos + offset);
|
||||||
if (beginDist < minDistance) {
|
if (beginDist < minDistance) {
|
||||||
minDistance = beginDist;
|
minDistance = beginDist;
|
||||||
indicator = vec2ftovec2(begin);
|
indicator = .{ .t = .wire, .pos = vec2ftovec2(begin) };
|
||||||
interactWireID = entityID;
|
interactWireID = entityID;
|
||||||
which = 0;
|
which = 0;
|
||||||
} else if (endDist < minDistance) {
|
} else if (endDist < minDistance) {
|
||||||
minDistance = endDist;
|
minDistance = endDist;
|
||||||
indicator = vec2ftovec2(end);
|
indicator = .{ .t = .wire, .pos = vec2ftovec2(end) };
|
||||||
interactWireID = entityID;
|
interactWireID = entityID;
|
||||||
which = wire.nodes.len - 1;
|
which = wire.nodes.len - 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue