Expansion of base machines and devices - new to modding

Place to get help with not working mods / modding interface.
Post Reply
xBlizzDevious
Fast Inserter
Fast Inserter
Posts: 108
Joined: Mon Feb 02, 2015 10:15 pm
Contact:

Expansion of base machines and devices - new to modding

Post by xBlizzDevious »

Hello!

I've done a little programming at college and I've done a little at home on my own, but I'm not that good at programming so don't expect me to follow everything you tell me.

As for modding, well that's even more confusing as you have to work off of someone else's work - not something I've ever done before as all of my college assignments were to "create a program that does such and such" rather than "modify this to do that".

Anyways... My aims for modding are as follows:

- To create steam engines that use up twice as much water but produce twice as much power (for space saving reasons, mainly), and possibly ones that produce four and/or eight times more, while using more water, too.
- To create brighter lights (ones that light a greater distance, not actually brighter).
- To add a version of each power pole that has a light as part of it
- To add Improved radars (this will happen later as I've asked already and got a very complicated looking response: https://forums.factorio.com/forum/vie ... =25&t=8572 )
- To do whatever else I come up with that I want to change or add to!
- To add technologies to research these improved items. Possibly to add the better lights into the optics technology.

So, my questions:
Is there anything inherently difficult with any of the above things (other than the radars) or even impossible?
I'm also a little confused by the "order" in the items.lua files. How exactly does it work?

Thanks in advance.

EDIT: I remembered the other great idea I had! Would it be possible to create an underground belt/pipe system that makes all "underground +30" or whatever else obsolete... If you've not figured out my idea: have an "underground belt/pipe end" and then you can make it however long you like, as long as you have that many standard belts/pipes in your inventory. So if you wanted a 27 tile long underground pipe, you'd need two underground pipe ends and 27 normal pipes. If you wanted one 75 tiles long, you'd need two underground ends and 75 normal pipes. Hope that makes sense - so is that possible to do?
Last edited by xBlizzDevious on Thu Feb 12, 2015 12:40 am, edited 1 time in total.

Fatmice
Filter Inserter
Filter Inserter
Posts: 808
Joined: Thu Dec 04, 2014 11:03 pm
Contact:

Re: Expansion of base machines and devices - new to modding

Post by Fatmice »

I'll leave others more experienced in modding to answer the other questions, but as to order, it's quite simple.

order = {a[something]-b[somethingelse]}

The a[something]-b[somethingelse] is simply there as a reminder that you placed something before somethingelse. The thing that actually matter is a-b, which is used as the index to sort things alphabetically.

If you had a collection of order like this {a, a-b, a-a, a-c, d-a, c, b}, it would sort like this {a, a-a, a-b, a-c, b, c, d-a}

Order matters with respect to group and subgroup. Sorting is done alphabetically on group -> subgroup -> (order). So for example,

Item A is in group_A, subgroup_A, order = c
Item B is in group_A, subgroup_A, order = a-a
Item C is in group_B, subgroup_A, order = a
Item D is in group_A, subgroup_B, order = a
Item E is in group_A, subgroup_A, order = a-b

You would see this in-game

Code: Select all

Tab A -> Subgroup A : Item B, Item E, Item A
      -> Subgroup B : Item D
Tab B -> Subgroup A : Item C 
I hope that is clear.
Maintainer and developer of Atomic Power. See here for more information.
Current release: 0.6.6 - Requires 0.14.x
Example build - Requires 0.14.x

xBlizzDevious
Fast Inserter
Fast Inserter
Posts: 108
Joined: Mon Feb 02, 2015 10:15 pm
Contact:

Re: Expansion of base machines and devices - new to modding

Post by xBlizzDevious »

Confusing stuff
Eeeh... Well it started to make sense... Then you lost me. I've managed to figure out how to get something to go after something else (so my tier 2 steam engines appear after the base game ones and so on) but I haven't got a clue how to put something somewhere without a reference to something else that already exists.

Fatmice
Filter Inserter
Filter Inserter
Posts: 808
Joined: Thu Dec 04, 2014 11:03 pm
Contact:

Re: Expansion of base machines and devices - new to modding

Post by Fatmice »

xBlizzDevious wrote:Eeeh... Well it started to make sense... Then you lost me. I've managed to figure out how to get something to go after something else (so my tier 2 steam engines appear after the base game ones and so on) but I haven't got a clue how to put something somewhere without a reference to something else that already exists.
To to that you need to make a new group, like so

Code: Select all

data:extend(
{

  {
    type = "item-group",
    name = "newgroup",
    order = "alphabet_letter",
    inventory_order = "alphabet_letter",
    icon = "__ModName__/path/to/png"
  }
}
)
Then use the new group for your item. If you want your item to be ordered by rows, you need to specify a subgroup.

Code: Select all

data:extend(
{

  {
    type = "item-subgroup",
    name = "newgroup_subgroup",
    group = "newgroup",
    order = "alphabet_letter",
  }
}
Then use your sub-group for your item.

Remember that group and subgroup also have an order. If you do not specify the order, group, or subgroup (depending on what that something is), the game will simply sort it alphabetically by name. Each of the tab in game is like a column on a spreadsheet. The order {a-b, a-c-, a, etc.} is the entries to the rows of the Index column, which is used by the game to sort A->Z.

I suggest you work through FreeER's mod tutorial first to get the basics down. There is a lot to absorb, particularly what goes where, where to find what you want, and what's defined.
Maintainer and developer of Atomic Power. See here for more information.
Current release: 0.6.6 - Requires 0.14.x
Example build - Requires 0.14.x

xBlizzDevious
Fast Inserter
Fast Inserter
Posts: 108
Joined: Mon Feb 02, 2015 10:15 pm
Contact:

Re: Expansion of base machines and devices - new to modding

Post by xBlizzDevious »

Fatmice wrote:-snip-
I guess I should probably have a good read of all the mod information that I can find. I've read through a bunch of things on the wiki, looked at a the code for a few mods that I like, checked out the base "mod" code as well as the example mod and I've just worked everything out from there. I've succeeded in making better lamps and better steam engines already - just got to work on my other ideas as well as recipes and technologies. Haha!

Thanks.

xBlizzDevious
Fast Inserter
Fast Inserter
Posts: 108
Joined: Mon Feb 02, 2015 10:15 pm
Contact:

Re: Expansion of base machines and devices - new to modding

Post by xBlizzDevious »

I've researched some of the stuff that FreeER has written and it's really quite helpful. However, I'm just in the process of attempting to make the lit electric poles and I've not seen something saying how to make an entity encompass two types - or how to make a new type that combines two others - how would I go about doing either?

Fatmice
Filter Inserter
Filter Inserter
Posts: 808
Joined: Thu Dec 04, 2014 11:03 pm
Contact:

Re: Expansion of base machines and devices - new to modding

Post by Fatmice »

xBlizzDevious wrote:I've researched some of the stuff that FreeER has written and it's really quite helpful. However, I'm just in the process of attempting to make the lit electric poles and I've not seen something saying how to make an entity encompass two types - or how to make a new type that combines two others - how would I go about doing either?
This is not easily done and requires lua scripting. Essentially you define your prototype for the pole and your light source, then use lua to detect when the pole is placed and place down the light source. This is of course assuming you can make such a light source in the first place. It might be possible to make the light source without a collision box, but I've never tried.
Maintainer and developer of Atomic Power. See here for more information.
Current release: 0.6.6 - Requires 0.14.x
Example build - Requires 0.14.x

xBlizzDevious
Fast Inserter
Fast Inserter
Posts: 108
Joined: Mon Feb 02, 2015 10:15 pm
Contact:

Re: Expansion of base machines and devices - new to modding

Post by xBlizzDevious »

Fatmice wrote:
xBlizzDevious wrote:I've researched some of the stuff that FreeER has written and it's really quite helpful. However, I'm just in the process of attempting to make the lit electric poles and I've not seen something saying how to make an entity encompass two types - or how to make a new type that combines two others - how would I go about doing either?
This is not easily done and requires lua scripting. Essentially you define your prototype for the pole and your light source, then use lua to detect when the pole is placed and place down the light source. This is of course assuming you can make such a light source in the first place. It might be possible to make the light source without a collision box, but I've never tried.
Ah crap... I had a feeling it'd be something like that; similar situation as to with extending the radar active scanning distance. Is there possibly a way to just "create" a light source? I mean furnaces and lamps both create light as well as the character and probably other things. Creating a light source is definitely there, so adding it to something shouldn't be too difficult. That would avoid the energy cost, however.

This might be a little more complicated than I was expecting...

Fatmice
Filter Inserter
Filter Inserter
Posts: 808
Joined: Thu Dec 04, 2014 11:03 pm
Contact:

Re: Expansion of base machines and devices - new to modding

Post by Fatmice »

xBlizzDevious wrote:
Ah crap... I had a feeling it'd be something like that; similar situation as to with extending the radar active scanning distance. Is there possibly a way to just "create" a light source? I mean furnaces and lamps both create light as well as the character and probably other things. Creating a light source is definitely there, so adding it to something shouldn't be too difficult. That would avoid the energy cost, however.

This might be a little more complicated than I was expecting...
No, creating a new light source is not possible, at least not in the way you are thinking. I don't recall that is do able in a straightforward way. Maybe I am wrong. :roll:

Well, you could try taking the properties of a lamp and add them to your electric pole and see if that works. If that doesn't work, try making an invisible, collision-less lamp then place that on top of the pole by lua. Lua will most likely have to be used.

I think you should know that others have tried to do this as seen by a quick search. Indeed, searching is the first thing that should be done before trying something as that allows you to gauge the potential fruitfulness/fruitlessness of your endeavor.
Maintainer and developer of Atomic Power. See here for more information.
Current release: 0.6.6 - Requires 0.14.x
Example build - Requires 0.14.x

Post Reply

Return to “Modding help”