[MOD] Deadlock's Stacking Beltboxes & Compact Loaders
Re: [MOD 0.16.x] Deadlock's Stacking Beltbox (& Compact Loaders)
Can I suggest login the problematic icon_size in the error message in case the problem comes back?
Re: [MOD 0.16.x] Deadlock's Stacking Beltbox (& Compact Loaders)
Thanks for quick response!
I dug trough your code for hours and also found the varible c not assigned, but still used. I thought it's some modding/lua trick I don't know yet, because otherwise it would be null.
Do I need to make variables inside functions and loops local too?
I dug trough your code for hours and also found the varible c not assigned, but still used. I thought it's some modding/lua trick I don't know yet, because otherwise it would be null.
Do I need to make variables inside functions and loops local too?
- Deadlock989
- Smart Inserter
- Posts: 2529
- Joined: Fri Nov 06, 2015 7:41 pm
Re: [MOD 0.16.x] Deadlock's Stacking Beltbox (& Compact Loaders)
It's not so much "need" as just being a good idea, especially in situations like Factorio modding where you have no clue what randoms like me are doing (or not doing). When I started modding with Lua I was doing pretty much the same thing as you, and it didn't bite me on the arse until I started providing functions for other mods to use - then you have situations where you've declared a set of global variables, which some other mod then changes because they were global, then those mods or some other third mod calls your function, and nothing works like anyone expected. Making absolutely everything local unless there's a good reason not to eliminates 99% of these problems. But hey, this is amateur modding done for fun, I have no regrets, I'm not doing this for a living. Leaving that c in there was just an outright mistake that never showed up until it interacted with a mod that declares a global c.Villfuk02 wrote:Do I need to make variables inside functions and loops local too?
My understanding is that if it wasn't initially declared as local then it's not local, no matter where you're doing the declaring. Functions can (/should) also be local unless they need not to be. Some would argue there is never any need for a global function, you can declare functions as local in one file and use require and return to get another local copy of them in another file - see my loaders mod (DCL) for a better implementation of that, DSB still suffers from some less-than-ideal practices (*shrug*). In Factorio the only good reason I can think of is if you're wanting to provide functions for other mods to use in the data phase (like I do) - in the control phase you can use all that fancy remote call stuff instead, which is safer.
This helped me: http://lua-users.org/wiki/ScopeTutorial
- Deadlock989
- Smart Inserter
- Posts: 2529
- Joined: Fri Nov 06, 2015 7:41 pm
Re: [MOD 0.16.x] Deadlock's Stacking Beltbox (& Compact Loaders)
---------------------------------------------------------------------------------------------------
Deadlock's Stacking Beltboxes version: 1.6.2
Date: 15. 05. 2018
Bugfixes:
- Corrected the main internal call to stacked item recipe gen for vanilla items, which unintentionally used an uninitialised global variable for reasons lost in the mists of time.
- Corrected a typo in a variable name while sanity checking for a rare situation (unusual icon size).
---------------------------------------------------------------------------------------------------
Deadlock's Stacking Beltboxes version: 1.6.2
Date: 15. 05. 2018
Bugfixes:
- Corrected the main internal call to stacked item recipe gen for vanilla items, which unintentionally used an uninitialised global variable for reasons lost in the mists of time.
- Corrected a typo in a variable name while sanity checking for a rare situation (unusual icon size).
---------------------------------------------------------------------------------------------------
-
- Fast Inserter
- Posts: 128
- Joined: Thu Feb 08, 2018 8:25 am
- Contact:
Re: [MOD 0.16.x] Deadlock's Stacking Beltbox (& Compact Loaders)
A minor addendum to the advantages of locals: in addition to avoiding the potential for other mods stepping on your variables, there's some slight performance advantages to local variables.
A handy way to check for where all you're using globals in a file with the luac executable.
Find all the times any global is set in a file so that you can make sure all instances are intended:
Find all the global lookups done in a file (which shows a bunch of expected stuff for language functions but also locates that errant c):
A handy way to check for where all you're using globals in a file with the luac executable.
Find all the times any global is set in a file so that you can make sure all instances are intended:
Code: Select all
$ luac -p -l prototypes/public.lua | grep SETTABUP.*_ENV
5 [4] SETTABUP 0 -3 1 ; _ENV "deadlock_stacking"
Code: Select all
$ luac -p -l prototypes/recipes.lua | grep GETTABUP.*_ENV
1 [1] GETTABUP 0 0 -1 ; _ENV "require"
4 [4] GETTABUP 1 0 -3 ; _ENV "data"
...
206 [96] GETTABUP 4 0 -21 ; _ENV "pairs"
212 [97] GETTABUP 11 0 -76 ; _ENV "c"
Re: [MOD 0.16.x] Deadlock's Stacking Beltbox (& Compact Loaders)
Hi, Deadlock989.
I am sorry if I have offended you with my lack of English skills. I am using your mods well. Thank you for providing good mods.
I found a bug, so I leave a report. When I activate the "Re-style belts" option of your loader mod, Belt mod with no "hr_version" graphics will detect errors. If a mod does not have "hr_version" graphics, can you let your mod handle that part? Attach a picture of the error below.
I am immature in how to write credits and licenses in English. Can you tell me what you need to fix my mod? And can you recognize my mode as your third-party mod?
I am sorry if I have offended you with my lack of English skills. I am using your mods well. Thank you for providing good mods.
I found a bug, so I leave a report. When I activate the "Re-style belts" option of your loader mod, Belt mod with no "hr_version" graphics will detect errors. If a mod does not have "hr_version" graphics, can you let your mod handle that part? Attach a picture of the error below.
I am immature in how to write credits and licenses in English. Can you tell me what you need to fix my mod? And can you recognize my mode as your third-party mod?
- Attachments
-
- 캡처.PNG (12.94 KiB) Viewed 6428 times
- Deadlock989
- Smart Inserter
- Posts: 2529
- Joined: Fri Nov 06, 2015 7:41 pm
Re: [MOD 0.16.x] Deadlock's Stacking Beltbox (& Compact Loaders)
Xagros, your English is good, there is no problem there. There was a problem in the past that we discussed privately and that is solved and no longer an issue.
Regarding your MoreBobs mod, my issue is that it is not really an "add-on". It is a very big mod, nearly nine times as big as DCL. It collects all kinds of different things together, most of them I don't recognise. It is more of an overhaul or unification mod than an add-on. When I provided support for other mods, I assumed that these "helper" or "bridge" mods would be very simple and small, like the ones that orzelek and The_Ghost and others have made. I am reluctant to recommend something when I don't understand even half of what it does, and I'm not playing Factorio at the moment so I don't have time to find out.
Edited to add:
I have investigated the error that RubberBelts is throwing. It is a problem created by the assumptions that RubberBelts makes about vanilla transport belt entities. It makes its "crappybelt" out of a copy of the yellow belt, and it assumes that the yellow belt has a single layer of HR graphics (e.g. belt.animations.hr_version, belt.belt_horizontal.hr_version etc.). When DCL's belt styling is on, those graphics are replaced with layered animations (e.g. belt.animations.layers[0].hr_version etc.), which mean the .hr_version fields are all one level deeper and not where RubberBelts assumes they are. There is nothing I can do about that because this is literally what the belt styling is designed to do: create any arbitrary colour of belt by replacing the single layer graphic with multi-layer tinted animations. This was quite a piece of work, I had to ask the devs to tweak some rendering to make it happen.
The only method within my power to stop RubberBelts breaking is to make DCL depend on RubberBelts so that it loads first, but I'm not going to do that.
Workaround: don't use belt styling when RubberBelts is installed, it's not compatible.
Real fix: RubberBelts should build its new entity from scratch rather than copy a vanilla one and then reference fields which may no longer exist.
Regarding your MoreBobs mod, my issue is that it is not really an "add-on". It is a very big mod, nearly nine times as big as DCL. It collects all kinds of different things together, most of them I don't recognise. It is more of an overhaul or unification mod than an add-on. When I provided support for other mods, I assumed that these "helper" or "bridge" mods would be very simple and small, like the ones that orzelek and The_Ghost and others have made. I am reluctant to recommend something when I don't understand even half of what it does, and I'm not playing Factorio at the moment so I don't have time to find out.
Edited to add:
I have investigated the error that RubberBelts is throwing. It is a problem created by the assumptions that RubberBelts makes about vanilla transport belt entities. It makes its "crappybelt" out of a copy of the yellow belt, and it assumes that the yellow belt has a single layer of HR graphics (e.g. belt.animations.hr_version, belt.belt_horizontal.hr_version etc.). When DCL's belt styling is on, those graphics are replaced with layered animations (e.g. belt.animations.layers[0].hr_version etc.), which mean the .hr_version fields are all one level deeper and not where RubberBelts assumes they are. There is nothing I can do about that because this is literally what the belt styling is designed to do: create any arbitrary colour of belt by replacing the single layer graphic with multi-layer tinted animations. This was quite a piece of work, I had to ask the devs to tweak some rendering to make it happen.
The only method within my power to stop RubberBelts breaking is to make DCL depend on RubberBelts so that it loads first, but I'm not going to do that.
Workaround: don't use belt styling when RubberBelts is installed, it's not compatible.
Real fix: RubberBelts should build its new entity from scratch rather than copy a vanilla one and then reference fields which may no longer exist.
Re: [MOD 0.16.x] Deadlock's Stacking Beltbox (& Compact Loaders)
Thank you for your detailed explanation. As you say, I think my mod really includes a lot of features.Deadlock989 wrote:Xagros, your English is good, there is no problem there. There was a problem in the past that we discussed privately and that is solved and no longer an issue.
Regarding your MoreBobs mod, my issue is that it is not really an "add-on". It is a very big mod, nearly nine times as big as DCL. It collects all kinds of different things together, most of them I don't recognise. It is more of an overhaul or unification mod than an add-on. When I provided support for other mods, I assumed that these "helper" or "bridge" mods would be very simple and small, like the ones that orzelek and The_Ghost and others have made. I am reluctant to recommend something when I don't understand even half of what it does, and I'm not playing Factorio at the moment so I don't have time to find out.
Edited to add:
I have investigated the error that RubberBelts is throwing. It is a problem created by the assumptions that RubberBelts makes about vanilla transport belt entities. It makes its "crappybelt" out of a copy of the yellow belt, and it assumes that the yellow belt has a single layer of HR graphics (e.g. belt.animations.hr_version, belt.belt_horizontal.hr_version etc.). When DCL's belt styling is on, those graphics are replaced with layered animations (e.g. belt.animations.layers[0].hr_version etc.), which mean the .hr_version fields are all one level deeper and not where RubberBelts assumes they are. There is nothing I can do about that because this is literally what the belt styling is designed to do: create any arbitrary colour of belt by replacing the single layer graphic with multi-layer tinted animations. This was quite a piece of work, I had to ask the devs to tweak some rendering to make it happen.
The only method within my power to stop RubberBelts breaking is to make DCL depend on RubberBelts so that it loads first, but I'm not going to do that.
Workaround: don't use belt styling when RubberBelts is installed, it's not compatible.
Real fix: RubberBelts should build its new entity from scratch rather than copy a vanilla one and then reference fields which may no longer exist.
And thank you for checking the problem of the rubber belt. I am sorry to have to give up one of the options.
I'll let you know if you find any other issues. Thank you.
- Deadlock989
- Smart Inserter
- Posts: 2529
- Joined: Fri Nov 06, 2015 7:41 pm
Re: [MOD 0.16.x] Deadlock's Stacking Beltbox (& Compact Loaders)
OK, but if it's a problem with another mod, don't let me know, let the other mod know.Xagros wrote:And thank you for checking the problem of the rubber belt. I am sorry to have to give up one of the options.
I'll let you know if you find any other issues. Thank you.
Re: [MOD 0.16.x] Deadlock's Stacking Beltbox (& Compact Loaders)
Are you planning on changing the graphics of splitters as well?
- Deadlock989
- Smart Inserter
- Posts: 2529
- Joined: Fri Nov 06, 2015 7:41 pm
Re: [MOD 0.16.x] Deadlock's Stacking Beltbox (& Compact Loaders)
No plans, and I'm taking a break from Factorio until 0.17/1.0. I did start tinkering with splitters but they are a lot more complicated and I don't have anywhere near the skill of the Factorio artists, so it would probably just look worse in the end. I don't think the vanilla splitter and the DCM style entities clash particularly so there's no real need for it.Alkumist wrote:Are you planning on changing the graphics of splitters as well?
Re: [MOD 0.16.x] Deadlock's Stacking Beltbox (& Compact Loaders)
I published orzolek's Angelbob support posted before, as I wanted to use it without MoreBobs.
https://mods.factorio.com/mod/deadlock- ... ating-bobs
https://mods.factorio.com/mod/deadlock- ... ating-bobs
Re: [MOD 0.16.x] Deadlock's Stacking Beltbox (& Compact Loaders)
Please take it down. You violated the license thats attached to the mod itself.TRauMa wrote:I published orzolek's Angelbob support posted before, as I wanted to use it without MoreBobs.
https://mods.factorio.com/mod/deadlock- ... ating-bobs
It was not posted on mod portal partially because I was not happy with how it works with bob's only (wrong stacked icons then).
- Deadlock989
- Smart Inserter
- Posts: 2529
- Joined: Fri Nov 06, 2015 7:41 pm
Re: [MOD 0.16.x] Deadlock's Stacking Beltbox (& Compact Loaders)
You could easily have used it without MoreBobs ... by just using it without MoreBobs.TRauMa wrote:I published orzolek's Angelbob support posted before, as I wanted to use it without MoreBobs.
https://mods.factorio.com/mod/deadlock- ... ating-bobs
Instead, what you've done is take someone else's work and upload it to the mod portal, against their wishes, without asking them, while also disrespecting the license included in that mod.
I'm not impressed.
Re: [MOD 0.16.x] Deadlock's Stacking Beltbox (& Compact Loaders)
He removed the generated icons so all is ok now.Deadlock989 wrote:You could easily have used it without MoreBobs ... by just using it without MoreBobs.TRauMa wrote:I published orzolek's Angelbob support posted before, as I wanted to use it without MoreBobs.
https://mods.factorio.com/mod/deadlock- ... ating-bobs
Instead, what you've done is take someone else's work and upload it to the mod portal, against their wishes, without asking them, while also disrespecting the license included in that mod.
I'm not impressed.
That was my main concern there since icons were used with permissions of other mod authors and those are not transferrable I think.
And since I've been playing less recently I did not get to updating this mod properly and adding correct bob's stuff.
Re: [MOD 0.16.x] Deadlock's Stacking Beltbox (& Compact Loaders)
Well... If you only want to be in a standalone form in my mod, see my mod code. My mod code is also written in Bob's Extended Kaorhil. Instead, please leave a link in your mod that connects to my mod.TRauMa wrote:I published orzolek's Angelbob support posted before, as I wanted to use it without MoreBobs.
https://mods.factorio.com/mod/deadlock- ... ating-bobs
-
- Manual Inserter
- Posts: 1
- Joined: Thu Jun 07, 2018 1:25 am
- Contact:
Re: [MOD 0.16.x] Deadlock's Stacking Beltbox (& Compact Loaders)
Thanks for the great mod! I saw in the code that you mentioned not to change the STACK_SIZE of the beltbox because "bad stuff happens." I tested it anyway and the mod seemed to correct itself for pretty much everything. I saw elsewhere in this forum that the reason you chose 5 over 4 is because of the stack size of ore in vanilla. So I'm aware of that issue, but aside from stack sizes that don't divide well by 4, do you know what other problems might come with changing the STACK_SIZE to 4 for my own use? Thanks!
- Deadlock989
- Smart Inserter
- Posts: 2529
- Joined: Fri Nov 06, 2015 7:41 pm
Re: [MOD 0.16.x] Deadlock's Stacking Beltbox (& Compact Loaders)
You're welcome.SplitSilver wrote:Thanks for the great mod! I saw in the code that you mentioned not to change the STACK_SIZE of the beltbox because "bad stuff happens." I tested it anyway and the mod seemed to correct itself for pretty much everything. I saw elsewhere in this forum that the reason you chose 5 over 4 is because of the stack size of ore in vanilla. So I'm aware of that issue, but aside from stack sizes that don't divide well by 4, do you know what other problems might come with changing the STACK_SIZE to 4 for my own use? Thanks!
4 is probably the safest value after 5, it should be OK, except that stacked ore will lose some efficiency if its natural stack size is still 50 (50 doesn't have 4 as a factor). If you change ores to have a natural stack size of 100 (with Restack or many other mods which can do this) then it should all work. The value actually was 4 in the very earliest versions, it only got changed to 5 once ores became stackable. 4 makes more sense because so many people organise their buses in bands of 4 belts, but it had to be 5 in the end because it's such a common factor.
There were a lot of tweaks to beltbox crafting speed etc. after that - the code now checks for customised belt speeds in case you're using a mod like Bob's Logistics, and I never tested non-5 stacks after that - so check that the machines are running at the right speed (i.e. no backlogs, no idle time when fed a compressed belt of unstacked stuff). But I think it should be OK.
- Deadlock989
- Smart Inserter
- Posts: 2529
- Joined: Fri Nov 06, 2015 7:41 pm
Re: [MOD 0.16.x] Deadlock's Stacking Beltbox (& Compact Loaders)
---------------------------------------------------------------------------------------------------
DSB version: 1.6.3
Date: 18. 06. 2018
Changes:
- Updated the stacked battery icon to match the new vanilla battery.
- Factorio base 0.16.51 stable is required.
---------------------------------------------------------------------------------------------------
DSB version: 1.6.3
Date: 18. 06. 2018
Changes:
- Updated the stacked battery icon to match the new vanilla battery.
- Factorio base 0.16.51 stable is required.
---------------------------------------------------------------------------------------------------
Re: [MOD 0.16.x] Deadlock's Stacking Beltbox (& Compact Loaders)
Well, that's what happens when you let a month pass between doing your research and looking at the licenses, and actually doing something and publishing it. It seems I mixed up your and orzolek's mod licenses. I also was under the (wrong?) impression that you used orzolek's as base for yours.Xagros wrote:Well... If you only want to be in a standalone form in my mod, see my mod code. My mod code is also written in Bob's Extended Kaorhil. Instead, please leave a link in your mod that connects to my mod.TRauMa wrote:I published orzolek's Angelbob support posted before, as I wanted to use it without MoreBobs.
https://mods.factorio.com/mod/deadlock- ... ating-bobs
I should have a bit of time in the next days and will look at MoreBobs, to incorporate item definitions I'm missing, and using imagemagick or something alike to create the stacked icons automatically, now that I have permission by bobingabout at least (Arch666Angel seems absent for now).
From then, it'll probably be maintenance.