Player getting stuck in deep water

Place to get help with not working mods / modding interface.
mrvn
Smart Inserter
Smart Inserter
Posts: 5681
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Player getting stuck in deep water

Post by mrvn »

Maybe that broke when they added passenger support or I simply remember wrong.

Pi-C
Smart Inserter
Smart Inserter
Posts: 1639
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Player getting stuck in deep water

Post 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 658 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! :-)
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

Pi-C
Smart Inserter
Smart Inserter
Posts: 1639
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Player getting stuck in deep water

Post 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. :-)
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

Pi-C
Smart Inserter
Smart Inserter
Posts: 1639
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Player getting stuck in deep water

Post 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!)
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

Post Reply

Return to “Modding help”