[ScriptAPI] Move player

User avatar
Hackeridze
Member
 
Posts: 310
Joined: Thu Nov 03, 2011 13:35

[ScriptAPI] Move player

by Hackeridze » Thu Jan 05, 2012 23:59

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
diff --git a/src/scriptapi.cpp b/src/scriptapi.cpp
index 8321a45..c27ab55 100644
--- a/src/scriptapi.cpp
+++ b/src/scriptapi.cpp
@@ -1747,7 +1747,12 @@ class ObjectRef
                v3f pos = checkFloatPos(L, 2);
                // Do it
                co->setPos(pos);
-               return 0;
+               
+               // Move player
+               ServerRemotePlayer *player = getplayer(ref);
+               if(player != NULL)
+                       get_server(L)->SendMovePlayer(player);
+        return 0;
        }
       
        // moveto(self, pos, continuous=false)

Patch by xyz
My game: RTMG
GENTOO USER
 

User avatar
sfan5
Member
 
Posts: 3636
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5

by sfan5 » Fri Jan 06, 2012 09:45

This should be added to Mainstream
Mods: Mesecons | WorldEdit | Nuke
Minetest builds for Windows (32-bit & 64-bit)
 

User avatar
Hackeridze
Member
 
Posts: 310
Joined: Thu Nov 03, 2011 13:35

by Hackeridze » Fri Jan 06, 2012 16:38

sfan5 wrote:This should be added to Mainstream

I posted it here for that. We want /sethome and /home !
My game: RTMG
GENTOO USER
 

User avatar
Hackeridze
Member
 
Posts: 310
Joined: Thu Nov 03, 2011 13:35

by Hackeridze » Fri Jan 06, 2012 17:45

My game: RTMG
GENTOO USER
 

randomproof
Member
 
Posts: 214
Joined: Thu Nov 17, 2011 06:31

by randomproof » Tue Jan 10, 2012 16:39

The problem with this is that it also sends the players yaw and pitch so you have a hard time looking around with you are being moved around on a vehicle. You could remove the ClientEvent in client.cpp line 1183
Last edited by randomproof on Tue Jan 10, 2012 16:44, edited 1 time in total.
 

sapier
Member
 
Posts: 763
Joined: Tue Aug 16, 2011 18:17

by sapier » Tue Jan 10, 2012 17:57

If you want to do minecarts with "movePlayer" only it won't work. The problem is that movePlayer moves the cao player object but only indirect the local player in client.

I've got a nearly working solution I'll provide soon, currently the only glitch left is player collision handling results in player dieing while beeing moved.
Sadly atm it relys on some patches I already suggested that might not be merged.
I won't port my changes until a decision is made. If decision is made I'll port it to whatever it is and hope again to be merged.

EDIT1:
this it how it looks like using it combined with my experimental push_block mod Video
Last edited by sapier on Tue Jan 10, 2012 19:01, edited 1 time in total.
DON'T mention coding style!
(c) sapier all rights reserved
 

jn
Member
 
Posts: 106
Joined: Tue Jan 03, 2012 19:15

by jn » Tue Jan 10, 2012 22:30

sapier wrote:this it how it looks like using it combined with my experimental push_block mod Video

Yay, rail cars / minecarts FTW!
 


Return to Minetest Engine

Who is online

Users browsing this forum: No registered users and 7 guests

cron