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: 9261
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Mod changes in 0.13

Post by Rseding91 » Fri May 13, 2016 4:23 pm

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: 934
Joined: Sat May 23, 2015 12:10 pm
Contact:

Re: Mod changes in 0.13

Post by ratchetfreak » Fri May 13, 2016 4:38 pm

  • 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: 9261
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Mod changes in 0.13

Post by Rseding91 » Fri May 13, 2016 4:50 pm

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: 2182
Joined: Sat Mar 12, 2016 4:19 pm
Contact:

Re: Mod changes in 0.13

Post by steinio » Fri May 13, 2016 4:59 pm

Will there be any statistics about power usage and production?
Image
Transport Belt Repair Man
My little mods: Link | My favourite mods: Bob's Mods | Angel's Mods | Yuoki Railway Core | EvoGUI | Logistic Train Network
Factorio Cheat Sheet by Denis Zholob

View unread Posts

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

Re: Mod changes in 0.13

Post by Rseding91 » Fri May 13, 2016 5:10 pm

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: 2767
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Mod changes in 0.13

Post by DaveMcW » Fri May 13, 2016 5:17 pm

Can mods access any of the statistics?

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

Re: Mod changes in 0.13

Post by steinio » Fri May 13, 2016 5:29 pm

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
My little mods: Link | My favourite mods: Bob's Mods | Angel's Mods | Yuoki Railway Core | EvoGUI | Logistic Train Network
Factorio Cheat Sheet by Denis Zholob

View unread Posts

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

Re: Mod changes in 0.13

Post by Rseding91 » Fri May 13, 2016 5:47 pm

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: 2182
Joined: Sat Mar 12, 2016 4:19 pm
Contact:

Re: Mod changes in 0.13

Post by steinio » Fri May 13, 2016 5:49 pm

Nice.
etc. could / would mean anything :)
Image
Transport Belt Repair Man
My little mods: Link | My favourite mods: Bob's Mods | Angel's Mods | Yuoki Railway Core | EvoGUI | Logistic Train Network
Factorio Cheat Sheet by Denis Zholob

View unread Posts

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

Re: Mod changes in 0.13

Post by ratchetfreak » Fri May 13, 2016 7:17 pm

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 » Fri May 13, 2016 7:52 pm

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: 9261
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Mod changes in 0.13

Post by Rseding91 » Fri May 13, 2016 8:06 pm

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: 9261
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Mod changes in 0.13

Post by Rseding91 » Fri May 13, 2016 8:06 pm

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 » Fri May 13, 2016 8:32 pm

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: 1278
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: Mod changes in 0.13

Post by Choumiko » Sat May 14, 2016 2:50 pm

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: 9261
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Mod changes in 0.13

Post by Rseding91 » Sat May 14, 2016 4:10 pm

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: 934
Joined: Sat May 23, 2015 12:10 pm
Contact:

Re: Mod changes in 0.13

Post by ratchetfreak » Sat May 14, 2016 4:41 pm

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: 9261
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Mod changes in 0.13

Post by Rseding91 » Mon May 16, 2016 6:14 pm

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: 6676
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: Mod changes in 0.13

Post by bobingabout » Tue May 17, 2016 1:46 pm

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.

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

Re: Mod changes in 0.13

Post by UberWaffe » Tue May 17, 2016 2:44 pm

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”

Who is online

Users browsing this forum: No registered users