update player.drop callback
This commit is contained in:
parent
3982de76d4
commit
330892bbcd
@ -3,6 +3,6 @@ function on_hud_open()
|
||||
local pid = hud.get_player()
|
||||
local pvel = {player.get_vel(pid)}
|
||||
local eid = entity.test()
|
||||
entity.set_vel(eid, pvel)
|
||||
entity.set_vel(eid, vec3.add(vec3.mul(player.get_dir(pid), {8, 8, 8}), vec3.add(pvel, {0, 3, 0})))
|
||||
end)
|
||||
end
|
||||
|
||||
@ -78,6 +78,13 @@ static int l_player_set_rot(lua::State* L) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int l_player_get_dir(lua::State* L) {
|
||||
if (auto player = get_player(L, 1)) {
|
||||
return lua::pushvec3_arr(L, player->camera->front);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int l_player_get_inv(lua::State* L) {
|
||||
auto player = get_player(L, 1);
|
||||
if (!player) {
|
||||
@ -133,6 +140,7 @@ const luaL_Reg playerlib [] = {
|
||||
{"set_vel", lua::wrap<l_player_set_vel>},
|
||||
{"get_rot", lua::wrap<l_player_get_rot>},
|
||||
{"set_rot", lua::wrap<l_player_set_rot>},
|
||||
{"get_dir", lua::wrap<l_player_get_dir>},
|
||||
{"get_inventory", lua::wrap<l_player_get_inv>},
|
||||
{"is_flight", lua::wrap<l_player_is_flight>},
|
||||
{"set_flight", lua::wrap<l_player_set_flight>},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user