Merge branch 'main' into dev
This commit is contained in:
@@ -31,11 +31,11 @@
|
||||
size='32' margin='0,0,425,64' gravity='bottom-right'
|
||||
color='#FFFFFF50' hover-color='#FFFFFF10'/>
|
||||
|
||||
<panel id='packs_add' pos='485,34' size='440,507' color='0' max-length='455' scrollable='true'>
|
||||
<panel id='packs_add' pos='485,34' size='440,455' color='0' max-length='455' scrollable='true'>
|
||||
<!-- content is generated in script -->
|
||||
</panel>
|
||||
|
||||
<panel id='packs_cur' pos='15,34' size='440,507' color='0' max-length='455' scrollable='true'>
|
||||
<panel id='packs_cur' pos='15,34' size='440,455' color='0' max-length='455' scrollable='true'>
|
||||
<!-- content is generated in script -->
|
||||
</panel>
|
||||
</container>
|
||||
@@ -255,30 +255,33 @@ function check_dependencies(packinfo)
|
||||
if packinfo.dependencies == nil then
|
||||
return
|
||||
end
|
||||
for i,dep in ipairs(packinfo.dependencies) do
|
||||
for i, dep in ipairs(packinfo.dependencies) do
|
||||
local depid, depver = unpack(string.split(dep:sub(2,-1), "@"))
|
||||
|
||||
if dep:sub(1,1) == '!' then
|
||||
if not table.has(packs_all, depid) then
|
||||
return string.format(
|
||||
"%s (%s)", gui.str("error.dependency-not-found"), depid
|
||||
)
|
||||
end
|
||||
|
||||
|
||||
local dep_pack = pack.get_info(depid);
|
||||
|
||||
if not compare_version(depver, dep_pack.version) then
|
||||
local op, ver = Version.parse(depver);
|
||||
|
||||
print(string.format("%s: %s !%s %s (%s)", gui.str("error.dependency-version-not-met"), dep_pack.version, op, ver, depid));
|
||||
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
|
||||
table.insert(required, depid)
|
||||
end
|
||||
if dep:sub(1,1) ~= '!' then
|
||||
goto continue
|
||||
end
|
||||
if not table.has(packs_all, depid) then
|
||||
return string.format(
|
||||
"%s (%s)", gui.str("error.dependency-not-found"), depid
|
||||
)
|
||||
end
|
||||
|
||||
local dep_pack = pack.get_info(depid);
|
||||
|
||||
if not compare_version(depver, dep_pack.version) then
|
||||
local op, ver = Version.parse(depver)
|
||||
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
|
||||
table.insert(required, depid)
|
||||
end
|
||||
::continue::
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
local Random = {}
|
||||
|
||||
local M = 2 ^ 31
|
||||
local A = 1103515245
|
||||
local C = 12345
|
||||
|
||||
function Random.randint(self)
|
||||
self._seed = (A * self._seed + C) % M
|
||||
return self._seed
|
||||
end
|
||||
|
||||
function Random.random(self, a, b)
|
||||
local num = self:randint() % M / M
|
||||
if b then
|
||||
return math.floor(num * (b - a + 1) + a)
|
||||
elseif a then
|
||||
return math.floor(num * a + 1)
|
||||
else
|
||||
return num
|
||||
end
|
||||
end
|
||||
|
||||
function Random.seed(self, number)
|
||||
if type(number) ~= "number" then
|
||||
error("number expected")
|
||||
end
|
||||
self._seed = number
|
||||
end
|
||||
|
||||
return function(seed)
|
||||
if seed and type(seed) ~= "number" then
|
||||
error("number expected")
|
||||
end
|
||||
return setmetatable({_seed = seed or random.random(M)}, {__index = Random})
|
||||
end
|
||||
+13
-5
@@ -144,7 +144,11 @@ network.udp_connect = function (address, port, datagramHandler, openCallback)
|
||||
socket.id = network.__connect_udp(address, port)
|
||||
|
||||
_udp_client_datagram_callbacks[socket.id] = datagramHandler
|
||||
_udp_client_open_callbacks[socket.id] = openCallback
|
||||
if openCallback then
|
||||
_udp_client_open_callbacks[socket.id] = function()
|
||||
openCallback(socket)
|
||||
end
|
||||
end
|
||||
|
||||
return socket
|
||||
end
|
||||
@@ -225,8 +229,6 @@ block.__process_register_events = function()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
print(type, id, x, y, z)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -256,9 +258,15 @@ network.__process_events = function()
|
||||
end
|
||||
elseif etype == DATAGRAM then
|
||||
if side == ON_CLIENT then
|
||||
_udp_client_datagram_callbacks[cid](data)
|
||||
local callback = _udp_client_datagram_callbacks[cid]
|
||||
if callback then
|
||||
callback(data)
|
||||
end
|
||||
elseif side == ON_SERVER then
|
||||
_udp_server_callbacks[sid](addr, port, data)
|
||||
local callback = _udp_server_callbacks[sid]
|
||||
if callback then
|
||||
callback(addr, port, data)
|
||||
end
|
||||
end
|
||||
elseif etype == RESPONSE then
|
||||
if event[2] / 100 == 2 then
|
||||
|
||||
@@ -51,6 +51,7 @@ end
|
||||
|
||||
function move_vertical(speed, vel)
|
||||
vel = vel or body:get_vel()
|
||||
speed = speed or 1.0
|
||||
vel[2] = vel[2] * 0.2 + props.movement_speed * speed * 0.8
|
||||
body:set_vel(vel)
|
||||
end
|
||||
@@ -145,6 +146,10 @@ function set_dir(new_dir)
|
||||
dir = new_dir
|
||||
end
|
||||
|
||||
function get_dir()
|
||||
return dir
|
||||
end
|
||||
|
||||
function is_flight() return flight end
|
||||
|
||||
function set_flight(flag) flight = flag end
|
||||
@@ -154,7 +159,7 @@ local prev_angle = (vec2.angle({dir[3], dir[1]})) % 360
|
||||
function on_physics_update(delta)
|
||||
local grounded = body:is_grounded()
|
||||
body:set_vdamping(flight)
|
||||
body:set_gravity_scale({0, flight and 0.0 or props.gravity_scale, 0})
|
||||
body:set_gravity_scale(flight and 0.0 or props.gravity_scale)
|
||||
body:set_linear_damping(
|
||||
(flight or not grounded) and props.air_damping or props.ground_damping
|
||||
)
|
||||
|
||||
@@ -25,6 +25,10 @@ function get_route()
|
||||
return route
|
||||
end
|
||||
|
||||
function reset_route()
|
||||
route = nil
|
||||
end
|
||||
|
||||
function next_waypoint()
|
||||
if not route or #route == 0 then
|
||||
return
|
||||
|
||||
@@ -4,13 +4,22 @@ local mob = entity:require_component("core:mob")
|
||||
|
||||
local cheat_speed_mul = 10.0
|
||||
|
||||
local function process_player_inputs(pid, delta)
|
||||
local function get_player_rotation(pid)
|
||||
local rx, ry, rz = player.get_rot(pid)
|
||||
local matrix = mat4.rotate({0, 1, 0}, rx)
|
||||
mat4.rotate(matrix, {1, 0, 0}, ry, matrix)
|
||||
mat4.rotate(matrix, {0, 0, 1}, rz, matrix)
|
||||
return matrix
|
||||
end
|
||||
|
||||
local function process_player_inputs(pid, rot, delta)
|
||||
if not hud or hud.is_inventory_open() or menu.page ~= "" then
|
||||
return
|
||||
end
|
||||
local cam = cameras.get("core:first-person")
|
||||
local front = cam:get_front()
|
||||
local right = cam:get_right()
|
||||
|
||||
local front = mat4.mul(rot, {0, 0, -1})
|
||||
local right = mat4.mul(rot, {1, 0, 0})
|
||||
|
||||
front[2] = 0.0
|
||||
vec3.normalize(front, front)
|
||||
|
||||
@@ -22,8 +31,6 @@ local function process_player_inputs(pid, delta)
|
||||
local isback = input.is_active('movement.back')
|
||||
local isleft = input.is_active('movement.left')
|
||||
local isright = input.is_active('movement.right')
|
||||
mob.set_flight(player.is_flight(pid))
|
||||
body:set_body_type(player.is_noclip(pid) and "kinematic" or "dynamic")
|
||||
body:set_crouching(iscrouch)
|
||||
|
||||
local vel = body:get_vel()
|
||||
@@ -53,10 +60,19 @@ end
|
||||
|
||||
function on_physics_update(delta)
|
||||
local pid = entity:get_player()
|
||||
if pid ~= -1 then
|
||||
if pid == -1 then
|
||||
return
|
||||
end
|
||||
|
||||
mob.set_flight(player.is_flight(pid))
|
||||
body:set_body_type(player.is_noclip(pid) and "kinematic" or "dynamic")
|
||||
|
||||
if hud and pid == hud.get_player() then
|
||||
local pos = tsf:get_pos()
|
||||
local cam = cameras.get("core:first-person")
|
||||
process_player_inputs(pid, delta)
|
||||
mob.look_at(vec3.add(pos, cam:get_front()))
|
||||
local rot = get_player_rotation(pid)
|
||||
local front = mat4.mul(rot, {0, 0, -1})
|
||||
|
||||
process_player_inputs(pid, rot, delta)
|
||||
mob.look_at(vec3.add(pos, front))
|
||||
end
|
||||
end
|
||||
|
||||
+38
-1
@@ -669,4 +669,41 @@ end
|
||||
bit.compile = require "core:bitwise/compiler"
|
||||
bit.execute = require "core:bitwise/executor"
|
||||
|
||||
random.Random = require "core:internal/random_generator"
|
||||
function __vc_create_random_methods(random_methods)
|
||||
local index = 1
|
||||
local buffer = nil
|
||||
local buffer_size = 64
|
||||
|
||||
local seed_func = random_methods.seed
|
||||
local random_func = random_methods.random
|
||||
|
||||
function random_methods:bytes(n)
|
||||
local bytes = Bytearray(n)
|
||||
for i=1,n do
|
||||
bytes[i] = self:random(255)
|
||||
end
|
||||
return bytes
|
||||
end
|
||||
|
||||
function random_methods:seed(x)
|
||||
seed_func(self, x)
|
||||
buffer = nil
|
||||
end
|
||||
|
||||
function random_methods:random(a, b)
|
||||
if not buffer or index > #buffer then
|
||||
buffer = random_func(self, buffer_size)
|
||||
index = 1
|
||||
end
|
||||
local value = buffer[index]
|
||||
if b then
|
||||
value = math.floor(value * (b - a + 1) + a)
|
||||
elseif a then
|
||||
value = math.floor(value * a + 1)
|
||||
end
|
||||
|
||||
index = index + 4
|
||||
return value
|
||||
end
|
||||
return random_methods
|
||||
end
|
||||
|
||||
@@ -43,7 +43,7 @@ float calc_shadow(
|
||||
// TODO: add array textures support
|
||||
float calc_shadow(vec4 modelPos, vec3 realnormal, float distance) {
|
||||
#ifdef ENABLE_SHADOWS
|
||||
float s = pow(abs(cos(u_dayTime * PI2)), 0.25) * u_shadowsOpacity;
|
||||
float s = u_shadowsOpacity;
|
||||
vec3 normalOffset = realnormal * (distance > 64.0 ? 0.2 : 0.04);
|
||||
|
||||
// as slow as mix(...)
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <constants>
|
||||
|
||||
vec3 pick_sky_color(samplerCube cubemap) {
|
||||
vec3 skyLightColor = texture(cubemap, vec3(0.8f, 0.01f, 0.4f)).rgb;
|
||||
vec3 skyLightColor = texture(cubemap, vec3(0.4f, 0.05f, 0.4f)).rgb;
|
||||
skyLightColor *= SKY_LIGHT_TINT;
|
||||
skyLightColor = min(vec3(1.0f), skyLightColor * SKY_LIGHT_MUL);
|
||||
skyLightColor = max(MIN_SKY_LIGHT, skyLightColor);
|
||||
|
||||
@@ -268,7 +268,11 @@ void main() {
|
||||
camera_vector, // the camera vector (ray direction of this pixel)
|
||||
1e12f, // max dist, essentially the scene depth
|
||||
vec3(0.0f), // scene color, the color of the current pixel being rendered
|
||||
vec3(u_lightDir.x, pow(u_lightDir.y, 3.0), u_lightDir.z), // light direction
|
||||
vec3(
|
||||
u_lightDir.x,
|
||||
u_lightDir.y,
|
||||
u_lightDir.z
|
||||
), // light direction
|
||||
vec3(40.0*fog), // light intensity, 40 looks nice
|
||||
PLANET_POS, // position of the planet
|
||||
PLANET_RADIUS, // radius of the planet in meters
|
||||
|
||||
Reference in New Issue
Block a user