Direction of new entity? and many more questions...

Place to get help with not working mods / modding interface.
Spawn
Burner Inserter
Burner Inserter
Posts: 5
Joined: Thu May 23, 2013 1:44 pm
Contact:

Direction of new entity? and many more questions...

Post by Spawn »

Hello,
The Problem
in my mod I create a set of entities via function. Including a transport-belt is created. But, the transport-belt always oriented north.
By definition (in the Entity.lua File) the transport-belt has a property "direction-count = 12".
I suspect, so it should give a direction property that you can set. Expected "direction = X".
But fail... i can't rotate created entity´s.

What I want
The player create a inserter, and a transport-belt will create via function...Direction to East :?:
Here is the code...

The Code

Code: Select all

     game.onevent(defines.events.onbuiltentity, function(event)
  	 if event.createdentity.name == "fast-inserter" then
  	  	local position = {x = event.createdentity.position.x, y = event.createdentity.position.y}
	  	position = {x=position.x + 1.5, y=position.y}
	  	game.createentity{name="ref-inserter", position = position, direction =3}
        end
     end)
EDIT!
>> I find the Solution by myself:
>> the magic word is >orientation< :-8 boah - too easy
>> Example, inserter from right to left:
>> game.createentity{name="fast-inserter", position = position, orientation = 6}

>> This are the 8-way directions:
>> 3 4 5
>> \ | /
>> 2 -- -- 6
>> / | \
>> 1 0 7


More questions.. ;)
By the way, I have a lot of questions about the structure of the Objects and the (maybe) hardcoded properties.
for example,

I try to create a new Gui for the requester-chest - but it seems that the interfaces hard coded to the etitie`s. Is that correct?

I try to copy functions like >providing item´s< like the provider-chest to an new entity with type "mining-drill" - not possible,
seems that functions hardcoded do entitie`s too.

I try to create a assembly.machine without animation - only picture, no way - and the other way a chest with animation - the same.

The animation png`s have different sizes. 141x120, 32 x 32 and so on - but the screen graphics always fit in a block?
Can a animation has any size?

The accumulator has both: pictures, and two kind of animation. Other entities have only pictures or only one animation.
Changes are not possible. Hardcoded, too?

Wouldn't be better, that each entity would have the possibility to set specific properties?
And, if any type of entitie's has different properties and parameter - is there a list of ALL the properties. I belive the Wiki only shows generall parameter from some kind of entities, right?

Thx for reading and hope for answer :D
Frank

thx Frank

EDIT - Format ;-)
Last edited by Spawn on Tue May 28, 2013 12:51 pm, edited 2 times in total.

MF-
Smart Inserter
Smart Inserter
Posts: 1235
Joined: Sun Feb 24, 2013 12:07 am
Contact:

Re: Direction of new entity? and many more questions...

Post by MF- »

welcome.

I cannot answer any of these (I am not a dev)
I was only caught by the writing style.

It took me a while to figure out the formatting of your message. It is nicely structured, but I realized that after I read the post for the 3rd time top-down.
I am used to reading a lot of e-mail messages from people who dislike "top-posting" and write their replies in the middle paragraph by paragraph.
The indentation is usually marked by a number of ">" characters, depending by the depth of the indentation.
I thus attempted to read the first message from the conversation (the paragraph titles) and wondered why are you replying to yourself, while the other side of the conversation remains silent (">>" and "" is one side, ">>>" and ">" the other person)
I could be the only one who had such parsing problems of course, but I would expect anyone used to mailinglists to be confused at first.

EDIT: Example of a mailinglist message, http://lists.freedesktop.org/archives/d ... 37071.html
Some people even say "Hello" on the first line before quoting (">"^n) the other person..

kovarex
Factorio Staff
Factorio Staff
Posts: 8194
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: Direction of new entity? and many more questions...

Post by kovarex »

Spawn wrote:Hello,
The Problem
in my mod I create a set of entities via function. Including a transport-belt is created. But, the transport-belt always oriented north.
By definition (in the Entity.lua File) the transport-belt has a property "direction-count = 12".
I suspect, so it should give a direction property that you can set. Expected "direction = X".
But fail... i can't rotate created entity´s.
The 12 is not really count of directions of transport belt, it is count of animations needed, it includes thinks like turns, endings etc.
Spawn wrote: What I want
The player create a inserter, and a transport-belt will create via function...Direction to East :?:
Here is the code...

The Code

Code: Select all

     game.onevent(defines.events.onbuiltentity, function(event)
  	 if event.createdentity.name == "fast-inserter" then
  	  	local position = {x = event.createdentity.position.x, y = event.createdentity.position.y}
	  	position = {x=position.x + 1.5, y=position.y}
	  	game.createentity{name="ref-inserter", position = position, direction =3}
        end
     end)
You specify the direction of the transport belt the same way as the direction of the inserter, just specify the "direction" property.

Spawn wrote: More questions.. ;)
By the way, I have a lot of questions about the structure of the Objects and the (maybe) hardcoded properties.
for example,

I try to create a new Gui for the requester-chest - but it seems that the interfaces hard coded to the etitie`s. Is that correct?
Yes, it is, we already said, that we plan, in the future, to have kind customizable "lua entity".
But this will be just for special entities and the current ones have to be hardcoded. The reason is performance, for example transport belts
have some internal optimisations, and will have more, if it they worked using lua find-entities, the game would be slow as hell.
Spawn wrote:
I try to create a assembly.machine without animation - only picture, no way - and the other way a chest with animation - the same.
This one is possible, just make animation with 1 frame.
Spawn wrote:
The animation png`s have different sizes. 141x120, 32 x 32 and so on - but the screen graphics always fit in a block?
Can a animation has any size?
I don't get it, animation is always series of pictures with the same size, the size is rectangle.
Spawn wrote:
The accumulator has both: pictures, and two kind of animation. Other entities have only pictures or only one animation.
Changes are not possible. Hardcoded, too?

Wouldn't be better, that each entity would have the possibility to set specific properties?
This still is connected with performance, if every entity had all the properties, the game would grow in memory and performance demands.
The other problem is, that the animation is usually bind with the way the entity works. The animation of assembling machine is dependent on the speed of the assembling machine working, the animation of
mining drill depend on the mining drill speed, the animation of accumulator depends on the state if it is charging or decharging etc.
This makes sense in the "lua entity" where you would specify the logic in lua and the draw function depending on it.
Spawn wrote:
And, if any type of entitie's has different properties and parameter - is there a list of ALL the properties. I belive the Wiki only shows generall parameter from some kind of entities, right?
There is some info here:
https://forums.factorio.com/wiki/inde ... efinitions

But the list for entities is far from complete, I hope to get time to extend it.

Post Reply

Return to “Modding help”