[MOD 0.16] Upgrade planner

Topics and discussion about specific mods
d3x0r
Filter Inserter
Filter Inserter
Posts: 316
Joined: Sun Jun 04, 2017 8:56 am
Contact:

Re: [MOD 0.15] Upgrade planner

Post by d3x0r »

You're welcome :)

If I have a saved plan. (or in new saved plan)
If I use the trash can to delete a line it doesn't update; changing to another and back the items return.\

---
a fix someone requestd in my version - when droppihng an item over an existing item that causes an error, it is nicer to just restore the previous item instead of clearing the cell...
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5290
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: [MOD 0.15] Upgrade planner

Post by Klonan »

d3x0r wrote:You're welcome :)

If I have a saved plan. (or in new saved plan)
If I use the trash can to delete a line it doesn't update; changing to another and back the items return.\

---
a fix someone requestd in my version - when droppihng an item over an existing item that causes an error, it is nicer to just restore the previous item instead of clearing the cell...
Okay, I have fixed that and implemented that rules won't be cleared when they error
d3x0r
Filter Inserter
Filter Inserter
Posts: 316
Joined: Sun Jun 04, 2017 8:56 am
Contact:

Re: [MOD 0.15] Upgrade planner

Post by d3x0r »

Sorry :)
Changing the selected configuration doesn't update the plan, it stays at what the new update plan was.

(I made yellow-red, red-blue, blue-yellow) and it wouldn't change after doing the first one

---

EDIT:
Doesn't replace brick/concrete/hazard tiles. (checking on blueprint)

51.906 Error MainLoop.cpp:943: Exception at tick 116421: Error while running event upgrade-planner::on_gui_click (ID 1)
__upgrade-planner__/control.lua:942: bad argument #1 to 'pairs' (table expected, got nil)

Upgrading a blueprint with tiles on it.. (brick, cement&hazard, plan to upgrade brick->cement)

Mostly this was to add +1 for fixing replacing rails/tiles with blueprints... because if you shift-click the plan and it does upgrade the cement tiles to hazard for instance, then the bots will pick up the cement and not place hazard. viewtopic.php?f=213&t=50877

EDIT2:
Oh interesting on selected area just doesn't give you selected tiles in the event. Have to do an additional get_entities_filtered
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5290
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: [MOD 0.15] Upgrade planner

Post by Klonan »

d3x0r wrote:Sorry :)
Changing the selected configuration doesn't update the plan, it stays at what the new update plan was.

(I made yellow-red, red-blue, blue-yellow) and it wouldn't change after doing the first one

---

EDIT:
Doesn't replace brick/concrete/hazard tiles. (checking on blueprint)

51.906 Error MainLoop.cpp:943: Exception at tick 116421: Error while running event upgrade-planner::on_gui_click (ID 1)
__upgrade-planner__/control.lua:942: bad argument #1 to 'pairs' (table expected, got nil)

Upgrading a blueprint with tiles on it.. (brick, cement&hazard, plan to upgrade brick->cement)

Mostly this was to add +1 for fixing replacing rails/tiles with blueprints... because if you shift-click the plan and it does upgrade the cement tiles to hazard for instance, then the bots will pick up the cement and not place hazard. viewtopic.php?f=213&t=50877

EDIT2:
Oh interesting on selected area just doesn't give you selected tiles in the event. Have to do an additional get_entities_filtered
Upgrading tiles in the blueprints isn't a easy job, so i will save it for another day
But i have fixed the crash
Wexler
Burner Inserter
Burner Inserter
Posts: 9
Joined: Sun Jun 11, 2017 2:25 pm
Contact:

Re: [MOD 0.15] Upgrade planner

Post by Wexler »

After updating today I can no longer remove trees by having a Raw Wood -> Deconstruction planner entry. On 0.15.
d3x0r
Filter Inserter
Filter Inserter
Posts: 316
Joined: Sun Jun 04, 2017 8:56 am
Contact:

