Mod changes in 0.13

Place to post guides, observations, things related to modding that are not mods themselves.
Rseding91
Factorio Staff
Factorio Staff
Posts: 14142
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Mod changes in 0.13

Post by Rseding91 »

With 0.13 nearing and the list of changes getting closer to being "final" I figured now is a good time to let everyone know about breaking changes coming to the mod API in 0.13.
BREAKING CHANGES
Most of these changes are simple find->replace changes but a few of them will completely break some mods that weren't written correctly (game.player instead of the correct game.players[index]).

And just so you're not discouraged by those breaking changes this is the list of additions/new things coming in 0.13 related to the mod API:
ADDITIONS
As with last time: the list is not finalized so things might change slightly (not likely) and there might be a few small things we didn't include in the lists (by mistake). If you've got any questions just ask.
If you want to get ahold of me I'm almost always on Discord.

ratchetfreak
Filter Inserter
Filter Inserter
Posts: 952
Joined: Sat May 23, 2015 12:10 pm
Contact:

Re: Mod changes in 0.13

Post by ratchetfreak »

  • Added LuaInventory::get_filter, set_filter, has_filters, can_set_filter methods to set/get/clear filters on inventories that support them.
will non moveable entites (like chests) have filter-supported inventories?

Rseding91
Factorio Staff
Factorio Staff
Posts: 14142
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Mod changes in 0.13

Post by Rseding91 »

ratchetfreak wrote:
  • Added LuaInventory::get_filter, set_filter, has_filters, can_set_filter methods to set/get/clear filters on inventories that support them.
will non moveable entites (like chests) have filter-supported inventories?
No.
If you want to get ahold of me I'm almost always on Discord.

User avatar
steinio
Smart Inserter
Smart Inserter
Posts: 2638
Joined: Sat Mar 12, 2016 4:19 pm
Contact:

Re: Mod changes in 0.13

Post by steinio »

Will there be any statistics about power usage and production?
Image

Transport Belt Repair Man

View unread Posts

Rseding91
Factorio Staff
Factorio Staff
Posts: 14142
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Mod changes in 0.13

Post by Rseding91 »

steinio wrote:Will there be any statistics about power usage and production?
There's already statistics about power usage and production? I'm not sure what you're referring to.
If you want to get ahold of me I'm almost always on Discord.

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3713
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Mod changes in 0.13

Post by DaveMcW »

Can mods access any of the statistics?

User avatar
steinio
Smart Inserter
Smart Inserter
Posts: 2638
Joined: Sat Mar 12, 2016 4:19 pm
Contact:

Re: Mod changes in 0.13

Post by steinio »

Yes sorry for my short words. I assumed everbody knows this is the thread about mods (and scripting) in 0.13 so the complete question would be:
Will there be any statistics about power usage and production accessable by mods.
If they really exist don't know the class, sorry then.

Greetings steinio
Image

Transport Belt Repair Man

View unread Posts

Rseding91
Factorio Staff
Factorio Staff
Posts: 14142
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Mod changes in 0.13

Post by Rseding91 »

Ah, yes:

Code: Select all

- Added LuaFlowStatistics - used to read/write statistics data related to a given force (production, kills, etc).
If you want to get ahold of me I'm almost always on Discord.

User avatar
steinio
Smart Inserter
Smart Inserter
Posts: 2638
Joined: Sat Mar 12, 2016 4:19 pm
Contact:

Re: Mod changes in 0.13

Post by steinio »

Nice.
etc. could / would mean anything :)
Image

Transport Belt Repair Man

View unread Posts

ratchetfreak
Filter Inserter
Filter Inserter
Posts: 952
Joined: Sat May 23, 2015 12:10 pm
Contact:

Re: Mod changes in 0.13

Post by ratchetfreak »

Rseding91 wrote:
ratchetfreak wrote:
  • Added LuaInventory::get_filter, set_filter, has_filters, can_set_filter methods to set/get/clear filters on inventories that support them.
