Page 12 of 17

Re: [MOD 0.15] Upgrade planner

Posted: Sun Jul 23, 2017 8:44 pm
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...

Re: [MOD 0.15] Upgrade planner

Posted: Sun Jul 23, 2017 9:21 pm
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

Re: [MOD 0.15] Upgrade planner

Posted: Sun Jul 23, 2017 9:29 pm
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

Re: [MOD 0.15] Upgrade planner

Posted: Sun Jul 23, 2017 9:52 pm
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

Re: [MOD 0.15] Upgrade planner

Posted: Sun Jul 23, 2017 11:20 pm
by Wexler
After updating today I can no longer remove trees by having a Raw Wood -> Deconstruction planner entry. On 0.15.

Re: [MOD 0.15] Upgrade planner

Posted: Sun Jul 23, 2017 11:25 pm
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 :)

Re: [MOD 0.15] Upgrade planner

Posted: Mon Jul 24, 2017 3:07 am
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.

Re: [MOD 0.15] Upgrade planner

Posted: Mon Jul 24, 2017 3:35 am
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

Re: [MOD 0.15] Upgrade planner

Posted: Thu Jul 27, 2017 8:33 am
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

Re: [MOD 0.15] Upgrade planner

Posted: Sat Jul 29, 2017 3:58 pm
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)

Re: [MOD 0.15] Upgrade planner

Posted: Sat Jul 29, 2017 10:07 pm
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?

Re: [MOD 0.15] Upgrade planner

Posted: Wed Aug 02, 2017 7:46 am
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 :)

Re: [MOD 0.15] Upgrade planner

Posted: Wed Aug 02, 2017 11:59 am
by jimmiles
Hi,
I'm getting a crash with the messages in the attached image.
Clipboard01.png
Clipboard01.png (2.98 MiB) Viewed 6982 times
This is the blueprint I'm working with:
Clipboard02.png
Clipboard02.png (364.2 KiB) Viewed 6982 times
The mods I'm running:
Clipboard03.png
Clipboard03.png (58.62 KiB) Viewed 6981 times
Clipboard04.png
Clipboard04.png (31.5 KiB) Viewed 6981 times
Clipboard05.png
Clipboard05.png (17.26 KiB) Viewed 6981 times
Thanks,
Jim

Re: [MOD 0.15] Upgrade planner

Posted: Wed Aug 02, 2017 2:15 pm
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

Re: [MOD 0.15] Upgrade planner

Posted: Wed Aug 02, 2017 3:05 pm
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!

Re: [MOD 0.15] Upgrade planner

Posted: Thu Aug 03, 2017 4:52 am
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

Re: [MOD 0.15] Upgrade planner

Posted: Sun Aug 06, 2017 11:05 pm
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

Re: [MOD 0.15] Upgrade planner

Posted: Mon Aug 07, 2017 5:58 am
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)

Re: [MOD 0.15] Upgrade planner

Posted: Mon Aug 07, 2017 6:12 am
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.

Re: [MOD 0.15] Upgrade planner

Posted: Mon Aug 07, 2017 8:35 am
by Klonan
d3x0r wrote:snip
All fixed in 1.4.7