Re: [MOD 0.15] Upgrade planner

Post by d3x0r »

Klonan wrote: Upgrading tiles in the blueprints isn't a easy job, so i will save it for another day
But i have fixed the crash
Looks great good job :)
Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: [MOD 0.15] Upgrade planner

Post by Nexela »

Wexler wrote:After updating today I can no longer remove trees by having a Raw Wood -> Deconstruction planner entry. On 0.15.
That option has been removed as outside the scope of the mod, to remove trees either use a filtered deconstruction planner and robots, or install a mod that can handle tree removal in a non-cheaty way. Nanobots, or Explosive Termites are both good options. If you are dead set on cheaty tree removal try the "Tree Eraser" mod.
d3x0r
Filter Inserter
Filter Inserter
Posts: 316
Joined: Sun Jun 04, 2017 8:56 am
Contact:

Re: [MOD 0.15] Upgrade planner

Post by d3x0r »

Doesn't save/restore inserter position (bob's adjustable inserters)

only when the type is inserter; accessing pifckup/drop_position when it's not an inserter throws an error...

Code: Select all


  -- before default surface.create_entity (last else on belt.type leadin checks)  ( line 685, in 1.4.4)
          if( belt.type == "inserter" ) then
            inserter_pickup = belt.pickup_position;
            inserter_drop = belt.drop_position;
          end


-- later, in belt.valid else ...  (line 774 in 1.4.4; before applying the above 4 lines)
          if( new_item.type == "inserter" ) then
             new_item.pickup_position = inserter_pickup;
             new_item.drop_position = inserter_drop;
          end
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5290
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: [MOD 0.15] Upgrade planner

Post by Klonan »

The mod supports upgrading adjustable inserters,

However there is a bug in the latest 0.15 where upgrading a blueprint with a inserter with a custom pickup/dropoff vector will cause a script error

If the fix doesn't make it to 0.15 i will release an update to prevent the crash
Skovsende
Burner Inserter
Burner Inserter
Posts: 7
Joined: Sat Jul 29, 2017 3:53 pm
Contact:

Re: [MOD 0.15] Upgrade planner

Post by Skovsende »

Hi Klonan,

Love your mod - but I'm suddenly recieving this error when trying to change item that are being upgraded.

Error while running event upgrade-planner::on_gui_click (ID 1)
Index out of range.
stack traceback:
__upgrade-planner__/control.lua:144: in function 'gui_open_frame'
__upgrade-planner__/control.lua:488: in function <__upgrade-planner__/control.lua:401>

The only upgrade planned (pretty new game) was raw wood to decontruction (shame that stopped working :) ) - Might have something to do with that.

(only problem in one save game)
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5290
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: [MOD 0.15] Upgrade planner

Post by Klonan »

Skovsende wrote:Hi Klonan,

Love your mod - but I'm suddenly recieving this error when trying to change item that are being upgraded.

Error while running event upgrade-planner::on_gui_click (ID 1)
Index out of range.
stack traceback:
__upgrade-planner__/control.lua:144: in function 'gui_open_frame'
__upgrade-planner__/control.lua:488: in function <__upgrade-planner__/control.lua:401>

The only upgrade planned (pretty new game) was raw wood to decontruction (shame that stopped working :) ) - Might have something to do with that.

(only problem in one save game)
Hi,

Can you send me that save game?
Skovsende
Burner Inserter
Burner Inserter
Posts: 7
Joined: Sat Jul 29, 2017 3:53 pm
Contact:

Re: [MOD 0.15] Upgrade planner

Post by Skovsende »

Klonan wrote:
Skovsende wrote:Hi Klonan,

Love your mod - but I'm suddenly recieving this error when trying to change item that are being upgraded.

