Merge remote-tracking branch 'upstream/main'

This commit is contained in:
Xertis
2025-02-19 23:14:23 +03:00
178 changed files with 3385 additions and 1945 deletions
+1
View File
@@ -1 +1,2 @@
generator = "core:default"
player-entity = ""
@@ -1,5 +1,6 @@
{
"steps-sound": "steps/grass",
"place-sound": "blocks/ground_place",
"break-sound": "blocks/ground_break"
"break-sound": "blocks/ground_break",
"hit-sound": "blocks/ground_hit"
}
+2 -1
View File
@@ -1,5 +1,6 @@
{
"steps-sound": "steps/ground",
"place-sound": "blocks/ground_place",
"break-sound": "blocks/ground_break"
"break-sound": "blocks/ground_break",
"hit-sound": "blocks/ground_hit"
}
+2 -1
View File
@@ -1,5 +1,6 @@
{
"steps-sound": "steps/stone",
"place-sound": "blocks/stone_place",
"break-sound": "blocks/stone_break"
"break-sound": "blocks/stone_break",
"hit-sound": "blocks/stone_hit"
}
+2 -1
View File
@@ -1,5 +1,6 @@
{
"steps-sound": "steps/wood",
"place-sound": "blocks/wood_place",
"break-sound": "blocks/wood_break"
"break-sound": "blocks/wood_break",
"hit-sound": "blocks/wood_hit"
}
+1 -1
View File
@@ -2,5 +2,5 @@
"texture": "dirt",
"material": "base:ground",
"surface-replacement": "base:grass_block",
"base:durability": 1.0
"base:durability": 1.5
}
+1 -1
View File
@@ -8,7 +8,7 @@
"replaceable": true,
"grounded": true,
"model": "X",
"hitbox": [0.15, 0.0, 0.15, 0.7, 0.7, 0.7],
"hitbox": [0.15, 0.0, 0.15, 0.7, 0.5, 0.7],
"base:durability": 0.0,
"base:loot": []
}
+1 -1
View File
@@ -8,7 +8,7 @@
"grass_side",
"grass_side"
],
"base:durability": 1.3,
"base:durability": 1.7,
"base:loot": [
{"item": "base:dirt.item"}
]
+1
View File
@@ -1 +1,2 @@
generator = "base:demo"
player-entity = "base:player"
@@ -1,7 +1,30 @@
local _, dir = parse_path(__DIR__)
local ores = require "base:generation/ores"
math.randomseed(SEED)
ores.load(dir)
local function get_rand(seed, x, y, z)
local h = bit.bxor(bit.bor(x * 23729, y % 16786), y * x + seed)
h = bit.bxor(h, z * 47917)
h = bit.bxor(h, bit.bor(z % 12345, x + y))
local n = (h % 10000) / 10000.0
return n
end
local function gen_parameters(size, seed, x, y)
local res = {}
local rand = 0
for i=1, size do
rand = get_rand(seed, x, y, rand)
table.insert(res, rand)
end
return res
end
function place_structures(x, z, w, d, hmap, chunk_height)
local placements = {}
ores.place(placements, x, z, w, d, SEED, hmap, chunk_height)
@@ -10,15 +33,17 @@ end
function place_structures_wide(x, z, w, d, chunk_height)
local placements = {}
if math.random() < 0.05 then -- generate caves
local sx = x + math.random() * 10 - 5
local sy = math.random() * (chunk_height / 4) + 10
local sz = z + math.random() * 10 - 5
local rands = gen_parameters(11, SEED, x, z)
if rands[1] < 0.05 then -- generate caves
local dir = math.random() * math.pi * 2
local dir_inertia = (math.random() - 0.5) * 2
local sx = x + rands[2] * 10 - 5
local sy = rands[3] * (chunk_height / 4) + 10
local sz = z + rands[4] * 10 - 5
local dir = rands[5] * math.pi * 2
local dir_inertia = (rands[6] - 0.5) * 2
local elevation = -3
local width = math.random() * 3 + 2
local width = rands[7] * 3 + 2
for i=1,18 do
local dx = math.sin(dir) * 10
@@ -34,11 +59,11 @@ function place_structures_wide(x, z, w, d, chunk_height)
sx = ex
sy = ey
sz = ez
dir_inertia = dir_inertia * 0.8 +
(math.random() - 0.5) * math.pow(math.random(), 2) * 8
(rands[8] - 0.5) * math.pow(rands[9], 2) * 8
elevation = elevation * 0.9 +
(math.random() - 0.4) * (1.0-math.pow(math.random(), 4)) * 8
(rands[10] - 0.4) * (1.0-math.pow(rands[11], 4)) * 8
dir = dir + dir_inertia
end
end
+2 -1
View File
@@ -1,4 +1,5 @@
{
"icon-type": "sprite",
"icon": "items:bazalt_breaker"
"icon": "items:bazalt_breaker",
"uses": 100
}
+2 -1
View File
@@ -1,12 +1,13 @@
local util = {}
function util.drop(ppos, itemid, count, pickup_delay)
function util.drop(ppos, itemid, count, data, pickup_delay)
if itemid == 0 or not itemid then
return nil
end
return entities.spawn("base:drop", ppos, {base__drop={
id=itemid,
count=count,
data=data,
pickup_delay=pickup_delay
}})
end
+1 -1
View File
@@ -1,6 +1,6 @@
{
"id": "base",
"title": "Base",
"version": "0.26",
"version": "0.27",
"description": "basic content package"
}
+4 -1
View File
@@ -1,3 +1,6 @@
function on_block_break_by(x, y, z, p)
function on_block_break_by(x, y, z, pid)
block.set(x, y, z, 0, 0)
if not player.is_infinite_items(pid) then
inventory.use(player.get_inventory(pid))
end
end
+42 -17
View File
@@ -6,13 +6,15 @@ inair = true
target = -1
timer = 0.3
local dropitem = ARGS
local def_index = entity:def_index()
dropitem = ARGS
if dropitem then
timer = dropitem.pickup_delay or timer
end
if SAVED_DATA.item then
dropitem.id = item.index(SAVED_DATA.item)
dropitem.count = SAVED_DATA.count
dropitem.data = SAVED_DATA.data
end
local DROP_SCALE = 0.3
@@ -24,6 +26,7 @@ local rotation = mat4.rotate({
function on_save()
SAVED_DATA.item = item.name(dropitem.id)
SAVED_DATA.count = dropitem.count
SAVED_DATA.data = dropitem.data
end
do -- setup visuals
@@ -38,7 +41,7 @@ end
function on_grounded(force)
local matrix = mat4.idt()
mat4.rotate(matrix, {0, 1, 0}, math.random()*360, matrix)
mat4.rotate(matrix, {0, 1, 0}, math.random() * 360, matrix)
mat4.rotate(matrix, {1, 0, 0}, 90, matrix)
mat4.scale(matrix, scale, matrix)
rig:set_matrix(0, matrix)
@@ -50,14 +53,33 @@ function on_fall()
end
function on_sensor_enter(index, oid)
local playerid = hud.get_player()
local playerentity = player.get_entity(playerid)
if timer < 0.0 and oid == playerentity and index == 0 then
entity:despawn()
inventory.add(player.get_inventory(playerid), dropitem.id, dropitem.count)
audio.play_sound_2d("events/pickup", 0.5, 0.8+math.random()*0.4, "regular")
local other = entities.get(oid)
if not other then
return
end
if index == 1 and oid == playerentity then
local pid = other:get_player()
if pid == -1 then
-- other is base:drop too
if index == 0 and other:def_index() == def_index then
local odrop = other:get_component("base:drop").dropitem
if odrop.id == dropitem.id and not odrop.data then
local stack = item.stack_size(dropitem.id)
local sum = dropitem.count + odrop.count
if sum <= stack then
dropitem.count = sum
other:despawn()
end
end
end
return
end
if timer < 0.0 and index == 0 then
entity:despawn()
inventory.add(player.get_inventory(pid), dropitem.id, dropitem.count, dropitem.data)
audio.play_sound_2d("events/pickup", 0.5, 0.8 + math.random() * 0.4, "regular")
end
if index == 1 then
target = oid
end
end
@@ -84,15 +106,18 @@ end
function on_update(tps)
timer = timer - 1.0/tps
if target ~= -1 then
if timer > 0.0 then
return
end
local dir = vec3.sub(entities.get(target).transform:get_pos(), tsf:get_pos())
vec3.normalize(dir, dir)
vec3.mul(dir, 10.0, dir)
body:set_vel(dir)
if timer > 0.0 or target == -1 then
return
end
local target_entity = entities.get(target)
if not target_entity then
return
end
local dir = vec3.sub(target_entity.transform:get_pos(), tsf:get_pos())
vec3.normalize(dir, dir)
vec3.mul(dir, 10.0, dir)
body:set_vel(dir)
end
function on_attacked(attacker, pid)
@@ -19,7 +19,7 @@ function on_render()
return
end
local rx, ry, rz = player.get_rot(pid, true)
local rx, ry, rz = player.get_rot(pid, pid ~= hud.get_player())
rig:set_matrix(headIndex, mat4.rotate({1, 0, 0}, ry))
rig:set_matrix(bodyIndex, mat4.rotate({0, 1, 0}, rx))
+2 -1
View File
@@ -14,12 +14,13 @@ function on_hud_open()
if itemid == 0 then
return
end
local data = inventory.get_all_data(invid, slot)
inventory.set(invid, slot, itemid, itemcount-1)
local pvel = {player.get_vel(pid)}
local ppos = vec3.add({player.get_pos(pid)}, {0, 0.7, 0})
local throw_force = vec3.mul(player.get_dir(pid), DROP_FORCE)
local drop = base_util.drop(ppos, itemid, 1, 1.5)
local drop = base_util.drop(ppos, itemid, 1, data, 1.5)
local velocity = vec3.add(throw_force, vec3.add(pvel, DROP_INIT_VEL))
drop.rigidbody:set_vel(velocity)
end)
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+31 -5
View File
@@ -94,6 +94,31 @@ elseif __vc_app then
complete_app_lib(__vc_app)
end
function inventory.get_uses(invid, slot)
local uses = inventory.get_data(invid, slot, "uses")
if uses == nil then
return item.uses(inventory.get(invid, slot))
end
return uses
end
function inventory.use(invid, slot)
local itemid, count = inventory.get(invid, slot)
if itemid == nil then
return
end
local item_uses = inventory.get_uses(invid, slot)
if item_uses == nil then
return
end
if item_uses == 1 then
inventory.set(invid, slot, itemid, count - 1)
elseif item_uses > 1 then
inventory.set_data(invid, slot, "uses", item_uses - 1)
end
end
------------------------------------------------
------------------- Events ---------------------
------------------------------------------------
@@ -330,7 +355,7 @@ function __vc_on_hud_open()
hud._set_debug_cheats(value)
end)
input.add_callback("devtools.console", function()
if hud.is_paused() then
if menu.page ~= "" then
return
end
time.post_runnable(function()
@@ -338,7 +363,7 @@ function __vc_on_hud_open()
end)
end)
input.add_callback("hud.chat", function()
if hud.is_paused() then
if menu.page ~= "" then
return
end
time.post_runnable(function()
@@ -419,8 +444,9 @@ end
function start_coroutine(chunk, name)
local co = coroutine.create(function()
local status, error = xpcall(chunk, function(...)
gui.alert(debug.traceback(), function()
local status, error = xpcall(chunk, function(err)
local fullmsg = "error: "..string.match(err, ": (.+)").."\n"..debug.traceback()
gui.alert(fullmsg, function()
if world.is_open() then
__vc_app.close_world()
else
@@ -429,7 +455,7 @@ function start_coroutine(chunk, name)
menu.page = "main"
end
end)
return ...
return fullmsg
end)
if not status then
debug.error(error)
+107
View File
@@ -64,6 +64,23 @@ function math.round(num, places)
return math.floor(num * mult + 0.5) / mult
end
function math.sum(...)
local numbers = nil
local sum = 0
if type(...) == "table" then
numbers = ...
else
numbers = {...}
end
for _, v in ipairs(numbers) do
sum = sum + v
end
return sum
end
----------------------------------------------
function table.copy(t)
@@ -125,6 +142,73 @@ function table.merge(t1, t2)
return t1
end
function table.map(t, func)
for i, v in pairs(t) do
t[i] = func(i, v)
end
return t
end
function table.filter(t, func)
for i, v in pairs(t) do
if not func(i, v) then
t[i] = nil
end
end
return t
end
function table.set_default(t, key, default)
if t[key] == nil then
t[key] = default
return default
end
return t[key]
end
function table.flat(t)
local flat = {}
for _, v in pairs(t) do
if type(v) == "table" then
table.merge(flat, v)
else
table.insert(flat, v)
end
end
return flat
end
function table.deep_flat(t)
local flat = {}
for _, v in pairs(t) do
if type(v) == "table" then
table.merge(flat, table.deep_flat(v))
else
table.insert(flat, v)
end
end
return flat
end
function table.sub(arr, start, stop)
local res = {}
start = start or 1
stop = stop or #arr
for i = start, stop do
table.insert(res, arr[i])
end
return res
end
----------------------------------------------
local pattern_escape_replacements = {
@@ -208,6 +292,29 @@ function string.trim_left(s, char)
return string.match(s, "^" .. char .. "*(.+)$") or s
end
function string.pad(str, size, char)
char = char == nil and " " or char
local padding = math.floor((size - #str) / 2)
local extra_padding = (size - #str) % 2
return string.rep(char, padding) .. str .. string.rep(char, padding + extra_padding)
end
function string.left_pad(str, size, char)
char = char == nil and " " or char
local left_padding = size - #str
return string.rep(char, left_padding) .. str
end
function string.right_pad(str, size, char)
char = char == nil and " " or char
local right_padding = size - #str
return str .. string.rep(char, right_padding)
end
string.lower = utf8.lower
string.upper = utf8.upper
string.escape = utf8.escape
+54 -28
View File
@@ -1,33 +1,43 @@
# Общее
# Агульнае
Yes=Так
No=Не
Ok=Ок
Cancel=Скасаваць
Back=Назад
Continue=Працягнуть
Continue=Працягнуць
Add=Дадаць
Version=Версія
Creator=Аўтар
Dependencies=Залежнасці
Description=Апісанне
Converting world...=Выконваецца канвертацыя свету...
Unlimited=Бязмежна
Chat=Чат
Console=Кансоль
Log=Лог
Problems=Праблемы
Monitor=Маніторынг
Debug=Адладка
File=Файл
devtools.traceback=Стэк выклікаў (ад апошняга)
error.pack-not-found=Не ўдалося знайсці пакет
error.dependency-not-found=Выкарыстоўваная залежнасць не знойдзена
pack.remove-confirm=Выдаліць увесь кантэнт які пастаўляецца пакам са свету (беззваротна)?
pack.remove-confirm=Выдаліць увесь кантэнт, які пастаўляецца пакетам/пакетамі, са свету (беззваротна)?
# Подсказки
# Падказкі
graphics.gamma.tooltip=Крывая яркасці асвятлення
graphics.backlight.tooltip=Падсветка, якая прадухіляе поўную цемру
graphics.dense-render.tooltip=Уключае празрыстасць блокаў, такіх як лісце.
# Меню
menu.Apply=Ужыць
menu.Audio=Гук
menu.Back to Main Menu=Вярнуцца ў Меню
menu.Scripts=Сцэнарыі
menu.Content Error=Памылка Кантэнту
menu.Content=Кантэнт
menu.Contents Menu=Меню Кантэнтпакаў
menu.Continue=Працягнуть
menu.Continue=Працягнуць
menu.Controls=Кіраванне
menu.Display=Дысплей
menu.Graphics=Графіка
@@ -39,6 +49,10 @@ menu.Page not found=Старонка не знойдзена
menu.Quit=Выхад
menu.Save and Quit to Menu=Захаваць і Выйсці ў Меню
menu.Settings=Налады
menu.Reset settings=Скінуць налады
menu.Contents Menu=Меню кантэнт-пакаў
menu.Open data folder=Адкрыць папку з дадзенымі
menu.Open content folder=Адкрыць папку [content]
world.Seed=Зерне
world.Name=Назва
@@ -47,43 +61,55 @@ world.generators.default=Звычайны
world.generators.flat=Плоскі
world.Create World=Стварыць Свет
world.convert-request=Ёсць змены ў індэксах! Канвертаваць свет?
world.delete-confirm=Выдаліць свет незваротна?
world.upgrade-request=Фармат свету састарэў! Канвертаваць свет?
world.convert-with-loss=Канвертаваць свет з стратамі?
world.convert-block-layouts=Ёсць змены ў палях блокаў! Канвертаваць свет?
world.delete-confirm=Выдаліць свет беззваротна?
# Настройки
# Налады
settings.Ambient=Фон
settings.Backlight=Падсветка
settings.Camera Shaking=Труска Камеры
settings.Camera Inertia=Інэрцыя Камеры
settings.Fog Curve=Крывая Туману
settings.FOV=Поле Зроку
settings.Dense blocks render=Шчыльны рэндэр блокаў
settings.Camera Shaking=Труска камеры
settings.Camera Inertia=Інэрцыя камеры
settings.Camera FOV Effects=Эфекты поля зроку
settings.Fog Curve=Крывая туману
settings.FOV=Поле зроку
settings.Fullscreen=Поўны экран
settings.Framerate=Частата кадраў
settings.Gamma=Гама
settings.Language=Мова
settings.Load Distance=Дыстанцыя Загрузкі
settings.Load Speed=Хуткасць Загрузкі
settings.Master Volume=Агульная Гучнасць
settings.Mouse Sensitivity=Адчувальнасць Мышы
settings.Load Distance=Дыстанцыя загрузкі
settings.Load Speed=Хуткасць загрузкі
settings.Master Volume=Агульная гучнасць
settings.Mouse Sensitivity=Адчувальнасць мышы
settings.Music=Музыка
settings.Regular Sounds=Звычайныя Гукі
settings.UI Sounds=Гукі Інтэрфейсу
settings.V-Sync=Вертыкальная Сінхранізацыя
settings.Regular Sounds=Звычайныя гукі
settings.UI Sounds=Гукі інтэрфейсу
settings.V-Sync=Вертыкальная сінхранізацыя
settings.Key=Кнопка
settings.Controls Search Mode=Пошук па прывязанай кнопцы кіравання
settings.Limit Background FPS=Абмежаваць фонавую частату кадраў
# Управление
chunks.reload=Перезагрузіць Чанкі
# Кіраванне
chunks.reload=Перазагрузіць чанкі
devtools.console=Кансоль
movement.forward=Уперад
movement.back=Назад
movement.left=Улева
movement.right=Управа
movement.jump=Скачок
movement.sprint=Ускорение
movement.sprint=Паскарэнне
movement.crouch=Красціся
movement.cheat=Чыт
hud.inventory=Рыштунак
player.pick=Падабраць Блок
player.attack=Атакаваць / Ламаць
player.build=Паставіць Блок
hud.inventory=Інвентар
hud.chat=Чат
player.pick=Падабраць блок
player.attack=Атакаваць
player.destroy=Зламаць
player.build=Паставіць блок
player.fast_interaction=Паскоранае ўзаемадзеянне
player.flight=Палёт
player.drop=Выкінуць Прадмет
player.drop=Выкінуць прадмет
camera.zoom=Прыбліжэнне
camera.mode=Змяніць Рэжым Камеры
camera.mode=Змяніць рэжым камеры