Working on Portals, related questions
#31
Quote:Same thing happens with lava buckets (resulting in the server placing the lava at [-1, 255, -1])
But will it blend be fixed in MCS code, or should I handle it through plugin?
Doesn't make much sense to me - to have fantom rightclick sent to plugin... We could always know that we're rightclicking with tool with HeldItem.
Reply
Thanks given by:
#32
New bug (?) - OnPlayerMove hook is called even if player stand still. It's just equivalent to Tick(), except it has Player as an argument (so it's equivalent to ForEachPlayer, called inside ForEachWorld inside Tick())

Is it supposed to behave so? Because name's somewhat misleading then - I wasn't expecting this hook to be called when player not moves...
Reply
Thanks given by:
#33
The hook is called whenever the client sends a PlayerMove packet. And I think the client moves the player all the time - if you switch on the debug screen (F3), you'll see that the coords keep changing even when the view seems to have stopped, in inrcrements of 0.000000001 etc. That might be the issue.

I'm not sure whether the server should be doing anything about that; I think your plugin should live with this - instead of checking for (non-)movement, why not check if the player has been inside the area for the specified amount of time?
Reply
Thanks given by:
#34
Well, let's stick to that then.
And once again, what about fantom rightclick? Should all plugin writers (probably there's one more besides me, but he's hiding in jungles!) fix that inside lua too, or should you make changes in server code?
Here's my new pain:
http://rghost.ru/40231747/image.png
That's the result of simple lines like:
Code:
Player:SendMessage("You're teleported from ("..round(Player:GetPosX())..","..round(Player:GetPosY())..","..round(Player:GetPosZ())..") to ("..round(PortalsData.warps["".._zone].point.x)..","..round(PortalsData.warps["".._zone].point.y)..","..round(PortalsData.warps["".._zone].point.z)..")")
Player:MoveTo(PortalsData.warps["".._zone].point)

I assume MoveTo() is not working (yes, .point in Vector3d class)
Reply
Thanks given by:
#35
MoveTo() is for internal use only, so perhaps it should not be exported to Lua at all.
Code:
// Tries to move to a new position, with collision checks and stuff
virtual void MoveTo( const Vector3d & a_NewPos );
As the description says, it should do collision checks and such, so it's not suitable for teleportation

Use cPawn:TeleportTo(x, y, z) instead
Reply
Thanks given by: Taugeshtu
#36
I'm trying to make items teleportation right now. Looks like "delete at one place, create in another" is a good tactics.
However, I got a "noob" question: how do I know if given cEntity is actually cPickup?) (I assume ForEachEntityInChunk will cycle through all cEntity Descendants too, am I right about it?)
Reply
Thanks given by:
#37
Use cEntity:IsA("cPickup") or cEntity:GetClass() and compare it with cPickup
Reply
Thanks given by:
#38
Even better: use cEntity:GetEntityType() and compare to eEntityType_Pickup. This is the most effective way.
Reply
Thanks given by:
#39
True, but those do not cover all entity classes
Reply
Thanks given by:
#40
They cover enough. And I think we should make them cover everything - checking a string to see if a class is of a given type is a terrible way.
Reply
Thanks given by:




Users browsing this thread: 3 Guest(s)