Error while running event upgrade-planner::on_gui_click (ID 1)
Index out of range.
stack traceback:
__upgrade-planner__/control.lua:144: in function 'gui_open_frame'
__upgrade-planner__/control.lua:488: in function <__upgrade-planner__/control.lua:401>

The only upgrade planned (pretty new game) was raw wood to decontruction (shame that stopped working :) ) - Might have something to do with that.

(only problem in one save game)
Hi,

Can you send me that save game?
As soon as I get home from work :)
jimmiles
Manual Inserter
Manual Inserter
Posts: 3
Joined: Tue Jun 20, 2017 7:26 pm
Contact:

Re: [MOD 0.15] Upgrade planner

Post by jimmiles »

Hi,
I'm getting a crash with the messages in the attached image.
Clipboard01.png
Clipboard01.png (2.98 MiB) Viewed 7918 times
This is the blueprint I'm working with:
Clipboard02.png
Clipboard02.png (364.2 KiB) Viewed 7918 times
The mods I'm running:
Clipboard03.png
Clipboard03.png (58.62 KiB) Viewed 7917 times
Clipboard04.png
Clipboard04.png (31.5 KiB) Viewed 7917 times
Clipboard05.png
Clipboard05.png (17.26 KiB) Viewed 7917 times
Thanks,
Jim
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5290
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: [MOD 0.15] Upgrade planner

Post by Klonan »

jimmiles wrote:Hi,
I'm getting a crash with the messages in the attached image.
Clipboard01.png
This is the blueprint I'm working with:
Clipboard02.png
The mods I'm running:
Clipboard03.png
Clipboard04.png
Clipboard05.png
Thanks,
Jim
Thanks for the report,

I looked into it, and my mod isn't the cause of the issue,
I am raising an event, with the valid entity,
The subterrain mod is then performing some logic on its 'neightbour' without verifying properly the neighbour exists

Code: Select all

function subterrainOnBuilt(event)
	if settings.global["subterrain-belt-cost-multiplier"].value <= 0 then return nil end --don't cost belts
	local entity = event.created_entity
	local player = game.players[event.player_index]
	local eName = entity.name

	--check to see if the place is important
	if not entity.belt_to_ground_type == "output" or (entity.belt_to_ground_type == "input" and not entity.neighbours) then
		return
	end

	local otherEntity = entity.neighbours
	local distance = getDistance(entity, otherEntity)
	local cost = (math.floor(distance * settings.global["subterrain-belt-cost-multiplier"].value))
	local respectiveBelts = string.gsub(eName, "subterranean", "transport")
	local respectiveBelts_pretty = respectiveBelts:gsub("-", " ") .. "s"

	otherEntity.force = "player" --set the force of the other side to player, to allow refund

	if not checkCount(player, cost, respectiveBelts) then --they don't have enough of the aboveground belts for this distance
		entity.destroy()
		player.print("You don't have enough " .. respectiveBelts_pretty ..	" in your inventory to create this length.")

		restoreDeniedItem(player,eName)
	else
		player.remove_item{name = respectiveBelts, count = cost} --deduct the required belts from their inventory
	end
end
If mod my was the issue, it would error much sooner than this function
jimmiles
Manual Inserter
Manual Inserter
Posts: 3
Joined: Tue Jun 20, 2017 7:26 pm
Contact:

Re: [MOD 0.15] Upgrade planner

Post by jimmiles »

I looked into it, and my mod isn't the cause of the issue,
I am raising an event, with the valid entity,
The subterrain mod is then performing some logic on its 'neightbour' without verifying properly the neighbour exists
If mod my was the issue, it would error much sooner than this function
Thank you!
Skovsende
Burner Inserter
Burner Inserter
Posts: 7
Joined: Sat Jul 29, 2017 3:53 pm
Contact:

Re: [MOD 0.15] Upgrade planner

Post by Skovsende »

Skovsende wrote:
Klonan wrote:
Skovsende wrote:Hi Klonan,

