Search found 1272 matches
- Sat May 07, 2022 10:05 am
- Forum: Mods
- Topic: on_player_died not working with other mods
- Replies: 2
- Views: 160
Re: on_player_died not working with other mods
I have a small mod that write some evens to a file so that I can use it to post it to Discord (https://mods.factorio.com/mod/FactoriGOChatBot-companion) One of the things is player death messages: script.on_event( defines.events.on_player_died, function(event) local player_index = event.player_inde...
- Thu May 05, 2022 5:23 am
- Forum: Modding help
- Topic: Change registered function for event handler
- Replies: 6
- Views: 159
Re: Change registered function for event handler
Is it ok to change which function is registered for a particular event based on a setting? Yes, you can assign another function (or nil to stop listening to an event). However, you must do this when the game is loading (this can be before on_load) or within an event. Also, something like this is po...
- Wed May 04, 2022 3:32 am
- Forum: Modding help
- Topic: Spreading a table out over several ticks
- Replies: 22
- Views: 886
Re: Spreading a table out over several ticks
Ok, idea 2 may not work. If anything happens to the sapling (it gets mined separate from its planter or somehow destroyed), I don't want to have to loop through the whole planters table to figure out which one it belonged to. Make 2 tables, one indexed by planter unit_number, with a lookup list of ...
- Mon May 02, 2022 10:00 am
- Forum: Modding help
- Topic: How does technology_to_unlock work for Prototype/Shortcut?
- Replies: 2
- Views: 169
Re: How does technology_to_unlock work for Prototype/Shortcut?
Rather unexpectedly technology_to_unlock means the shortcut will be available if you researched that technology already in any game. Oh, I see! That's really unexpected, it definitely should be documented. To achieve your goal you need enable the shortcut in control.lua on_research_finished with se...
- Mon May 02, 2022 12:16 am
- Forum: Modding help
- Topic: How to get the width of GUI element containers?
- Replies: 3
- Views: 253
Re: How to get the width of GUI element containers?
There is no way to read the height or width of an element. Yes, looks like it … :cry: Is there any way how I could determine the real width of character_frame, so that I can set the width of main_flow? If you want the container sizes, you must give the inner objects a fixed size. The idea was that ...
- Sun May 01, 2022 11:57 pm
- Forum: Modding help
- Topic: How does technology_to_unlock work for Prototype/Shortcut?
- Replies: 2
- Views: 169
How does technology_to_unlock work for Prototype/Shortcut?
I've defined this prototype: { type = "shortcut", name = "GCKI_car-key", action = "lua", icon = { filename = GCKI.modRoot.."/graphics/"..icon, size = 64, mipmap_count = 1, }, technology_to_unlock = "automobilism", }, I expected that the shortcut woul...
- Fri Apr 29, 2022 5:34 pm
- Forum: Modding help
- Topic: Which LuaGuiElement is in front?
- Replies: 1
- Views: 160
Which LuaGuiElement is in front?
My mod has 2 GUIs on player.gui.screen. When I turn them on, I will use LuaGuiElement.bring_to_front() to make sure they are visible. One of them ("Available characters") can become quite small, as you can see in this screenshot: overlay-guis.png In this case the small GUI is on top, so it...
- Fri Apr 29, 2022 3:27 pm
- Forum: Questions, reviews and ratings
- Topic: Thoughts about byproducts in SE and game design
- Replies: 10
- Views: 633
Re: Thoughts about byproducts in SE and game design
The discord separation helps contain the spoilers, but doesn't do much for spreading word of mouth. Discord channels aren't very stumble upon. Also, some people don't like to register at yet another place. The mod portal may not be optimal for bug reports because the Markdown is easily broken (code...
- Fri Apr 29, 2022 3:01 pm
- Forum: Modding help
- Topic: Ask for a Lua syntax
- Replies: 4
- Views: 274
Re: Ask for a Lua syntax
action = { { type = "direct", action_delivery = { { type = "projectile", projectile = "anti-material-rifle-ammo-3", starting_speed = 3, direction_deviation = 0.02, range_deviation = 0.02, max_range = 50, source_effects = { { type = "create-explosion", entity_...
- Fri Apr 29, 2022 12:41 pm
- Forum: Modding interface requests
- Topic: Small documentation improvement requests
- Replies: 244
- Views: 28067
Re: Small documentation improvement requests
About LocalisedString : concept LocalisedString … Furthermore, when an API function expects a localised string, it will also accept a regular string (i.e. not a table) which will not be translated, as well as a number or boolean, which will be converted to their textual representation. I've set [cod...
- Thu Apr 28, 2022 11:34 am
- Forum: Mods
- Topic: [MOD 1.1] "minime" is now "miniMAXIme"
- Replies: 4
- Views: 546
Re: [MOD 1.1] "minime" is now "miniMAXIme"
Version 1.1.11 comes with another GUI where players can choose individually what characters they want to have on their character selector GUI. This is useful when mods provide not only the one or two new characters you want, but many more besides. I guess it would also make sense in multiplayer game...
- Wed Apr 27, 2022 7:27 am
- Forum: Modding help
- Topic: Question about the global table
- Replies: 10
- Views: 426
Re: Question about the global table
What I need to know now is whether I can safely call something like local player_obj = game.players[player_index] or whether that might prevent saving like the docs warn about. It's OK to use that in a local definition. You can also use local entity = player.surface.create_entity{name = "car&q...
- Tue Apr 26, 2022 6:34 am
- Forum: Modding help
- Topic: on_player_dropped_item How to get item.name
- Replies: 7
- Views: 335
Re: on_player_dropped_item How to get item.name
I am looking for the correct way to remove the item from the world, permanently, to be replaced with a new item.... and the closest thing I see in LuaItemStack is clear() to clear the stack. Look again at the event data you get from on_player_dropped_item : entity :: LuaEntity The item-on-ground en...
- Mon Apr 25, 2022 1:54 pm
- Forum: Modding help
- Topic: Question about the global table
- Replies: 10
- Views: 426
Re: Question about the global table
To clarify, `global` is read-only during `script.on_load`. It is to be used only to restore event subscription states and Lua metatables. Thanks, you're right! I've confused 'game' and 'global' here: 'game' can't be accessed at all in on_load, 'global' can only be read. @ spiro9: Also 'global' can'...
- Mon Apr 25, 2022 10:03 am
- Forum: Modding help
- Topic: Question about the global table
- Replies: 10
- Views: 426
Re: Question about the global table
I'm working with a new mod project (with no prior Factorio modding experience) and I'm trying to set up something where a pseudo-infinite upgrade technology could possibly increment an integer value to track how many times that technology has been researched, assuming that's necessary. Why don't yo...
- Fri Apr 22, 2022 7:43 am
- Forum: Modding help
- Topic: Remove unlock Item from MOd Tech
- Replies: 3
- Views: 197
Re: Remove unlock Item from MOd Tech
Thx after the Edit it works. You help me realy a lot You're welcome! By the way, in case you wondered why I was going over the loop backwards: the ingredients list is a sorted array with subsequent indexes (1, 2, 3 …), no gaps between them. If you remove the second entry, everything following will ...
- Thu Apr 21, 2022 5:06 pm
- Forum: Modding help
- Topic: How to get the width of GUI element containers?
- Replies: 3
- Views: 253
How to get the width of GUI element containers?
I've this frame: local char_window = gui.add({ type = "frame", name = character_frame, caption = {"minime-GUI.gui-name-charselector-caption"}, direction = "vertical", visible = true, }) It contains a variable number of tables, where only one table will be visible at any...
- Thu Apr 21, 2022 8:37 am
- Forum: Modding help
- Topic: Heavy forest maps are 'killing' enemy camps [mod-fix]
- Replies: 5
- Views: 356
Re: Heavy forest maps are 'killing' enemy camps [mod-fix]
Fixed to latest version and work pretty well. Have i to reupload it on Mod Portal or someone moderator overwrite file on existing mod? Nobody should be able to overwrite an existing mod, even if it appears to be dead. It could very well be that a modder just takes an extended break, or doesn't have...
- Thu Apr 21, 2022 8:18 am
- Forum: Ideas and Suggestions
- Topic: In-game changelog viewer order / Changelog should default to installed version + 1
- Replies: 15
- Views: 1333
Re: In-game changelog viewer order / Changelog should default to installed version + 1
I'm not so sure about hiding old versions. It can be useful for debugging mod interaction to know in what version a certain behaviour, feature, entity etc. has been introduced. Finding nothing about it because the game decided that version was too old and the entry should be hidden would make life ...
- Wed Apr 20, 2022 7:10 pm
- Forum: Ideas and Suggestions
- Topic: In-game changelog viewer order / Changelog should default to installed version + 1
- Replies: 15
- Views: 1333
Re: In-game changelog viewer order / Changelog should default to installed version + 1
It makes sense that the in-game changelog viewer sorts the entries because there really is no order necessary in the changelog file. If you wanted to (for whatever sick reason :mrgreen:), you could list version 1.0.1 at the top, version 1.0.2 at the bottom, and version 1.0.3 between the others -- an...