will non moveable entites (like chests) have filter-supported inventories?
No.
I meant in the prototype, will we be able to say "make this chest's inventory filterable"?

If not is there any technical reason why?

User avatar
ArderBlackard
Long Handed Inserter
Long Handed Inserter
Posts: 74
Joined: Thu May 05, 2016 12:41 pm
Contact:

Re: Mod changes in 0.13

Post by ArderBlackard »

No news about vehicles :(. They seem to be underestimated a bit
Gib dich hin bis du Glück bist

Rseding91
Factorio Staff
Factorio Staff
Posts: 14142
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Mod changes in 0.13

Post by Rseding91 »

ratchetfreak wrote:I meant in the prototype, will we be able to say "make this chest's inventory filterable"?

If not is there any technical reason why?
No, changing the type of an inventory requires the GUI for that inventory be setup to handle filters along with saving and loading that inventory with filters and adjusting the insertion logic for the GUI, the entity, and the checks on the inventory.

All of that aside: there's little/no gameplay value in supporting filters in random chest inventories and *tons* of work to try to make that work in a generic way.
If you want to get ahold of me I'm almost always on Discord.

Rseding91
Factorio Staff
Factorio Staff
Posts: 14142
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Mod changes in 0.13

Post by Rseding91 »

ArderBlackard wrote:No news about vehicles :(. They seem to be underestimated a bit
Huh? What do vehicles have to do with the mod API?
If you want to get ahold of me I'm almost always on Discord.

User avatar
ArderBlackard
Long Handed Inserter
Long Handed Inserter
Posts: 74
Joined: Thu May 05, 2016 12:41 pm
Contact:

Re: Mod changes in 0.13

Post by ArderBlackard »

Collision checking with arbitrary orientation :) ((whispers) and pathfinding)
I'm sorry if it seems that I'm pushing this too hard. I just try to implement vehicles that can drive on their own - this is the reason of all my requests. If it's too complex - I'll try to get the best from the provided functionality.
Gib dich hin bis du Glück bist

Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: Mod changes in 0.13

Post by Choumiko »

Rseding91 wrote: - Changed game.players, game.surfaces, game.entity_prototypes, game.item_prototypes, game.fluid_prototypes, force.recipes, force,technologies
to use custom access + iterator objects for improved performance.
custom access + iterator refers to changes in the c++ side? So accessing stays the same on the lua side?
Rseding91 wrote: - Added several player related events: on_player_cursor_stack_changed, on_player_main_inventory_changed, on_player_quickbar_inventory_changed,
on_player_tool_inventory_changed, on_player_armor_inventory_changed, on_player_ammo_inventory_changed, on_player_gun_inventory_changed,
on_player_placed_equipment, on_player_removed_equipment, on_pre_player_died, on_player_died, on_player_respawned, on_player_joined_game, on_player_left_game
Has on_player_opened not made it into 0.13 (yet?) or forgot to add it to the list? (viewtopic.php?f=28&t=24669)
Rseding91 wrote: - Added optional "player_index" to on_marked_for_deconstruction/on_canceled_deconstruction when fired due to player actions.
This field is nil when fired from from script/non player action.
- Added a new item type "selection-tool" that fires the events on_player_selected_area and on_player_alt_selected_area.
- LuaEntity has built_by read/write.
Oh yes! :D
What's LuaEntity.built_by ? player_index or nil if it was a robot ?

Also i vaguely remember in some FFF that there will be some unique identifier for players (not necessarily for the api, but in MP so that a ban for that (steam) account would be possible?
And FFF #138 mentions LuaEntity.get_control_behavior() / luaEntity.get_or_create_control_behavior() does this include a method for getting the value of a specific signal, the signal value a condition is checked against?

Rseding91
Factorio Staff
Factorio Staff
Posts: 14142
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Mod changes in 0.13

Post by Rseding91 »

Choumiko wrote:custom access + iterator refers to changes in the c++ side? So accessing stays the same on the lua side?
ipairs might not work (but that doesn't matter at all - just use pairs) and you can't save the iterator correct.
Choumiko wrote:Has on_player_opened not made it into 0.13 (yet?) or forgot to add it to the list? (viewtopic.php?f=28&t=24669)
It's not in 0.13 yet. I might get around to adding it but I don't know - it has some complications.
Choumiko wrote:Oh yes! :D
What's LuaEntity.built_by ? player_index or nil if it was a robot ?
LuaPlayer or nil.
Choumiko wrote:Also i vaguely remember in some FFF that there will be some unique identifier for players (not necessarily for the api, but in MP so that a ban for that (steam) account would be possible?
And FFF #138 mentions LuaEntity.get_control_behavior() / luaEntity.get_or_create_control_behavior() does this include a method for getting the value of a specific signal, the signal value a condition is checked against?
I'm not sure on the player identifier. Logistic signals can be gotten from the logistic network already. Circuit signals is on my to-do still because it had some complications in making it work well.
If you want to get ahold of me I'm almost always on Discord.

ratchetfreak
Filter Inserter
Filter Inserter
Posts: 952
Joined: Sat May 23, 2015 12:10 pm
Contact:

Re: Mod changes in 0.13

Post by ratchetfreak »

Rseding91 wrote:
ratchetfreak wrote:I meant in the prototype, will we be able to say "make this chest's inventory filterable"?

If not is there any technical reason why?
No, changing the type of an inventory requires the GUI for that inventory be setup to handle filters along with saving and loading that inventory with filters and adjusting the insertion logic for the GUI, the entity, and the checks on the inventory.

All of that aside: there's little/no gameplay value in supporting filters in random chest inventories and *tons* of work to try to make that work in a generic way.
It feels like you could reuse a lot of the code for the cargo wagons, the GUI and inserter logic at least.

And a mod could for example create a massive inventory that could only take a single item but hold more than a chest. For that you need a filterable inventory and a way for the mod to set the filter and prevent the player from adjusting it (or when he adjusts one it adjusts them all).

Rseding91
Factorio Staff
Factorio Staff
Posts: 14142
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Mod changes in 0.13

Post by Rseding91 »

I updated the main post with a few more things added over the weekend.

Code: Select all

- Added LuaGuiElement::tooltip read/write - a localized tooltip for any GUI element.
- Added LuaCircuitNetwork readable off entities with circuit network connections and through control behaviors.
- Added a new entity type "electric-energy-interface" that can consume, produce, and accept energy while also allowing all of its electric network parameters to be configured runtime.
- Added flags to energy_source prototypes "render_no_network_icon" and "render_no_power_icon" to prevent rendering those icons when set.
If you want to get ahold of me I'm almost always on Discord.

User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: Mod changes in 0.13

Post by bobingabout »

It definitely looks like some interesting modding opportunities are going to be available when 0.13 hits release.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

UberWaffe
Fast Inserter
Fast Inserter
Posts: 203
Joined: Mon May 04, 2015 4:53 am
Contact:

Re: Mod changes in 0.13

Post by UberWaffe »

Rseding91 wrote: - Added new research options: character-crafting-speed, character-mining-speed, character-running-speed, character-build-distance, character-item-drop-distance,
character-reach-distance, character-resource-reach-distance, character-item-pickup-distance, character-loot-pickup-distance, character-inventory-slots-bonus,
deconstruction-time-to-live, character-health-bonus
- Added modifiers to the character entity that stack with the force research bonuses but are unique to the character: character_crafting_speed_modifier, character_mining_speed_modifier,
character_running_speed_modifier, character_build_distance_bonus, character_item_drop_distance_bonus, character_reach_distance_bonus, character_resource_reach_distance_bonus,
character_item_pickup_distance_bonus, character_loot_pickup_distance_bonus, quickbar_count_bonus, character_inventory_slots_bonus, character_logistic_slot_count_bonus,
character_trash_slot_count_bonus, character_maximum_following_robot_count_bonus, character_health_bonus
WOOT!!
0.13 sounds like it is going to be another great step forward. :P

Post Reply

Return to “Modding discussion”