Hi all,
I want to apply animation to a chest (something like assembling machine, radar, turret, etc). I am using entity type "container" and "logistic-container" for it.
But I found out it supports only the property "picture", where I cannot use sub-properties like "frame_count" to apply animated graphics. (I know a lot on how to do animations on turrets though.)
1) Is there any way to apply animated graphics? Or how to get around the restriction?
2) Are there are any entity type that has the inventory/storage slots? I can change the entity type from "container" if it is needed.
[Solved] How to apply animated graphics to chest?
-
- Fast Inserter
- Posts: 162
- Joined: Sun Oct 28, 2018 7:57 am
- Contact:
[Solved] How to apply animated graphics to chest?
Last edited by Schallfalke on Wed Jan 30, 2019 6:09 pm, edited 1 time in total.
Re: How to apply animated graphics to chest?
You have to use two entities, one for the chest and one for the animation.
And then a bunch of control.lua code to make sure both entities are placed and removed together.
And then a bunch of control.lua code to make sure both entities are placed and removed together.
-
- Fast Inserter
- Posts: 162
- Joined: Sun Oct 28, 2018 7:57 am
- Contact:
Re: How to apply animated graphics to chest?
Does it mean I have to use some script to place an additional "animated entity" (like radar type) when item is placed, and remove the additional when it is mined?
I am not sure if it is tricky or not to place an entity on top of another. Can you show me some code on how to do that?
I am not sure if it is tricky or not to place an entity on top of another. Can you show me some code on how to do that?
Re: How to apply animated graphics to chest?
prototype.pictures[1].priority = "extra-high"
It must be here https://wiki.factorio.com/Prototype/Entity but it does not. Same is here https://wiki.factorio.com/Types/RotatedSprite#priority
It must be here https://wiki.factorio.com/Prototype/Entity but it does not. Same is here https://wiki.factorio.com/Types/RotatedSprite#priority
Re: How to apply animated graphics to chest?
That has nothing to do with sprite drawing. It determines into what sprite atlas the sprite is put.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
-
- Fast Inserter
- Posts: 162
- Joined: Sun Oct 28, 2018 7:57 am
- Contact:
Re: How to apply animated graphics to chest?
I have just tried that and it works, thanks for the suggestion.
I am now using a chest entity as "main" part. And a radar entity as animation part, which only creates when on_built_entity or on_robot_built_entity is called. (Similar for removal.)
But then a new problem arise. When holding the item in hand, the "green tint hover" (I don't know what it is called) only shows the chest entity sprite, without the radar entity sprite. It is the same problem, when ghosts are being placed, and in blueprints.
Is there a way to solve this too?
Re: How to apply animated graphics to chest?
You could use a third entity that is a combination of both graphics, then destroy/replace it in on_built.
The nice thing is you can set main_entity.minable.result = "third_entity" so it goes back to the combined version when mined.
The only tricky part is blueprints, you will have to search/replace "main_entity" to "third_entity" in on_player_configured_blueprint.
The nice thing is you can set main_entity.minable.result = "third_entity" so it goes back to the combined version when mined.
The only tricky part is blueprints, you will have to search/replace "main_entity" to "third_entity" in on_player_configured_blueprint.
-
- Fast Inserter
- Posts: 162
- Joined: Sun Oct 28, 2018 7:57 am
- Contact:
Re: How to apply animated graphics to chest?
Wow! You are so talented, thinking outside the box.
I have never tried modifying blueprint. This is a totally new area to me, it will take some time for me to look into that.
Have a new problem though. I want to set the radar-part entity to be invulnerable or "hide" from biters. Tried a few solutions but none of them works (biters still found and destroyed the radar entity), which include:
I have never tried modifying blueprint. This is a totally new area to me, it will take some time for me to look into that.
Have a new problem though. I want to set the radar-part entity to be invulnerable or "hide" from biters. Tried a few solutions but none of them works (biters still found and destroyed the radar entity), which include:
- Setting prototype health to nil. (Setting zero reports error at game loading stage; setting to nil actually sets 10 health.)
- Setting prototype collision box to {{0, 0}, {0, 0}}.
- Setting property at surface.create_entity with destructible = false.
-
- Fast Inserter
- Posts: 162
- Joined: Sun Oct 28, 2018 7:57 am
- Contact:
Re: How to apply animated graphics to chest?
I have successfully set invulnerability by setting after surface.create_entity line, instead of within function.
Thanks for all the help!
Thanks for all the help!