Hi~
I want to create a mode that gives direction.(ore compass)
I'm going to draw an arrow on the gui and the ground.
Do sprite have a command to rotate the image at a free angle? or need to register images in all directions?
Rotate an image in a sprite
Re: Rotate an image in a sprite
Create your sprite sheet filled with all of your arrows. Starting from North to East to West to South (and any in-betweens)
Create a car type entity, assign it to your sprite. When creating the entity/sprite set the .orientation to the direction you want. (depending on the number of frames you might need to adjust/compare to a range)
Create a car type entity, assign it to your sprite. When creating the entity/sprite set the .orientation to the direction you want. (depending on the number of frames you might need to adjust/compare to a range)
animation portion
for an example see the nixie_tubes modRe: Rotate an image in a sprite
I was wondering: Is abusing entity types the only way to display custom arrows/graphics like this? Seems awfully wasteful to create an entity just to display an arrow.Nexela wrote:Create a car type entity, assign it to your sprite.
Re: Rotate an image in a sprite
It's even more wasteful to support every property on every entity. The mod system encourages you to find an entity similar to what you want and hack it.Yoyobuae wrote:Seems awfully wasteful to create an entity just to display an arrow.
Re: Rotate an image in a sprite
Problem is that there's so many things tied to entity type. Only way to mix-and-match features from various entity types is to spawn multiple hidden entities. And then the mod needs to manage the lifetimes of those entities. Feels like really weird and hacky way of doing things. I would prefer to have some flags to tell the entity what sort of properties to implement.DaveMcW wrote:It's even more wasteful to support every property on every entity. The mod system encourages you to find an entity similar to what you want and hack it.Yoyobuae wrote:Seems awfully wasteful to create an entity just to display an arrow.
Anyway, I was just wondering if there was a better alternative. If there's not then I'll keep using what works.
Re: Rotate an image in a sprite
[1] More flexible API / using flagsYoyobuae wrote:Problem is that there's so many things tied to entity type. Only way to mix-and-match features from various entity types is to spawn multiple hidden entities. And then the mod needs to manage the lifetimes of those entities. Feels like really weird and hacky way of doing things. I would prefer to have some flags to tell the entity what sort of properties to implement.
[2] Entity Prototype CompositionRseding91 wrote:You've never written any large piece of performance intensive software have you? There have been multiple suggestions to do this and my response is the same to every one of them:Factoruser wrote:the entity concept should be changed to a flag-based system - and all entity-types should have prototypes.
I.e. you should be able to easily add e.g. electricity consumption to any new or existing entity without writing an OnTick() subroutine. Flags are something like: consumesElectricity, hasInputInventory, hasFuelInventory, hasStorageInventory, wireConnectable etc. The entity-type prototypes are pre-setting them, and can be overwritten by derived entity prototypes.
Until I see *anyone* else implement such a system at the scale that Factorio runs and be successful doing so it's just not even something worth thinking about.
Rseding91 wrote:Yeah that's not happening
It would require a complete re-write of the game from the ground up to *maybe* work and I have extreme doubts it could be done without a huge impact on performance and the number of bugs introduced/difficulty of debugging a given issue.
Re: Rotate an image in a sprite
Yeah, I imagined there was some kind of reason for it. So I guess using multiple entities will remain the way to go then.
I only hope they keep adding more entity types which are useful for modding, like the electric-energy-interface one.
I only hope they keep adding more entity types which are useful for modding, like the electric-energy-interface one.
Re: Rotate an image in a sprite
TBH the first quote made me feel that Rseding doesn't want to be the first one to invent a great system. It is like "I will consider replicating the system if one exists". It doesn't sound right.
But I respect what he has done and I understand he is busy.
But I respect what he has done and I understand he is busy.
Please add an entry in the Modding Interface Requests forum if you have a good idea.Yoyobuae wrote:I only hope they keep adding more entity types which are useful for modding, like the electric-energy-interface one.
Re: Rotate an image in a sprite
Oh! Thank you for posts
I decided to make eight arrows.
I did not understand the diagonal and curves of the rails...(+Curved rails make eight in two sets.)
I decided to make eight arrows.
I did not understand the diagonal and curves of the rails...(+Curved rails make eight in two sets.)