Page 1 of 1

[Solved]DeepCopy of unsorted items missing from normal gameplay

Posted: Sun Dec 01, 2024 6:19 pm
by keeper317
I am trying to make a mod which utilizes the lane splitter found in the unsorted item group when in editor mode. I would love to use this during normal gameplay but when I use deepcopy to make the item and entity, nothing shows up in the menu unless I enable the editor mode. Is there a setting or flag somewhere that I need to change to ensure items that I copy show up without the editor mode being enabled?

Re: DeepCopy of unsorted items missing from normal gameplay

Posted: Mon Dec 02, 2024 9:16 am
by DaveMcW
Try setting item.hidden = false.

Re: DeepCopy of unsorted items missing from normal gameplay

Posted: Mon Dec 02, 2024 9:32 am
by keeper317
DaveMcW wrote: Mon Dec 02, 2024 9:16 am Try setting item.hidden = false.
I tried that, also made a custom subgroup in the logistics group to move the item to and set its new order.
The custom subgroup works, but only in editor mode.

Re: DeepCopy of unsorted items missing from normal gameplay

Posted: Tue Dec 03, 2024 12:33 am
by DaveMcW
This worked for me.

Code: Select all

local entity = table.deepcopy(data.raw['lane-splitter']['lane-splitter'])
entity.name = "my-splitter"
entity.hidden = false
data:extend{entity}

local item = table.deepcopy(data.raw['item']['lane-splitter'])
item.name = "my-splitter"
item.subgroup = "belt"
item.place_result = "my-splitter"
item.hidden = false
data:extend{item}

local recipe = table.deepcopy(data.raw['recipe']['splitter'])
recipe.name = "my-splitter"
recipe.results = {{type="item", name="my-splitter", amount=1}}
recipe.enabled = true
data:extend{recipe}


Re: DeepCopy of unsorted items missing from normal gameplay

Posted: Tue Dec 03, 2024 10:20 am
by keeper317
DaveMcW wrote: Tue Dec 03, 2024 12:33 am This worked for me.

Code: Select all

local entity = table.deepcopy(data.raw['lane-splitter']['lane-splitter'])
entity.name = "my-splitter"
entity.hidden = false
data:extend{entity}

local item = table.deepcopy(data.raw['item']['lane-splitter'])
item.name = "my-splitter"
item.subgroup = "belt"
item.place_result = "my-splitter"
item.hidden = false
data:extend{item}

local recipe = table.deepcopy(data.raw['recipe']['splitter'])
recipe.name = "my-splitter"
recipe.results = {{type="item", name="my-splitter", amount=1}}
recipe.enabled = true
data:extend{recipe}

Thank you, apparently I had my recipe.enabled set to false and forgot to unlock it with a technology. Fixed now.