Page 1 of 1

[0.12.33] teleport deconnected player...

Posted: Wed May 11, 2016 11:01 pm
by binbinhfr
well ok, i know that we are not supposed to do this, but I had a crash making a stupid call like :
player.teleport( force.get_spawn_position(player.surface) )
on a not connected player in a MP map opened locally by one single player !

in case it could be useful anyway...

see log attached

Re: [0.12.33] teleport deconnected player...

Posted: Thu May 12, 2016 11:45 am
by Oxyd
Fixed in 0.12.34: LuaPlayer::teleport will do nothing and return false when called on a disconnected player.

Re: [0.12.33] teleport deconnected player...

Posted: Thu May 12, 2016 12:04 pm
by binbinhfr
by the way, it also seems that changing player.character from one surface to another is making problems.
is it normal ?
I mean if entity1 is on surface 1 and entity2 on surface2, if player.character changes from entity1 to entity2 and try to come back to entity1,
the display does not refresh correctly, showing a mix of the 2 surfaces, and sometimes it crashes, but I cannot reproduce it perfectly.
(I tried this with the SubSurface mod, and my Drones mod, that works on changing player.character).

But are we supposed to use this surface thing yet ? Or is it here for future uses ?

Re: [0.12.33] teleport deconnected player...

Posted: Thu May 12, 2016 12:07 pm
by Klonan
binbinhfr wrote:by the way, it also seems that changing player.character from one surface to another is making problems.
is it normal ?
I mean if entity1 is on surface 1 and entity2 on surface2, if player.character changes from entity1 to entity2 and try to come back to entity1,
the display does not refresh correctly, showing a mix of the 2 surfaces, and sometimes it crashes, but I cannot reproduce it perfectly.
(I tried this with the SubSurface mod, and my Drones mod, that works on changing player.character).

But are we supposed to use this surface thing yet ? Or is it here for future uses ?
You shouldn't have to make a new character entity for each surface, you can use player.teleport to move between surfaces

Re: [0.12.33] teleport deconnected player...

Posted: Thu May 12, 2016 12:16 pm
by binbinhfr
Klonan wrote:You shouldn't have to make a new character entity for each surface, you can use player.teleport to move between surfaces
Thx for your answer Klonan and Oxyd.

Yes the simple player.teleport works.
But my Drones mod works on changing character (from a "player" character to a "drone" character having limited potential).
So the teleport works if you are in "player" or in "drone", but when you switch from "player" to "drone" or reverse, and if the 2 entites are not on the same surface, it creates problems.
I tried to work on moving the player, then switching character, then moving back the old entity on its belonging surface, but moving an entity between is not allowed (error message).

By the way, is there a trick to hide/show an entity on a map, because you do not use it temporarly ? (because I thought about sending it to a hidden surface, but it is not accepted).
I'd like to use this for switching from a character-entity to another, hidding the unused entity but not losing it (to keep all its inventory contents, weapons, etc...)

And thx for your great game. Lot of fun playing but also modding ! ;)