Page 1 of 1

Using player sit and lay animations

PostPosted: Tue May 06, 2014 02:47
by BrandonReese
I worked out a way to use the sit and lay animations on command

https://gist.github.com/Bremaweb/cd6b803dd4ef918acb67

Re: Using player sit and lay animations

PostPosted: Tue May 06, 2014 18:02
by Krock
It's a nice feature but there must be something easier than chat commands.

Re: Using player sit and lay animations

PostPosted: Tue May 06, 2014 18:09
by BlockMen
Krock wrote:It's a nice feature but there must be something easier than chat commands.


There is: Use boats in Minetest NeXt

Image

Re: Using player sit and lay animations

PostPosted: Tue May 06, 2014 18:12
by Krock
BlockMen wrote:There is: Use boats in Minetest NeXt

http://i.imgur.com/76h2gLD.png

Perfect, I thought of something like this!

Re: Using player sit and lay animations

PostPosted: Tue May 06, 2014 18:23
by BrandonReese
Krock wrote:It's a nice feature but there must be something easier than chat commands.


The chat commands were just an example. I use the chat commands in my game for sitting or sleeping wherever you want, but I plan on adding the option to click on furniture to sit on it.

Re: Using player sit and lay animations

PostPosted: Tue May 06, 2014 23:31
by philipbenr
Now, we can actually lay on beds and sit in chairs? Hopefully really soon... Nice work Brandon and Blockmen!

Re: Using player sit and lay animations

PostPosted: Thu May 08, 2014 05:34
by spootonium
I don't suppose anyone has created a "swim" or "crawl" animation, yet?

Re: Using player sit and lay animations

PostPosted: Thu May 08, 2014 10:44
by Krock
spootonium wrote:I don't suppose anyone has created a "swim" or "crawl" animation, yet?

Not needed, we've got a lay animation.

Re: Using player sit and lay animations

PostPosted: Thu May 08, 2014 13:26
by BrandonReese
Krock wrote:
spootonium wrote:I don't suppose anyone has created a "swim" or "crawl" animation, yet?

Not needed, we've got a lay animation.


A swimming animation would be neat with the arms rotating and everything. Where is Jordach? He could do that.

Re: Using player sit and lay animations

PostPosted: Thu May 08, 2014 22:58
by philipbenr
The swimming animation is just laying down, but the legs moving and the arms doing "arm circles" Other than that, I think We have most of it down. On a side note: I hope that PilzAdam or somebody might program something into a bed/furniture mod.

Re: Using player sit and lay animations

PostPosted: Fri May 09, 2014 01:59
by Sokomine
philipbenr wrote:On a side note: I hope that PilzAdam or somebody might program something into a bed/furniture mod.

I've already created functions for mobs to use common furniture. Most of the work was to figure out how they ought to sit/lay on it - facedir of node vs. yaw of mob and relative position to the object. That it could be done with players as well was new for me, and thus I asked Bradon for the code. Players rotating randomly on furniture might still look odd.

Re: Using player sit and lay animations

PostPosted: Fri May 09, 2014 02:35
by BrandonReese
Sokomine wrote:
philipbenr wrote:On a side note: I hope that PilzAdam or somebody might program something into a bed/furniture mod.

I've already created functions for mobs to use common furniture. Most of the work was to figure out how they ought to sit/lay on it - facedir of node vs. yaw of mob and relative position to the object. That it could be done with players as well was new for me, and thus I asked Bradon for the code. Players rotating randomly on furniture might still look odd.


If you attach the players like in the carts mod they won't rotate will they? Can you only attach players to entities?

Re: Using player sit and lay animations

PostPosted: Tue Jun 10, 2014 01:52
by spock the elder
I replaced the default player.lua file in the games/minetest_game/mods/default with the file from the first download link (and renamed it correctly), went in-game, attempted to change my stance, and got this error:

20:40:18: ERROR[main]: ServerError: LuaError: ...minetest/games/minetest_game/mods/default/player.lua:221: attempt to call method 'set_eye_offset' (a nil value)
20:40:18: ERROR[main]: stack traceback:
20:40:18: ERROR[main]: ...minetest/games/minetest_game/mods/default/player.lua:221: in function 'func'
20:40:18: ERROR[main]: /usr/share/minetest/builtin/chatcommands.lua:25: in function </usr/share/minetest/builtin/chatcommands.lua:16>
20:40:31: ERROR[main]: Jsonreader: servers.minetest.net/list not found (Timeout was reached)

Upon restarting the game, my stance has not changed.

the code itself says this:

minetest.register_chatcommand("sleep",{
func = function( name, param )
local player = minetest.get_player_by_name(name)
default.player_set_animation(player, "lay")
player:set_eye_offset({x=0,y=-10,z=0},{x=0,y=0,z=0})
end,
})

Upon looking into the chatcommands.lua, the failing was in declaring the chat command. Is there some place where I need to define the 'player:set_eye_offset' function? If so, where? Thanks for your help!

Re: Using player sit and lay animations

PostPosted: Tue Jun 10, 2014 02:45
by BrandonReese
You need a dev version of minetest. set_eye_offset isn't available in 0.4.9 stable.

Re: Using player sit and lay animations

PostPosted: Tue Jun 10, 2014 22:37
by spock the elder
ohhhhhhhhhhhhhhhhh... I'm still on 0.4.8 (*facepalm*)
how could I get set_eye_offset into my version? or is it compiled in the binaries?

Re: Using player sit and lay animations

PostPosted: Wed Jun 11, 2014 00:19
by BrandonReese
It's in the binaries. If you are on *Ubuntu, or another Debian based distro, the readme file has some pretty easy instructions to follow for compiling from source.

https://github.com/minetest/minetest/bl ... README.txt

Re: Using player sit and lay animations

PostPosted: Fri Jun 13, 2014 21:42
by spock the elder
I'll look into that. Thanks!