mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-13 23:11:49 +00:00
Merge branch 'main' into fix-assets-pipeline
This commit is contained in:
commit
b9b8c6b7da
259 changed files with 5368 additions and 2080 deletions
|
|
@ -17,7 +17,7 @@
|
|||
color="#FFFFFF80" size="16" pos="4,6"
|
||||
hover-color="#1080FF"></image>
|
||||
<panel orientation="horizontal" gravity="top-right"
|
||||
size="76,24" padding="8" interval="8" color="0">
|
||||
size="76,24" padding="8,6,8,2" interval="8" color="0">
|
||||
<image id="saveIcon" src="gui/save" tooltip="@Save"
|
||||
enabled="false" interactive="true"
|
||||
hover-color="#1080FF"
|
||||
|
|
@ -31,6 +31,12 @@
|
|||
hover-color="#1080FF"
|
||||
onclick="run_current_file()"
|
||||
color="#FFFFFF80" size="16"></image>
|
||||
<!-- TODO: remove after 0.32-->
|
||||
<image src="gui/item" size="16"
|
||||
enabled="true" interactive="true"
|
||||
hover-color="#1080FF"
|
||||
tooltip="Fix old VCM regions (0.31 bug)"
|
||||
onclick="fix_vcm_regions()"></image>
|
||||
</panel>
|
||||
<label id="title" pos="26,8"></label>
|
||||
</container>
|
||||
|
|
|
|||
|
|
@ -113,6 +113,78 @@ local function reload_model(filename, name)
|
|||
assets.parse_model(file.ext(filename), document.editor.text, name)
|
||||
end
|
||||
|
||||
-- === TODO: remove after 0.32 ===
|
||||
local pattern =
|
||||
"region %(%s*"
|
||||
.. "([+-]?%d+%.?%d*[eE]?[+-]?%d*)%s*,%s*"
|
||||
.. "([+-]?%d+%.?%d*[eE]?[+-]?%d*)%s*,%s*"
|
||||
.. "([+-]?%d+%.?%d*[eE]?[+-]?%d*)%s*,%s*"
|
||||
.. "([+-]?%d+%.?%d*[eE]?[+-]?%d*)"
|
||||
.. "%s*%)"
|
||||
|
||||
local function replace1(x1, y1, x2, y2)
|
||||
return string.format("region (%s, %s, %s, %s)", x2, y2, x1, y1)
|
||||
end
|
||||
|
||||
local function replace2(x1, y1, x2, y2)
|
||||
return string.format("region (%s, %s, %s, %s)", x2, y1, x1, y2)
|
||||
end
|
||||
|
||||
function convert_vcm(text)
|
||||
local lines = {}
|
||||
local zpairs = {
|
||||
{"%(north%)", "%(south%)", "(TMPS)", "(TMPN)"},
|
||||
{"%,north", "%,south", ",TMPS", ",TMPN"},
|
||||
{"north%,", "south%,", "TMPS,", "TMPN,"},
|
||||
}
|
||||
local xpairs = {
|
||||
{"%(west%)", "%(east%)", "(TMPE)", "(TMPW)"},
|
||||
{"%,west", "%,east", ",TMPE", ",TMPW"},
|
||||
{"west%,", "east%,", "TMPE,", "TMPW,"},
|
||||
}
|
||||
|
||||
for i, pair in ipairs(zpairs) do
|
||||
text = text:gsub(pair[1], pair[3])
|
||||
text = text:gsub(pair[2], pair[4])
|
||||
end
|
||||
text = text:gsub("TMPS", "south")
|
||||
text = text:gsub("TMPN", "north")
|
||||
|
||||
for i, pair in ipairs(xpairs) do
|
||||
text = text:gsub(pair[1], pair[3])
|
||||
text = text:gsub(pair[2], pair[4])
|
||||
end
|
||||
text = text:gsub("TMPW", "west")
|
||||
text = text:gsub("TMPE", "east")
|
||||
|
||||
for line in text:gmatch("[^\n]*\n?") do
|
||||
if line == "" then
|
||||
break
|
||||
end
|
||||
|
||||
if line:find("(top)", 1, true) then
|
||||
line = line:gsub(pattern, replace1)
|
||||
end
|
||||
|
||||
if line:find("(bottom)", 1, true)
|
||||
or line:find("(east)", 1, true) then
|
||||
line = line:gsub(pattern, replace2)
|
||||
end
|
||||
|
||||
table.insert(lines, line)
|
||||
end
|
||||
|
||||
return table.concat(lines)
|
||||
end
|
||||
|
||||
function fix_vcm_regions()
|
||||
if not current_file.filename then
|
||||
return
|
||||
end
|
||||
document.editor.text = convert_vcm(document.editor.text)
|
||||
end
|
||||
-- ===============================
|
||||
|
||||
function run_current_file()
|
||||
if not current_file.filename then
|
||||
return
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ local function update_line(line, uptime)
|
|||
end
|
||||
end
|
||||
|
||||
events.on("core:chat", function(message)
|
||||
local core_chat_handler = events.on("core:chat", function(message)
|
||||
while #lines >= max_lines do
|
||||
document[lines[1][1]]:destruct()
|
||||
table.remove(lines, 1)
|
||||
|
|
@ -36,7 +36,7 @@ end)
|
|||
function on_open()
|
||||
if not initialized then
|
||||
initialized = true
|
||||
|
||||
|
||||
document.root:setInterval(1/animation_fps * 1000, function ()
|
||||
local uptime = time.uptime()
|
||||
for _, line in ipairs(lines) do
|
||||
|
|
@ -52,3 +52,7 @@ function on_open()
|
|||
end)
|
||||
end
|
||||
end
|
||||
|
||||
function on_destroy()
|
||||
events.remove("core:chat", core_chat_handler)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<inventory>
|
||||
<slots-grid pos="0, 164" rows="1" count="10" sharefunc="inventory_share_func"/>
|
||||
<slots-grid rows="3" start-index="10" count="30" sharefunc="inventory_share_func"/>
|
||||
<slots-grid pos="0, 164" rows="1" count="10" sharefunc="share_func"/>
|
||||
<slots-grid rows="3" start-index="10" count="30" sharefunc="share_func"/>
|
||||
</inventory>
|
||||
|
|
|
|||
|
|
@ -1,12 +1 @@
|
|||
function inventory_share_func(invid, slotid)
|
||||
local blockinv = hud.get_block_inventory()
|
||||
if blockinv ~= 0 then
|
||||
inventory.move(invid, slotid, blockinv)
|
||||
elseif rules.get("allow-content-access") then
|
||||
inventory.set(invid, slotid, 0, 0)
|
||||
elseif slotid < 10 then
|
||||
inventory.move_range(invid, slotid, invid, 10)
|
||||
else
|
||||
inventory.move_range(invid, slotid, invid, 0, 9)
|
||||
end
|
||||
end
|
||||
share_func = require("core:inventory_utils").share_default_func
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ function on_open(params)
|
|||
mode = params.mode
|
||||
end
|
||||
refresh()
|
||||
document.search_textbox.focused = true
|
||||
end
|
||||
|
||||
-- add - packs to be added to the world (after apply)
|
||||
|
|
@ -178,40 +179,40 @@ function place_pack(panel, packinfo, callback, position_func)
|
|||
end
|
||||
end
|
||||
|
||||
local Version = {};
|
||||
local Version = {}
|
||||
|
||||
function Version.matches_pattern(version)
|
||||
for _, letter in string.gmatch(version, "%.+") do
|
||||
if type(letter) ~= "number" or letter ~= "." then
|
||||
return false;
|
||||
end
|
||||
local t = string.split(version, ".")
|
||||
if #t ~= 2 and #t ~= 3 then return false end
|
||||
|
||||
local t = string.split(version, ".");
|
||||
|
||||
return #t == 2 or #t == 3;
|
||||
for i = 1, #t do
|
||||
local matched = string.match(t[i], "^%d+$")
|
||||
if not matched then return false end
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
function Version.__equal(ver1, ver2)
|
||||
return ver1[1] == ver2[1] and ver1[2] == ver2[2] and ver1[3] == ver2[3];
|
||||
return ver1[1] == ver2[1] and ver1[2] == ver2[2] and ver1[3] == ver2[3]
|
||||
end
|
||||
|
||||
function Version.__greater(ver1, ver2)
|
||||
if ver1[1] ~= ver2[1] then return ver1[1] > ver2[1] end;
|
||||
if ver1[2] ~= ver2[2] then return ver1[2] > ver2[2] end;
|
||||
return ver1[3] > ver2[3];
|
||||
if ver1[1] ~= ver2[1] then return ver1[1] > ver2[1] end
|
||||
if ver1[2] ~= ver2[2] then return ver1[2] > ver2[2] end
|
||||
return ver1[3] > ver2[3]
|
||||
end
|
||||
|
||||
function Version.__less(ver1, ver2)
|
||||
return Version.__greater(ver2, ver1);
|
||||
return Version.__greater(ver2, ver1)
|
||||
end
|
||||
|
||||
function Version.__greater_or_equal(ver1, ver2)
|
||||
return not Version.__less(ver1, ver2);
|
||||
return not Version.__less(ver2, ver1)
|
||||
end
|
||||
|
||||
function Version.__less_or_equal(ver1, ver2)
|
||||
return not Version.__greater(ver1, ver2);
|
||||
return not Version.__greater(ver1, ver2)
|
||||
end
|
||||
|
||||
Version.operators = {
|
||||
|
|
@ -223,40 +224,39 @@ Version.operators = {
|
|||
}
|
||||
|
||||
function Version.compare(op, ver1, ver2)
|
||||
ver1 = string.split(ver1, ".");
|
||||
ver2 = string.split(ver2, ".");
|
||||
ver1 = string.split(ver1, ".")
|
||||
ver2 = string.split(ver2, ".")
|
||||
|
||||
local comparison_func = Version.operators[op];
|
||||
|
||||
if comparison_func then
|
||||
return comparison_func(ver1, ver2);
|
||||
return comparison_func(ver1, ver2)
|
||||
else
|
||||
return false;
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
function Version.parse(version)
|
||||
local op = string.sub(version, 1, 2);
|
||||
local op = string.sub(version, 1, 2)
|
||||
if op == ">=" or op == "<=" then
|
||||
return op, string.sub(version, #op + 1);
|
||||
return op, string.sub(version, #op + 1)
|
||||
end
|
||||
|
||||
op = string.sub(version, 1, 1);
|
||||
if op == ">" or op == "<" then
|
||||
return op, string.sub(version, #op + 1);
|
||||
return op, string.sub(version, #op + 1)
|
||||
end
|
||||
|
||||
return "=", version;
|
||||
return "=", version
|
||||
end
|
||||
|
||||
local function compare_version(dependent_version, actual_version)
|
||||
local function compare_version(op, dependent_version, actual_version)
|
||||
if Version.matches_pattern(dependent_version) and Version.matches_pattern(actual_version) then
|
||||
local op, dep_ver = Version.parse_version(dependent_version);
|
||||
Version.compare(op, dep_ver, actual_version);
|
||||
return Version.compare(op, dep_ver, actual_version)
|
||||
elseif dependent_version == "*" or dependent_version == actual_version then
|
||||
return true;
|
||||
return true
|
||||
else
|
||||
return false;
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -276,15 +276,15 @@ function check_dependencies(packinfo)
|
|||
)
|
||||
end
|
||||
|
||||
local dep_pack = pack.get_info(depid);
|
||||
|
||||
if not compare_version(depver, dep_pack.version) then
|
||||
local op, ver = Version.parse(depver)
|
||||
local dep_pack = pack.get_info(depid)
|
||||
local op, ver = Version.parse(depver)
|
||||
|
||||
if not compare_version(op, ver, dep_pack.version) then
|
||||
return string.format(
|
||||
"%s: %s != %s (%s)",
|
||||
gui.str("error.dependency-version-not-met"),
|
||||
dep_pack.version, ver, depid
|
||||
);
|
||||
)
|
||||
end
|
||||
|
||||
if table.has(packs_installed, packinfo.id) then
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
@World generator
|
||||
</button>
|
||||
<button id='content_btn' onclick='save_state() menu.page="content"'/>
|
||||
<button onclick='create_world()' margin='1,20,1,1'>
|
||||
<button onclick='create_world()' margin='0,20,0,1'>
|
||||
@Create World
|
||||
</button>
|
||||
<button onclick='menu:back()'>@Back</button>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<container id='pack_%{id}' onclick='%{callback}' size='0,80' color='#00000040' hover-color='#00000080' position-func="%{position_func}" z-index="%{index}">
|
||||
<label color='#FFFFFF80' size='300,25' align='right' gravity='top-right'>
|
||||
[%{id_verbose}]
|
||||
<label color='#FFFFFF80' size='340,25' align='right' gravity='top-right'>
|
||||
[%{id_verbose} %{version}]
|
||||
</label>
|
||||
<label pos='78,6'>%{title}</label>
|
||||
<label if='%{creator}' color='#CCFFE5B2' size='300,20' align='right'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue