more crash fixes

This commit is contained in:
Starbeamrainbowlabs 2022-09-19 19:42:22 +01:00
parent 6c8ce90593
commit d9877b8c6c
Signed by: sbrl
GPG Key ID: 1BE5172E637709C2
8 changed files with 16 additions and 14 deletions

View File

@ -1,5 +1,5 @@
local wea = worldeditadditions
local wea_c = worldeditadditions
local wea_c = worldeditadditions_core
local Vector3 = wea_c.Vector3
--- Returns a smooth gaussian brush.

View File

@ -23,8 +23,8 @@ end
-- @param pos1 Vector3 Position 1
-- @param pos2 Vector3 Position 2
function worldeditadditions.spush(name, pos1, pos2)
pos1 = Vector3.clon(pos1)
pos2 = Vector3.clon(pos2)
pos1 = Vector3.clone(pos1)
pos2 = Vector3.clone(pos2)
if not worldeditadditions.sstack[name] then
worldeditadditions.sstack[name] = {}
end

View File

@ -81,7 +81,7 @@ local function subdivide_step_beforeload(state)
state.times.emerge_last = wea_c.get_ms_time()
-- print("[BEFORE_EMERGE] c1", state.cpos1, "c2", state.cpos2, "volume", worldedit.volume(state.cpos1, state.cpos2))
worldeditadditions.emerge_area(state.cpos1, state.cpos2, state.__afterload, state)
wea_c.emerge_area(state.cpos1, state.cpos2, state.__afterload, state)
end
local function subdivide_step_afterload(state_emerge, state_ours)

View File

@ -1,4 +1,4 @@
local wea_c = worldeditadditions
local wea_c = worldeditadditions_core
local Vector3 = wea_c.Vector3
-- ███████ ██████ ██████ ███████ ███████ ████████

View File

@ -1,5 +1,5 @@
local wea_c = worldeditadditions_core
local v3 = wea_c.Vector3
local Vector3 = wea_c.Vector3
-- ███ ███ ████████ ██████ ██ ██████
@ -19,8 +19,8 @@ worldeditadditions_core.register_command("mtrig", {
func = function(name, params_text)
local str = "The measurements of the line from pos1 to pos2 are Length (D): "
local pos1 = v3.new(worldedit.pos2[name])
local pos2 = v3.new(worldedit.pos1[name])
local pos1 = Vector3.clone(worldedit.pos2[name])
local pos2 = Vector3.clone(worldedit.pos1[name])
local vec = (pos2 - pos1):abs()
local len = vec:length()

View File

@ -59,7 +59,7 @@ worldeditadditions_core.register_command("airapply", {
local success, stats_time = worldeditadditions.airapply(
pos1, pos2,
function()
cmd.func(name, table.unpack(args_parsed))
cmd.func(name, wea_c.table.unpack(args_parsed))
end
)
if not success then return success, stats_time end

View File

@ -1,6 +1,8 @@
local wea_c = worldeditadditions_core
--- Uncomment these 2 lines to run in standalone mode
-- worldeditadditions = { parse = { } }
-- function worldeditadditions.trim(str) return (str:gsub("^%s*(.-)%s*$", "%1")) end
-- function wea_c.trim(str) return (str:gsub("^%s*(.-)%s*$", "%1")) end
--- The main tokeniser. Splits the input string up into space separated tokens, except when said spaces are inside { curly braces }.
@ -73,7 +75,7 @@ local function recombine(parts)
local result = {}
local acc = {}
for i, value in ipairs(parts) do
value = worldeditadditions.trim(value)
value = wea_c.trim(value)
if value:sub(1, 1) == "/" and #acc > 0 then
table.insert(result, table.concat(acc, " "))
acc = {}
@ -116,7 +118,7 @@ end
-- end
--
-- local function test_input(input)
-- local success, result = worldeditadditions.parse.tokenise_commands(input)
-- local success, result = wea_c.parse.tokenise_commands(input)
-- if success then
-- printparts(result)
--

View File

@ -1,4 +1,4 @@
local wea_c = worldeditadditions_core
--- Parses a list of strings as a list of weighted nodes - e.g. like in
-- the //mix command. Example: "dirt 5 stone sand 2".
-- @param parts string[] The list of strings to parse (try worldeditadditions_core.split)
@ -27,7 +27,7 @@ local function parse_weighted_nodes(parts, as_list, func_normalise)
mode = MODE_EITHER
elseif mode == MODE_EITHER then
-- print("mode: either");
local chance = worldeditadditions.parse.chance(part, "weight")
local chance = wea_c.parse.chance(part, "weight")
if not chance then
-- print("not a chance, trying a node name")
local node_name