Custom Color

by DiRten

More Colors for Vehicles, Players, Trains, Train Stops, Tanks, Cargo Wagons, Fluid Wagons, Spidertrons - RGB color picker with saturation control - Copy/Paste colors (Shift + Right Click → Shift + Left Click) *Vehicle color is independent of player color*

Utilities
8 days ago
1.1 - 2.0
4.29K
Transportation Trains

b Crash when entering a vehicle after creating a new color template, saving and applying it

2 years ago

This is the error message:

The mod Custom Color (3.1.1) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event CustomColor::on_player_driving_changed_state (ID 28)
CustomColor/libraries/functions/cars.lua:44: attempt to index field '?' (a nil value)
stack traceback:
CustomColor/libraries/functions/cars.lua:44: in function <CustomColor/libraries/functions/cars.lua:38>

It's my first time submitting an error report for a factorio mod, let me know if there's other resources you need please.
I have a bunch of mods installed, based on this modpack https://mods.factorio.com/mod/Future-Technology-Factorio-Modpack-IR3/downloads to which i added just a few QOL mods. The only color mod i added is this https://mods.factorio.com/mod/Oil_Based_Paint, right before adding Custom Color to it.

2 years ago

Looking at the code, it seems global.player_info hasn't been set yet for the player. I think changing line 44 of libraries/functions/cars.lua from

                script.raise_event(mod_get_event("car_paint_player").id, {player = current_player, player_saved_color = global.player_info[event.player_index].color, entity = event.entity})

to

            script.raise_event(mod_get_event("car_paint_player").id, {player = current_player, player_saved_color = global.player_info[event.player_index] and global.player_info[event.player_index].color or nil, entity = event.entity})

would fix that. Just unzip the mod and edit the file, then restart the game. Unpacked mods take precedence over zipped mods, so your changed version will be used until the mod is updated.

1 year, 3 months ago

Looking at the code, it seems global.player_info hasn't been set yet for the player. I think changing line 44 of libraries/functions/cars.lua from

              script.raise_event(mod_get_event("car_paint_player").id, {player = current_player, player_saved_color = global.player_info[event.player_index].color, entity = event.entity})

to

          script.raise_event(mod_get_event("car_paint_player").id, {player = current_player, player_saved_color = global.player_info[event.player_index] and global.player_info[event.player_index].color or nil, entity = event.entity})

would fix that. Just unzip the mod and edit the file, then restart the game. Unpacked mods take precedence over zipped mods, so your changed version will be used until the mod is updated.

No one should do this, just fix your mod.

11 days ago

Looking at the code, it seems global.player_info hasn't been set yet for the player. I think changing line 44 of libraries/functions/cars.lua from

              script.raise_event(mod_get_event("car_paint_player").id, {player = current_player, player_saved_color = global.player_info[event.player_index].color, entity = event.entity})

to

          script.raise_event(mod_get_event("car_paint_player").id, {player = current_player, player_saved_color = global.player_info[event.player_index] and global.player_info[event.player_index].color or nil, entity = event.entity})

would fix that. Just unzip the mod and edit the file, then restart the game. Unpacked mods take precedence over zipped mods, so your changed version will be used until the mod is updated.

Thanks for your help!) After so many years, I'll make some edits.

New response