Change Entity Sprite Based Upon Property Value

Place to get help with not working mods / modding interface.
ledzilla
Inserter
Inserter
Posts: 23
Joined: Wed Jun 08, 2016 5:55 pm
Contact:

Change Entity Sprite Based Upon Property Value

Post by ledzilla »

I'm working on making a mod wherein I would like to change the sprite based upon whether the entity energy level is full, empty, or partial. Is there some way to determine the percent of energy filled and change what sprite is used based upon that value? I'm not familiar enough with LUA specifically to know if it's just a matter of syntax or not.
User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

Re: Change Entity Sprite Based Upon Property Value

Post by Adil »

Accumulators can have different animmations based on whether it's discharging or standing.
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.
Supercheese
Filter Inserter
Filter Inserter
Posts: 841
Joined: Mon Sep 14, 2015 7:40 am
Contact:

Re: Change Entity Sprite Based Upon Property Value

Post by Supercheese »

I believe the Nixie Tubes mod was forced to hack this in using a "car"-type entity and adjusting the rotation-property based on inputs.
ledzilla
Inserter
Inserter
Posts: 23
Joined: Wed Jun 08, 2016 5:55 pm
Contact:

Re: Change Entity Sprite Based Upon Property Value

Post by ledzilla »

Adil wrote:Accumulators can have different animmations based on whether it's discharging or standing.
I know that, but that's not what I was looking for. I was looking more at non-(dis)charging states.
ledzilla
Inserter
Inserter
Posts: 23
Joined: Wed Jun 08, 2016 5:55 pm
Contact:

Re: Change Entity Sprite Based Upon Property Value

Post by ledzilla »

Supercheese wrote:I believe the Nixie Tubes mod was forced to hack this in using a "car"-type entity and adjusting the rotation-property based on inputs.
I'm thinking now maybe if I add some max values to the mod global, and then compare the current value for "energy" to that max value during on_tick, it might work.
ledzilla
Inserter
Inserter
Posts: 23
Joined: Wed Jun 08, 2016 5:55 pm
Contact:

Re: Change Entity Sprite Based Upon Property Value

Post by ledzilla »

Well, my idea didn't work, and I'm not certain how the Nixie Tubes mod does what it does. Well, I understand part of it, just don't get how they make it work as a "car".
Post Reply

Return to “Modding help”