Using player sit and lay animations

User avatar
BrandonReese
Member
 
Posts: 836
Joined: Wed Sep 12, 2012 00:44
GitHub: bremaweb
IRC: BrandonReese
In-game: BrandonReese

Using player sit and lay animations

by BrandonReese » Tue May 06, 2014 02:47

I worked out a way to use the sit and lay animations on command

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

User avatar
Krock
Member
 
Posts: 3598
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker

Re: Using player sit and lay animations

by Krock » Tue May 06, 2014 18:02

It's a nice feature but there must be something easier than chat commands.
Newest Win32 builds - Find a mod - All my mods
ALL YOUR DONATION ARE BELONG TO PARAMAT (Please support him and Minetest)
New DuckDuckGo !bang: !mtmod <keyword here>
 

User avatar
BlockMen
Member
 
Posts: 768
Joined: Fri Mar 01, 2013 17:24
GitHub: BlockMen

Re: Using player sit and lay animations

by BlockMen » Tue May 06, 2014 18:09

Krock wrote:It's a nice feature but there must be something easier than chat commands.


There is: Use boats in Minetest NeXt

Image
 

User avatar
Krock
Member
 
Posts: 3598
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker

Re: Using player sit and lay animations

by Krock » Tue May 06, 2014 18:12

BlockMen wrote:There is: Use boats in Minetest NeXt

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

Perfect, I thought of something like this!
Newest Win32 builds - Find a mod - All my mods
ALL YOUR DONATION ARE BELONG TO PARAMAT (Please support him and Minetest)
New DuckDuckGo !bang: !mtmod <keyword here>
 

User avatar
BrandonReese
Member
 
Posts: 836
Joined: Wed Sep 12, 2012 00:44
GitHub: bremaweb
IRC: BrandonReese
In-game: BrandonReese

Re: Using player sit and lay animations

by BrandonReese » Tue May 06, 2014 18:23

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.
 

User avatar
philipbenr
Member
 
Posts: 1665
Joined: Fri Jun 14, 2013 01:56
GitHub: philipbenr
IRC: philipbenr
In-game: WisdomFire or philipbenr

Re: Using player sit and lay animations

by philipbenr » Tue May 06, 2014 23:31

Now, we can actually lay on beds and sit in chairs? Hopefully really soon... Nice work Brandon and Blockmen!
 

User avatar
spootonium
Member
 
Posts: 94
Joined: Fri May 02, 2014 01:38

Re: Using player sit and lay animations

by spootonium » Thu May 08, 2014 05:34

I don't suppose anyone has created a "swim" or "crawl" animation, yet?
I write code. Sometimes, it even works.
 

User avatar
Krock
Member
 
Posts: 3598
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker

Re: Using player sit and lay animations

by Krock » Thu May 08, 2014 10:44

spootonium wrote:I don't suppose anyone has created a "swim" or "crawl" animation, yet?

Not needed, we've got a lay animation.
Newest Win32 builds - Find a mod - All my mods
ALL YOUR DONATION ARE BELONG TO PARAMAT (Please support him and Minetest)
New DuckDuckGo !bang: !mtmod <keyword here>
 

User avatar
BrandonReese
Member
 
Posts: 836
Joined: Wed Sep 12, 2012 00:44
GitHub: bremaweb
IRC: BrandonReese
In-game: BrandonReese

Re: Using player sit and lay animations

by BrandonReese » Thu May 08, 2014 13:26

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.
 

User avatar
philipbenr
Member
 
Posts: 1665
Joined: Fri Jun 14, 2013 01:56
GitHub: philipbenr
IRC: philipbenr
In-game: WisdomFire or philipbenr

Re: Using player sit and lay animations

by philipbenr » Thu May 08, 2014 22:58

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.
 

Sokomine
Member
 
Posts: 2980
Joined: Sun Sep 09, 2012 17:31

Re: Using player sit and lay animations

by Sokomine » Fri May 09, 2014 01:59

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.
 

User avatar
BrandonReese
Member
 
Posts: 836
Joined: Wed Sep 12, 2012 00:44
GitHub: bremaweb
IRC: BrandonReese
In-game: BrandonReese

Re: Using player sit and lay animations

by BrandonReese » Fri May 09, 2014 02:35

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?
 

spock the elder
Member
 
Posts: 13
Joined: Tue Dec 17, 2013 04:16

Re: Using player sit and lay animations

by spock the elder » Tue Jun 10, 2014 01:52

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!
 

User avatar
BrandonReese
Member
 
Posts: 836
Joined: Wed Sep 12, 2012 00:44
GitHub: bremaweb
IRC: BrandonReese
In-game: BrandonReese

Re: Using player sit and lay animations

by BrandonReese » Tue Jun 10, 2014 02:45

You need a dev version of minetest. set_eye_offset isn't available in 0.4.9 stable.
 

spock the elder
Member
 
Posts: 13
Joined: Tue Dec 17, 2013 04:16

Re: Using player sit and lay animations

by spock the elder » Tue Jun 10, 2014 22:37

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?
 

User avatar
BrandonReese
Member
 
Posts: 836
Joined: Wed Sep 12, 2012 00:44
GitHub: bremaweb
IRC: BrandonReese
In-game: BrandonReese

Re: Using player sit and lay animations

by BrandonReese » Wed Jun 11, 2014 00:19

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
 

spock the elder
Member
 
Posts: 13
Joined: Tue Dec 17, 2013 04:16

Re: Using player sit and lay animations

by spock the elder » Fri Jun 13, 2014 21:42

I'll look into that. Thanks!
 


Return to WIP Mods

Who is online

Users browsing this forum: No registered users and 11 guests

cron