Page 3 of 3

Re: Player getting stuck in deep water

Posted: Mon Oct 07, 2019 9:18 am
by mrvn
Maybe that broke when they added passenger support or I simply remember wrong.

Re: Player getting stuck in deep water

Posted: Sun Oct 13, 2019 11:38 pm
by Pi-C
eradicator wrote:
Fri Oct 04, 2019 5:32 pm
Haven't used clone() yet. I'd assume that it's an exact copy except for the entity unit_number. I'm not sure what it does to the inventory content though. Some items have unique indexes/tags too (blueprints, modded items like factorissimo factories!, etc). So it might be nessecarry to clone the car, but LuaItemStack.transfer_stack() the items.
It is an exact copy. As you can see in the screenshot, the car still is damaged, the contents of the trunk still is arranged in that peculiar way, and the fuel is the same as before cloning. (Originally, there were 50 solid fuel, but I drove a tiny bit so it would start to use one piece. After cloning, I drove again on the new surface, and it still had the 49 pieces of solid fuel in storage and was driving on the 50th.) I even inserted some blueprints and a Factorissimo building into the trunk, and they've been cloned as well -- without any need for LuaItemStack.transfer_stack().
cloned.png
cloned.png (1.12 MiB) Viewed 682 times
If you go that far you might as well all pack it up in a generic function that autodecides which method to use ofc...
Doing that right now. So far, it's working. I still need to detach the characters from the players, though … But tomorrow is another day! :-)

Re: Player getting stuck in deep water

Posted: Sun Oct 13, 2019 11:46 pm
by Pi-C
mrvn wrote:
Mon Oct 07, 2019 9:18 am
Maybe that broke when they added passenger support or I simply remember wrong.
Never mind. It's almost working now, and of course I've implemented the check for uncharted chunks you suggested. :-)

Re: Player getting stuck in deep water

Posted: Wed Oct 16, 2019 8:46 am
by Pi-C
mrvn wrote:
Wed Sep 11, 2019 6:55 pm
2) Characters can't be assigned to players on different surfaces. Which I believes applies to drivers or passengers of vehicles too.
Teleport to the surface where the character is, assign it and then teleport where you need to go.
Correct. I've been wasting time lately with using teleport() for moving the vehicle on the same surface, and clone() for moving it on another surface. Just using set_driver()/set_passenger() on the cloned vehicle would make the player appear to be in the car but leave the character outside, which was weird.

However, those pesky Wube guys have gotten into my way and made that new function obsolete before I could upload the new version of my mod! :-D
(@Devs: Thanks a lot for making it possible to teleport cars to other surfaces now -- it really makes things much easier!)