Gizmos Car Keys (improved)

by Pi-C

Tired of running to your vehicle? Then let it come to you! This mod is based on "Gizmos Car Keys" by aodgizmo. It works with most modded car and spider-vehicle prototypes -- not just vanilla cars.

Content
2 months ago
0.17 - 1.1
14.8K
Transportation

b [Implemented] Compatibility with Avatars

3 years ago

Hi, I'm the author of the Avatars mod and I received this bug report that is an issue with GCKI. https://mods.factorio.com/mod/Avatars/discussion/6067902bf94492fc82692bfe

For Avatars, the player enters a special car (control center) to get a UI to exchange control of their character to "avatars" which are crafted characters. When doing so, they leave their character in the control center. If they then enter the control center with the avatar (or anyone does for that matter), the original character is deleted by GCKI as it thinks it is a dummy.

Since this is the player's original character it needs to be kept.

3 years ago
(updated 3 years ago)

Thanks for the report! I don't have much time to spare at the moment, so I don't want to go over your code right now. Basically, my check for dummies boils down to this:

if (character.is_player() and not character.name) or not (character.is_player() or character.player) then
   -- Character is a dummy
end

I suppose it would be enough to check for character.associated_player as well. Can you confirm this?

3 years ago

I don't currently associate the characters, but it looks like it would do the job with an update on my end.

Currently I just change the player's character and leave the old one behind, just marking it inactive.

3 years ago

I've found another way: I've added an ignore list (currently only your "cars" are on it, but if necessary, entities from other mods could easily be added as well), and GCKI will now only act on vehicles that are not on this list. For your mod, I've added a migration script that will remove your "cars" from all tables and, most important, unlock any that may have been locked by mistake. I probably should put that code in a more general function called by on_configuration_changed, and add a way for other mods to put their "cars" on the ignore list as well.

3 years ago

OK, that sounds good to me. Thanks for working on this.

3 years ago
(updated 3 years ago)

OK, that sounds good to me.

Do you want to have a preview version, so you could test before release?

Thanks for working on this.

Sorry it took me so long. I've had a lot to do for my RL job during the last weeks …

3 years ago

If you'd rather I test it to make sure, then yes I can do that after work today. But if you feel confident it works then that's fine with me.

And I understand life is first, no worries.

3 years ago
(updated 3 years ago)

If you'd rather I test it to make sure, then yes I can do that after work today. But if you feel confident it works then that's fine with me.

Sorry, I messed up something else, which introduced new crashes that I'm still struggling to fix. I'll send you the preview once that is working again.

Meanwhile, there's a problem with Avatars + AAI Programmable Vehicles: AAI creates new prototypes for each car, so they can be controlled remotely. As far as I can see, your "cars" can't be selected with AAI, but their recipes will still be available in the crafting menu. This patch will put your "cars" on AAI's ignore list:

if aai_vehicle_exclusions then
    table.insert(aai_vehicle_exclusions, "avatar-control-center")
    table.insert(aai_vehicle_exclusions, "avatar-remote-deployment-unit")
end

AAI will create the table in data.lua and the new prototypes in data-final-fixes.lua. You could add the code to data.lua, but that requires an optional dependency on "aai-programmable-vehicles". The other option is to add it to data-updates.lua (which doesn't exist yet).

3 years ago

I've sent you a preview on the forum.

3 years ago

Ok, looks good on my end. And thanks for the heads up on AAI, I don't use it but I added that exclusion.

1 year, 10 months ago

Sorry it took me so long to upload. Version 1.1.2 should be compatible with your mod! :-)

New response