Search found 214 matches

by PFQNiet
Sat Jul 31, 2021 10:08 pm
Forum: Modding help
Topic: Spawn Item Command?
Replies: 4
Views: 43872

Re: Spawn Item Command?

Code: Select all

/editor
Find Compilatron in the Enemies category.
by PFQNiet
Fri Jul 30, 2021 2:19 pm
Forum: Modding interface requests
Topic: LuaItemStack#split_stack
Replies: 0
Views: 39

LuaItemStack#split_stack

If I want to transfer some portion of an item stack then I have to manipulate the stack's count. If that item stack could have durability, then this needs additional handling. I created this function in Lua: ---@param source LuaItemStack ---@param destination LuaItemStack ---@param count uint functi...
by PFQNiet
Wed Jul 28, 2021 8:44 pm
Forum: Modding interface requests
Topic: Linked chest wire interface
Replies: 2
Views: 122

Re: Linked chest wire interface

Although, setting linked chest ID by circuit signal would be interesting...
by PFQNiet
Tue Jul 27, 2021 1:57 pm
Forum: Modding help
Topic: Collision logic for ghosts
Replies: 0
Views: 64

Collision logic for ghosts

I have a floor-type entity, that other entities can be built on top of. Or you can build floor underneath existing buildings, but that's not important. This all works fine for actual entities, but when dealing with ghosts it gets a bit odd. Basically if I copy-paste the build then the ghosts are all...
by PFQNiet
Mon Jul 26, 2021 5:23 pm
Forum: Modding interface requests
Topic: Hide 0W electric-energy-interface from power graph
Replies: 3
Views: 116

Re: Hide 0W electric-energy-interface from power graph

I'm not convinced that's a bad thing. When an item stops being produced for long enough to fall off the production graph, that item disappears.
by PFQNiet
Mon Jul 26, 2021 11:17 am
Forum: Modding interface requests
Topic: Hide 0W electric-energy-interface from power graph
Replies: 3
Views: 116

Hide 0W electric-energy-interface from power graph

If an electric-energy-interface is set up to produce power, then it will also show on the Consumption side as draining 0W. Conversely, an interface that consumes power shows as "producing" 0W in the graph. Basically, it's superfluous at best and confusing at worst. Similarly, if an interfa...
by PFQNiet
Sun Jul 25, 2021 9:46 pm
Forum: Ideas and Requests For Mods
Topic: Control Spotify from factorio
Replies: 3
Views: 145

Re: Control Spotify from factorio

Does your keyboard not have media keys? Even if there aren't dedicated keys, there's usually a key combo to quickly skip to the next track. And if there isn't, any decent music player should provide hotkey functionality.
by PFQNiet
Sun Jul 25, 2021 9:45 pm
Forum: Modding interface requests
Topic: Trigger on_force_created for default forces
Replies: 2
Views: 106

Re: Trigger on_force_created for default forces

Ah that's a fair point. I hadn't considered that! Thanks for pointing it out.
by PFQNiet
Sun Jul 25, 2021 11:59 am
Forum: Modding interface requests
Topic: Trigger on_force_created for default forces
Replies: 2
Views: 106

Trigger on_force_created for default forces

Even though they are the default forces that always exist, I sort of imagined they'd be created at some point. However, on_force_created is not called for any of the player, enemy or neutral default forces. My workaround: event_handler.add_lib{ on_init = function() on_force_created{name=defines.even...
by PFQNiet
Sat Jul 24, 2021 8:31 pm
Forum: Ideas and Requests For Mods
Topic: Switch a switch with a simple clic
Replies: 5
Views: 178

Re: Switch a switch with a simple clic

Welcome to the realm of modding :D Make sure you understand what the code is doing and I hope to see your creations in future!
by PFQNiet
Sat Jul 24, 2021 11:18 am
Forum: Ideas and Requests For Mods
Topic: Switch a switch with a simple clic
Replies: 5
Views: 178

Re: Switch a switch with a simple clic

The power switch's GUI does have other uses, notably when using it with the circuit network, so I wouldn't advise bypassing it entirely. However, you can add a custom-input to work with it. data.lua: data:extend{ { type = "custom-input", name = "toggle-power-switch", key_sequence...
by PFQNiet
Fri Jul 23, 2021 6:41 pm
Forum: Technical Help
Topic: Failure loading mod
Replies: 7
Views: 315

Re: Failure loading mod

The error message says that you have K2SETweaks enabled and it's trying to load space-exploration but space-exploration isn't enabled. Normally this shouldn't happen because space-exploration should be listed as a dependency, but the mod author neglected to include it. This may be because it's inten...
by PFQNiet
Wed Jul 21, 2021 9:16 am
Forum: Modding interface requests
Topic: on_chunk_generated_by_pollution event
Replies: 9
Views: 254

Re: on_chunk_generated_by_pollution event

Aside from the fact that it would fire constantly, events cannot prevent things from happening. When you get the event, the chunk has already been generated and the best you can do is immediately destroy it again, but as Dave pointed out it'll just regenerate over and over.
by PFQNiet
Mon Jul 19, 2021 9:41 pm
Forum: Modding help
Topic: Cacheability of inventories
Replies: 6
Views: 219

Re: Cacheability of inventories

Right. I'm not explaining this very well XD I am storing a reference to the entity, so entity.valid will be available to me. I want to know if it is "safe" to store the entity's inventory's first slot as well, so that I don't have to query the game for it each time I want to access that sl...
by PFQNiet
Mon Jul 19, 2021 12:33 pm
Forum: Modding help
Topic: Cacheability of inventories
Replies: 6
Views: 219

Re: Cacheability of inventories

If I know that the entity I'm working with is a "container" with a 1-slot inventory, is it safe to assume: if entity.valid then local slot = entity.get_inventory(defines.inventory.chest)[1] -- slot IS valid here, right? end The slot will be valid, and will continue to be valid until the en...
by PFQNiet
Mon Jul 19, 2021 8:51 am
Forum: Modding help
Topic: Cacheability of inventories
Replies: 6
Views: 219

Cacheability of inventories

I've noticed my code is actually doing "entity.get_inventory(...)" in a less-than-optimal manner. Can I just save a reference to the LuaInventory in global and use that in future calls, instead of having to query the game engine for it? Similarly, what about stacks within that inventory? I...
by PFQNiet
Sun Jul 18, 2021 9:55 am
Forum: Modding interface requests
Topic: Small documentation improvement requests
Replies: 88
Views: 5867

Re: Small documentation improvement requests

The name last_user implies it updates when someone uses the entity. But it is described as "the player who built the entity". But it is read-write. And it changes on assemblers when the recipe is changed. Also it can be nil. Basically, it's woefully inadequate in its documentation right n...
by PFQNiet
Wed Jul 14, 2021 11:12 am
Forum: Modding interface requests
Topic: "order" parameter for LuaGuiElement#add
Replies: 0
Views: 100

"order" parameter for LuaGuiElement#add

Having just implemented this myself in Lua, I figured I'd ask if this could be made part of the engine-side code: local function findIndexForNewElement(parent, order) local index = 1 for i=1,#parent.children do if (parent.children[i].tags['order'] or "") < order then index = index + 1 else...
by PFQNiet
Sat Jul 10, 2021 10:45 am
Forum: Modding interface requests
Topic: LuaRendering#draw_polyline
Replies: 0
Views: 89

LuaRendering#draw_polyline

I'd like to request the ability to draw a polyline. It would use all of the parameters of draw_line, but instead of "from" and "to", it would use draw_polygon's "vertices" (named "points") and "target". Optionally have a "closed" parameter ...

Go to advanced search