Re: Player getting stuck in deep water
Posted: Mon Oct 07, 2019 9:18 am
Maybe that broke when they added passenger support or I simply remember wrong.
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().eradicator wrote: ↑Fri Oct 04, 2019 5:32 pmHaven'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.
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!If you go that far you might as well all pack it up in a generic function that autodecides which method to use ofc...
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.