Players can sit/lay in air #1

Closed
opened 2022-05-16 10:45:20 +02:00 by rudzik8 · 8 comments
Member

Basically, we need to check somehow if player is standing on air currently (and if yes - just don't mount). That's fix of mounting while flying or in jump
But we'll be still able to sit/lay on solid node, destroy it anyhow and stay in the air. Need to check gravity somehow too

Tried to implement first fix via mcl_playerinfo, but no result sadly.
UPD: still need to check gravity somehow and make players fall even while mounted somehow (or dismound and fall if node below is air already?)

~~Basically, we need to check somehow if player is standing on air currently (and if yes - just don't mount). That's fix of mounting while flying or in jump~~ But we'll be still able to sit/lay on solid node, destroy it anyhow and stay in the air. Need to check gravity somehow too ~~Tried to implement first fix via `mcl_playerinfo`, but no result sadly.~~ UPD: still need to check gravity somehow and make players fall even while mounted somehow (or dismound and fall if node below is air already?)
rudzik8 added the
bug
help wanted
labels 2022-05-16 10:45:20 +02:00

something like

if minetest.get_node(vector.offset(pos,0,-1,0)).name ~= "air" then return end

should probably get the worst of it

something like `if minetest.get_node(vector.offset(pos,0,-1,0)).name ~= "air" then return end` should probably get the worst of it
Author
Member

if minetest.get_node(vector.offset(pos,0,-1,0)).name ~= "air" then return end

Added. Result is builtin vector error... I'm using 5.6.0-dev btw, dunno if it's the reason.

Added as:

func = function(name)
	local player = minetest.get_player_by_name(name)
	if minetest.get_node(vector.offset(pos,0,-1,0)).name ~= "air" then return end --this
	if mcl_player.player_attached[name] then
> `if minetest.get_node(vector.offset(pos,0,-1,0)).name ~= "air" then return end` Added. Result is builtin vector error... I'm using 5.6.0-dev btw, dunno if it's the reason. Added as: ``` func = function(name) local player = minetest.get_player_by_name(name) if minetest.get_node(vector.offset(pos,0,-1,0)).name ~= "air" then return end --this if mcl_player.player_attached[name] then ```
Author
Member

Crash text (folder is called minetest-5.5.0-51cfb57, but it's 5.6.0-dev (like, not changing main folder but replacing bin, builtin and client with new ones XD)):

AsyncErr: Lua: Runtime error from mod 'mcl_cozy' in callback on_chat_message(): ...est-5.5.0-51cfb57-win64\bin\..\builtin\common\vector.lua:262: attempt to index local 'v' (a nil value)
stack traceback:
	...est-5.5.0-51cfb57-win64\bin\..\builtin\common\vector.lua:262: in function 'offset'
	...netest-5.5.0-51cfb57-win64\bin\..\mods\mcl_cozy\init.lua:54: in function 'func'
	...inetest-5.5.0-51cfb57-win64\bin\..\builtin\game\chat.lua:79: in function <...inetest-5.5.0-51cfb57-win64\bin\..\builtin\game\chat.lua:52>
	...est-5.5.0-51cfb57-win64\bin\..\builtin\game\register.lua:429: in function <...est-5.5.0-51cfb57-win64\bin\..\builtin\game\register.lua:415>
Crash text (folder is called minetest-5.5.0-51cfb57, but it's 5.6.0-dev (like, not changing main folder but replacing bin, builtin and client with new ones XD)): ``` AsyncErr: Lua: Runtime error from mod 'mcl_cozy' in callback on_chat_message(): ...est-5.5.0-51cfb57-win64\bin\..\builtin\common\vector.lua:262: attempt to index local 'v' (a nil value) stack traceback: ...est-5.5.0-51cfb57-win64\bin\..\builtin\common\vector.lua:262: in function 'offset' ...netest-5.5.0-51cfb57-win64\bin\..\mods\mcl_cozy\init.lua:54: in function 'func' ...inetest-5.5.0-51cfb57-win64\bin\..\builtin\game\chat.lua:79: in function <...inetest-5.5.0-51cfb57-win64\bin\..\builtin\game\chat.lua:52> ...est-5.5.0-51cfb57-win64\bin\..\builtin\game\register.lua:429: in function <...est-5.5.0-51cfb57-win64\bin\..\builtin\game\register.lua:415> ```

uh yes ... you obv need to replace the pos with a position .. player:get_pos() in your example should work

uh yes ... you obv need to replace the pos with a position .. player:get_pos() in your example should work

also it needs to be == "air" hehe

func = function(name)
	local player = minetest.get_player_by_name(name)
	if minetest.get_node(vector.offset(player:get_pos(),0,-1,0)).name == "air" then return end

this should work as is

also it needs to be == "air" hehe ``` func = function(name) local player = minetest.get_player_by_name(name) if minetest.get_node(vector.offset(player:get_pos(),0,-1,0)).name == "air" then return end ``` this should work as is
Author
Member

Thanks! But we'll still have the bug with flying in air after destroying node below player, sadly.

Thanks! But we'll still have the bug with flying in air after destroying node below player, sadly.

hehe yeah it should prob check periodically

hehe yeah it should prob check periodically
rudzik8 reopened this issue 2022-05-16 14:59:25 +02:00
Author
Member

Fixed in 90303158ad.

Fixed in [`90303158ad`](https://git.minetest.land/MineClone2/mcl_cozy/commit/90303158adc5c99f2bc4abbfea63f4ae89da7474).
This repo is archived. You cannot comment on issues.
No Milestone
No project
No Assignees
2 Participants
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: VoxeLibre/mcl_cozy#1
No description provided.