Add custom operators (Part 1)

This commit is contained in:
Jean-Patrick Guerrero
2021-11-28 23:55:11 +01:00
parent b3f1cf255d
commit 34548d8509
9 changed files with 191 additions and 87 deletions

View File

@ -103,7 +103,7 @@ local function search(data)
temp[item] = true
end
j = j + 1
j++
end
end
else
@ -122,7 +122,7 @@ local function search(data)
end
if to_add then
c = c + 1
c++
filtered_list[c] = item
end
end
@ -150,7 +150,7 @@ local function table_merge(t1, t2, hash)
local c = #t1
for i = 1, #t2 do
c = c + 1
c++
t1[c] = t2[i]
end
end
@ -176,7 +176,7 @@ local function array_diff(t1, t2)
for i = 1, #t1 do
local v = t1[i]
if hash[v] then
c = c + 1
c++
diff[c] = v
end
end
@ -377,7 +377,7 @@ local function craft_stack(player, data, craft_rcp)
if item == _name and remaining > 0 then
local c = min(remaining, _count)
items[item] = c
remaining = remaining - c
remaining -= c
end
if remaining == 0 then break end
@ -398,7 +398,7 @@ local function craft_stack(player, data, craft_rcp)
local c = min(stackmax, leftover)
local stack = ItemStack(fmt("%s %s", stackname, c))
get_stack(player, stack)
leftover = leftover - stackmax
leftover -= stackmax
end
end
@ -414,7 +414,7 @@ local function safe_teleport(player, pos)
player:add_velocity(vec_mul(vel, -1))
local p = vec_new(pos)
p.y = p.y + 0.25
p.y += 0.25
player:set_pos(p)
end
@ -486,7 +486,7 @@ local function compress_items(list, start_i)
insert(special, stack)
else
hash[name] = hash[name] or 0
hash[name] = hash[name] + count
hash[name] += count
end
end
end
@ -498,7 +498,7 @@ local function compress_items(list, start_i)
for _ = 1, iter do
insert(new_inv, ItemStack(fmt("%s %u", name, min(stackmax, leftover))))
leftover = leftover - stackmax
leftover -= stackmax
end
end