Page 1 of 4

Mod changes in 0.13

Posted: Fri May 13, 2016 4:23 pm
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.

Re: Mod changes in 0.13

Posted: Fri May 13, 2016 4:38 pm
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?

Re: Mod changes in 0.13

Posted: Fri May 13, 2016 4:50 pm
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.

Re: Mod changes in 0.13

Posted: Fri May 13, 2016 4:59 pm
by steinio
Will there be any statistics about power usage and production?

Re: Mod changes in 0.13

Posted: Fri May 13, 2016 5:10 pm
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.

Re: Mod changes in 0.13

Posted: Fri May 13, 2016 5:17 pm
by DaveMcW
Can mods access any of the statistics?

Re: Mod changes in 0.13

Posted: Fri May 13, 2016 5:29 pm
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

Re: Mod changes in 0.13

Posted: Fri May 13, 2016 5:47 pm
by Rseding91
Ah, yes:

Code: Select all

- Added LuaFlowStatistics - used to read/write statistics data related to a given force (production, kills, etc).

Re: Mod changes in 0.13

Posted: Fri May 13, 2016 5:49 pm
by steinio
Nice.
etc. could / would mean anything :)

Re: Mod changes in 0.13

Posted: Fri May 13, 2016 7:17 pm
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?

Re: Mod changes in 0.13

Posted: Fri May 13, 2016 7:52 pm
by ArderBlackard
No news about vehicles :(. They seem to be underestimated a bit

Re: Mod changes in 0.13

Posted: Fri May 13, 2016 8:06 pm
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.

Re: Mod changes in 0.13

Posted: Fri May 13, 2016 8:06 pm
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?

Re: Mod changes in 0.13

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

Re: Mod changes in 0.13

Posted: Sat May 14, 2016 2:50 pm
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?

Re: Mod changes in 0.13

Posted: Sat May 14, 2016 4:10 pm
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.

Re: Mod changes in 0.13

Posted: Sat May 14, 2016 4:41 pm
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).

Re: Mod changes in 0.13

Posted: Mon May 16, 2016 6:14 pm
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.

Re: Mod changes in 0.13

Posted: Tue May 17, 2016 1:46 pm
by bobingabout
It definitely looks like some interesting modding opportunities are going to be available when 0.13 hits release.

Re: Mod changes in 0.13

Posted: Tue May 17, 2016 2:44 pm
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