Love your mod - but I'm suddenly recieving this error when trying to change item that are being upgraded.

Error while running event upgrade-planner::on_gui_click (ID 1)
Index out of range.
stack traceback:
__upgrade-planner__/control.lua:144: in function 'gui_open_frame'
__upgrade-planner__/control.lua:488: in function <__upgrade-planner__/control.lua:401>

The only upgrade planned (pretty new game) was raw wood to decontruction (shame that stopped working :) ) - Might have something to do with that.

(only problem in one save game)
Hi,

Can you send me that save game?
As soon as I get home from work :)
Link to the savegame: https://www.dropbox.com/s/ap9drk2cetlouxk/Save.zip?dl=0
Link to the mod-pack: https://www.dropbox.com/s/s0lghbqgdempd ... k.zip?dl=0
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5290
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: [MOD 0.15] Upgrade planner

Post by Klonan »

Version 1.4.6 released:
  • Added support for upgrading rails and curved rails
  • Configs will be verified on configuration to check for item prototype changes
  • Fixed error with old invalid configs
  • Fixed error when dropdown index could become out of range
d3x0r
Filter Inserter
Filter Inserter
Posts: 316
Joined: Sun Jun 04, 2017 8:56 am
Contact:

Re: [MOD 0.15] Upgrade planner

Post by d3x0r »

Shift-click upgrading rails just makes rails disappear.

viewtopic.php?f=213&t=50877 (affects deconstruction and using a blueprint over deconstructed entities)
d3x0r
Filter Inserter
Filter Inserter
Posts: 316
Joined: Sun Jun 04, 2017 8:56 am
Contact:

Re: [MOD 0.15] Upgrade planner

Post by d3x0r »

upgrading a rail causes Bio Industries mod to crash... Normally when a rail is deconstructed, the event is sent with the name of the planner item, not the specific rail.

(this is a normal deconstructed scrap-rail)
60.510 Script @__Bio_Industries__/control.lua:530: tile name:scrap-rail
(this is the name logged when using the upgrade planner to replace a rail)
94.093 Script @__Bio_Industries__/control.lua:530: tile name:curved-scrap-rail

this causes the mod to fail...
94.177 Error MainLoop.cpp:940: Exception at tick 340740: Error while running event upgrade-planner::on_player_selected_area (ID 49)
Error while running event Bio_Industries::on_player_mined_item (ID 8)
__Bio_Industries__/control.lua:531: attempt to index field '?' (a nil value)
stack traceback:
__upgrade-planner__/control.lua:783: in function 'player_upgrade'
__upgrade-planner__/control.lua:562: in function 'on_selected_area'
__upgrade-planner__/control.lua:539: in function <__upgrade-planner__/control.lua:538>

This is the code that fails in bio Industries; because it's expecting an item_prototype name not an entity_prototype name... and again, normal deconstruction with deconstruction planner or by hand uses the item name not the prototype name.
local player = game.players[event.player_index]
local tile_name = event.item_stack.name
local tile = game.item_prototypes[tile_name].place_as_tile_result


Upgrade Builder and Planner source...
control.lua 783
script.raise_event(defines.events.on_player_mined_item,{player_index = player.index, item_stack = {name = n, count = 1}})
should reference
upgrade.item_from as the name, not belt.name

----

Also it will not return the proper number of rails on a curved rail replace; I should get back 4 rails and use 4 rails not just 1.
Edit: It's actually not giving me back any rails past the first one... and not using any rails. if I have none, i get back some 1... if I have 1 or more I don't back any more.
Control.lua:781
player.remove_item{name = upgrade.item_from, count = 1}
player.insert{name = upgrade.item_from, count = 1}
It's removing the same item it's restoring... so basically it doesn't use any item anymore.
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5290
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: [MOD 0.15] Upgrade planner

Post by Klonan »

d3x0r wrote:snip
All fixed in 1.4.7
Post Reply

Return to “Mods”