Okay now it's starting to work

This commit is contained in:
jordan4ibanez 2023-11-13 04:22:07 -05:00
parent 0a698f7194
commit 573ca90422
5 changed files with 47 additions and 2677 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,11 @@
local ____lualib = require("lualib_bundle")
local __TS__ArrayForEach = ____lualib.__TS__ArrayForEach
local Map = ____lualib.Map
utility = utility or ({})
do
local function concat(self, ...)
-- Lua Library inline imports
local function __TS__ArrayForEach(self, callbackFn, thisArg)
for i = 1, #self do
callbackFn(thisArg, self[i], i - 1, self)
end
end
-- End of Lua Library inline imports
function concat(...)
local input = {...}
local accumulator = ""
__TS__ArrayForEach(
@ -14,7 +16,7 @@ do
)
return accumulator
end
local function generateSchematic(self, size, keys, forcePlace, data, ySliceProb)
function generateSchematic(size, keys, forcePlace, data, ySliceProb)
local newSchematic = {size = size, data = {}, yslice_prob = {}}
local length = #data
local countDown = length
@ -22,21 +24,14 @@ do
local i = 1
while i <= length do
local databit = string.sub(data, countDown, countDown)
table.insert(
newSchematic.data,
{
name = keys:get(databit),
forcePlace = forcePlace:get(databit)
}
)
table.insert(newSchematic.data, {name = keys[databit], force_place = forcePlace[databit] == true})
print(forcePlace[databit] == true)
countDown = countDown - 1
i = i + 1
end
end
for databit in pairs(ipairs(ySliceProb)) do
for ____, databit in ipairs(ySliceProb) do
table.insert(newSchematic.yslice_prob, {prob = databit})
end
local ____ = ItemStack
return newSchematic
end
end

View File

@ -1,4 +1,4 @@
module utility {
// module utility {
function concat(...input: string[]): string {
let accumulator = ""
input.forEach((val: string) => {
@ -7,7 +7,7 @@ module utility {
return accumulator
}
function generateSchematic(size: Vec3, keys: Map<string, string>, forcePlace: Map<string, boolean>, data: string, ySliceProb: number[]): SchematicDefinition {
function generateSchematic(size: Vec3, keys: {[id: string] : string}, forcePlace: {[id: string] : boolean}, data: string, ySliceProb: number[]): SchematicDefinition {
let newSchematic = {
size: size,
@ -20,18 +20,17 @@ module utility {
for (let i = 1; i <= length; i++ ) {
const databit = string.sub(data, countDown, countDown)
table.insert(newSchematic.data, {
name: keys.get(databit),
forcePlace: forcePlace.get(databit)
name: keys[databit],
force_place: forcePlace[databit] == true
})
print(forcePlace[databit] == true)
countDown -= 1
}
for (const databit in ipairs(ySliceProb)) {
for (const databit of ySliceProb) {
table.insert(newSchematic.yslice_prob, {prob: databit})
}
ItemStack
return newSchematic
}
}
// }

View File

@ -39,7 +39,7 @@ do
})
end
local small_oak = generate_schematic(
local small_oak = generateSchematic(
vector.new(5, 5, 5),
{
[" "] = "air",
@ -89,7 +89,7 @@ concat(
})
local medium_oak = generate_schematic(
local medium_oak = generateSchematic(
vector.new(7, 7, 7),
{
[" "] = "air",
@ -167,7 +167,7 @@ concat(
local large_oak = generate_schematic(
local large_oak = generateSchematic(
vector.new(9, 9, 9),
{
[" "] = "air",

View File

@ -23,8 +23,9 @@
"luaTarget": "JIT",
"noHeader": true,
"noImplicitSelf": true,
// "noImplicitGlobalVariables": false,
// "sourceMapTraceback": true
// "luaLibImport": "inline"
"luaLibImport": "inline"
}
}