Working on Portals, related questions - Printable Version +- Cuberite Forum (https://forum.cuberite.org) +-- Forum: Plugins (https://forum.cuberite.org/forum-1.html) +--- Forum: Plugin Discussion (https://forum.cuberite.org/forum-8.html) +--- Thread: Working on Portals, related questions (/thread-551.html) |
RE: Working on Portals, related questions - Taugeshtu - 09-07-2012 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. RE: Working on Portals, related questions - Taugeshtu - 09-07-2012 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... RE: Working on Portals, related questions - xoft - 09-07-2012 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? RE: Working on Portals, related questions - Taugeshtu - 09-07-2012 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)..")") I assume MoveTo() is not working (yes, .point in Vector3d class) RE: Working on Portals, related questions - FakeTruth - 09-07-2012 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 Use cPawn:TeleportTo(x, y, z) instead RE: Working on Portals, related questions - Taugeshtu - 09-10-2012 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?) RE: Working on Portals, related questions - FakeTruth - 09-10-2012 Use cEntity:IsA("cPickup") or cEntity:GetClass() and compare it with cPickup RE: Working on Portals, related questions - xoft - 09-10-2012 Even better: use cEntity:GetEntityType() and compare to eEntityType_Pickup. This is the most effective way. RE: Working on Portals, related questions - FakeTruth - 09-10-2012 True, but those do not cover all entity classes RE: Working on Portals, related questions - xoft - 09-10-2012 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. |