Search found 1025 matches

by Honktown
Sat Dec 07, 2019 10:57 pm
Forum: Modding help
Topic: Don't hard-error a game on a nil value in 'game'
Replies: 22
Views: 3631

Re: Don't hard-error a game on a nil value in 'game'

That's... what I did. I had if game.item_prototypes[name] and game.item_prototypes[name].attribute instead of [attribute] and it threw an error and quit the game I was playing. Because .attribute didn't exist it said you can't access a nil, instead of returning to me the damn nil.
by Honktown
Sat Dec 07, 2019 9:10 pm
Forum: Modding help
Topic: Don't hard-error a game on a nil value in 'game'
Replies: 22
Views: 3631

Re: Don't hard-error a game on a nil value in 'game'

nil is not an error. Instead for safety I have to do pairs() over an entry, and if the key matches what I'm looking for, store it, and then check my local variable afterwards. It doesn't save me effort, and it is pretty much the same, but it's not a convention I prefer to use.
by Honktown
Sat Dec 07, 2019 7:03 pm
Forum: Modding help
Topic: Don't hard-error a game on a nil value in 'game'
Replies: 22
Views: 3631

Don't hard-error a game on a nil value in 'game'

I do my own error handling, so if I access a nil in for example game.item_prototypes, I can act on if it is nil. Instead, the game just goes ERROR and exits the current game, leaving a mod with no options. If I could transfer data from the data-final-fixes state or had another way to store any data....
by Honktown
Sat Dec 07, 2019 5:18 pm
Forum: Modding help
Topic: How to most-UPS-friendly check how much of a stack would be insertable into an inventory
Replies: 4
Views: 1163

Re: How to most-UPS-friendly check how much of a stack would be insertable into an inventory

Okay, I figured out my stupid issue. For whatever reason using serpent() on in-game tables tends to produce crap. Items are stored in game.item_prototypes, with the key being the item-name-key thing. It doesn't store them like data.raw in different categories. All the things are in game.item_prototy...
by Honktown
Sat Dec 07, 2019 4:39 pm
Forum: Modding help
Topic: How to most-UPS-friendly check how much of a stack would be insertable into an inventory
Replies: 4
Views: 1163

Re: How to most-UPS-friendly check how much of a stack would be insertable into an inventory

Forgot to mention, the mod I'm messing with DOES do exactly that, but it doesn't track stack difference. It inserts the item, and insert returns how many were inserted. For the mod, if it inserted too many, it spills out the rest onto the ground. It's easy enough to do inventory.remove instead of in...
by Honktown
Sat Dec 07, 2019 4:37 pm
Forum: Modding help
Topic: How to most-UPS-friendly check how much of a stack would be insertable into an inventory
Replies: 4
Views: 1163

Re: How to most-UPS-friendly check how much of a stack would be insertable into an inventory

I'd use the stack size, and modulo how many are in the inventory, or find the last inventory space with that item in it and modulo that. I was going to post a semi-related question, how do I FIND data during run-time, or save it during data-final-fixes? I need the stack size for something I'm trying...
by Honktown
Sat Dec 07, 2019 4:33 pm
Forum: Modding help
Topic: Do an operation each n tick not submitted with on_tick event
Replies: 13
Views: 2925

Re: Do an operation each n tick not submitted with on_tick event

Don't iterate over a table you're editing. It's undefined normally, don't know if Factorio's version of Lua changes it. You should make a temp table of keys, where each key in pairs(first_table) is stored, using table.insert(temp_table, key). Then do for i in ipairs(temp_table) do... myfunction( fir...
by Honktown
Sat Dec 07, 2019 4:04 pm
Forum: Modding help
Topic: Can I detect if a player (not a radar) revealed a chunk?
Replies: 8
Views: 1700

Re: Can I detect if a player (not a radar) revealed a chunk?

When a chunk is charted you can iterate over the players and see if they're at "charting distance". That would determine if a player charted the chunk vs a radar. A local variable to the mod can be used to store how many times the event fired, and only give out rewards on the next tick bas...
by Honktown
Thu Dec 05, 2019 9:22 am
Forum: Won't fix.
Topic: [0.17.79] Tooltip for pumps display incorrect speed (12800/s?)
Replies: 9
Views: 3689

Re: [0.17.79] Tooltip for pumps display incorrect speed (12800/s?)

There's been a longstanding complaint that pump numbers seem way off. ANY fluid only transfers at a max of 1200/sec at a 100->0 connection through piping or from tank-to-tank. Unless pumps have some special logic if they're connected end-to-end, it doesn't make sense.
by Honktown
Thu Dec 05, 2019 9:08 am
Forum: Gameplay Help
Topic: Does "Select for cancel deconstruction" not work?
Replies: 4
Views: 1307

Re: Does "Select for cancel deconstruction" not work?

