How to reset the color of a car after player exits?

Place to get help with not working mods / modding interface.
Post Reply
SirFloIII
Burner Inserter
Burner Inserter
Posts: 12
Joined: Wed Mar 16, 2016 9:09 pm
Contact:

How to reset the color of a car after player exits?

Post by SirFloIII »

Hello everyone.

In the last few days I have created a mod that adds the Brutus, a car with the driver visible. Right now I am modeling the driver. My plan is to use the color layer (the one with "apply_runtime_tint = true") to add the driver if a player is actually in the car. However - I think since .18 - the color stays after the player exits. Now this would of course mean that the driver stays visible after the player exits which is what I obviously don't want to happen.

Is there a flag I can set to reverse this behaviour? If not, is there a way to do it with some runtime code?

Yours, Flo

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2903
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: How to reset the color of a car after player exits?

Post by darkfrei »

Maybe place fake character with standard color to the passenger seat and remove them.

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

Re: How to reset the color of a car after player exits?

Post by Pi-C »

SirFloIII wrote:
Tue Apr 07, 2020 11:50 pm
Is there a flag I can set to reverse this behaviour? If not, is there a way to do it with some runtime code?
See here. I use this feature in GCKI to set the vehicle color back to it's "owner's" color when somebody else has used and left a vehicle that "belongs" to somebody else:

Code: Select all

if vehicle.valid then
        vehicle.color = game.players[owner].color
        […]        
end
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5150
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: How to reset the color of a car after player exits?

Post by Klonan »

SirFloIII wrote:
Tue Apr 07, 2020 11:50 pm
Hello everyone.

In the last few days I have created a mod that adds the Brutus, a car with the driver visible. Right now I am modeling the driver. My plan is to use the color layer (the one with "apply_runtime_tint = true") to add the driver if a player is actually in the car. However - I think since .18 - the color stays after the player exits. Now this would of course mean that the driver stays visible after the player exits which is what I obviously don't want to happen.

Is there a flag I can set to reverse this behaviour? If not, is there a way to do it with some runtime code?

Yours, Flo
Just set the color back to the empty color:

Code: Select all

car.color = {0,0,0,0}

SirFloIII
Burner Inserter
Burner Inserter
Posts: 12
Joined: Wed Mar 16, 2016 9:09 pm
Contact:

Re: How to reset the color of a car after player exits?

Post by SirFloIII »

I see. I didn't realize I could set the color to 0 alpha and thought I had to turn this off via another bool or something.

Thank you very much!

Yours, Flo

Post Reply

Return to “Modding help”