Bilka wrote:
Thu Dec 05, 2019 9:06 am
Alt + D/shortcut to get the planner and then do the thing.
wew. that does indeed do the thing. I don't even need to keep holding alt-d
by Honktown
Thu Dec 05, 2019 8:58 am
Forum: Gameplay Help
Topic: Does "Select for cancel deconstruction" not work?
Replies: 4
Views: 1307

Re: Does "Select for cancel deconstruction" not work?

Queued deconstruction orders can be cancelled by holding Shift while click-dragging a deconstruction planner over the affected area. When Shift is held down the area selection border will change from red to blue to indicate cancellation mode is in effect. https://wiki.factorio.com/images/Deconstruc...
by Honktown
Thu Dec 05, 2019 8:46 am
Forum: Gameplay Help
Topic: Does "Select for cancel deconstruction" not work?
Replies: 4
Views: 1307

Does "Select for cancel deconstruction" not work?

Simply as title says. I've had stuff with red X's on it, and tried shift clicking, and it does nothing, or removes power lines from power poles. I tried rebinding it to ctrl-shift-click and it still doesn't do anything.
by Honktown
Thu Dec 05, 2019 8:44 am
Forum: Implemented Suggestions
Topic: Shift+selecting with an upgrade planner should downgrade instead
Replies: 7
Views: 3617

Re: Shift+selecting with an upgrade planner should downgrade instead

I run into this issue sometimes with blueprints. I just tested it, and turns out you can use an upgrade planner on blueprints, so you can make a specific 'downgrade' planner, use a normal blueprint, shift-click to ghost-place everything, and then use the down-grade planner on the ghosts to alter the...
by Honktown
Thu Dec 05, 2019 8:37 am
Forum: Technical Help
Topic: Why is my UPS low?
Replies: 35
Views: 10460

Re: Why is my UPS low?

I had no idea the number of slots in a container affected performance. That's the first thing we told you : that warehouses could be the source of your issues :). Train pathfinding and warehouses are my best guesses for your low UPS. Train pathfinding and warehouses are my best guesses for your low...
by Honktown
Thu Dec 05, 2019 8:31 am
Forum: Won't fix.
Topic: [0.17.79] Crash while saving, in lua (table expected)
Replies: 15
Views: 4507

Re: [0.17.79] Crash while saving, in lua (table expected)

Ok, I removed all the OOP crap, greatly simplified and reduced the code base and everything is working as it should. Not sure why gnzzz decided all that crap was necessary when it wasn't. In any event, it's working now (well it worked before other than causing a crash when saving) and the total scr...
by Honktown
Thu Dec 05, 2019 12:05 am
Forum: Technical Help
Topic: Why is my UPS low?
Replies: 35
Views: 10460

Re: Why is my UPS low?

Kidster3001 wrote:
Wed Dec 04, 2019 7:34 am
Now, if they could interfere with each other it would spoil that fun. My inserters would bust each other to pieces in that case.
Oh my god. That would make a great mod. 1x1 inserters next to eachother could collide, the longer ones would need more space.
by Honktown
Wed Dec 04, 2019 11:19 pm
Forum: Won't fix.
Topic: [0.17.79] Crash while saving, in lua (table expected)
Replies: 15
Views: 4507

Re: [0.17.79] Crash while saving, in lua (table expected)

gabberworld wrote:
Wed Dec 04, 2019 10:48 pm
this what happens when vandalize the original Lua, those who know that language sometime have no idea that some stuff missing by default at here
I'd blame the mod author and object orientation. For some reason he uses a file someone wrote in 2011 which does some crazy metatable bullshit.
by Honktown
Wed Dec 04, 2019 10:48 pm
Forum: Minor issues
Topic: [Dominik] (very small detail) Evolution settings bars don't reach edge
Replies: 1
Views: 1158

[Dominik] (very small detail) Evolution settings bars don't reach edge

When making a new game, if you set the evolution factor bars to the extremes, some don't reach the edge.
grr.png
grr.png (426.48 KiB) Viewed 1158 times
Edit: HAHA OH WOW. It depends on how you move the mouse. If you move them over and over they reach different stopping points.
by Honktown
Wed Dec 04, 2019 10:42 pm
Forum: Not a bug
Topic: damage isn't rounded well?
Replies: 14
Views: 3883

Re: damage isn't rounded well?

The player regenerates instantly. The faster regeneration happens after not being in combat. Also, there's nothing here to "fix". Pardon if I'm wrong, the player heals instantly from capsules, but as I understand it there's no base regen after getting hit? I've seen mods that completely d...
by Honktown
Wed Dec 04, 2019 10:33 pm
Forum: Not a bug
Topic: damage isn't rounded well?
Replies: 14
Views: 3883

Re: damage isn't rounded well?

I wasn't thinking about regen. A way to "fix" this would be to apply regen some time after taking damage - say .5 or 1 second. Then I'd expect the numbers to work out: as long as I shot the biter twice in less than a second, it dies. I'd say in most games this is how regen works - regenera...

Go to advanced search