Runtime alteration of player mining/crafting categories.

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5207
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Runtime alteration of player mining/crafting categories.

Post by eradicator »

What?

The ability to change/extend the players crafting_categories and mining_categories during runtime.

How?

Either something with an additions table "character_additional_crafting_categories = {}" or even better with direct toggling "LuaPlayer(.characer).crafting_categories['crafting'] = false".

Why?

This would give mods the ability to enhance the players capabilities (through research or else) for example as a gating mechanic to higher tier technology. Or an RPG mechanic where crafting categories are skill based and thus differ per player.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
ratchetfreak
Filter Inserter
Filter Inserter
Posts: 952
Joined: Sat May 23, 2015 12:10 pm
Contact:

Re: Runtime alteration of player mining/crafting categories.

Post by ratchetfreak »

There is also the option to put it in the force. Makes it easier to make it research adjustable. Power armor based tweaking would also be nice.
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2905
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Runtime alteration of player mining/crafting categories.

Post by darkfrei »

ratchetfreak wrote: Tue Nov 06, 2018 1:44 pm There is also the option to put it in the force. Makes it easier to make it research adjustable. Power armor based tweaking would also be nice.
Factorissimo in backpack! Roles for manual producing, smelt ore on fusion reactor and make own chemistry with barrelled fluids.
Bilka
Factorio Staff
Factorio Staff
Posts: 3310
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Runtime alteration of player mining/crafting categories.

Post by Bilka »

I am looking into adding this.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
Bilka
Factorio Staff
Factorio Staff
Posts: 3310
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Runtime alteration of player mining/crafting categories.

Post by Bilka »

LuaControl::character_additional_mining_categories has been added to 0.17.

Please let me know your usecases for the runtime modification of crafting categories.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: Runtime alteration of player mining/crafting categories.

Post by bobingabout »

Bilka wrote: Wed Feb 20, 2019 9:07 pm LuaControl::character_additional_mining_categories has been added to 0.17.

Please let me know your usecases for the runtime modification of crafting categories.
is it possible to also add mining categories as a research effect?
Currently, the steel pick has been replaced with a research, and in the old game, equiping a steel pick gave you additional power to mine more ores. what if I wanted to combine the new and old, and simply have the steel research unlock a mining category for T2 ores? Currently, with only LuaControl access to it, I would need to monitor to see if this research is unlocked, then assign the character_additional_mining_categories trait to the player entity and or player controller. (Yes, most of the existing player modifiers can be applied to the entity itself, or the player controller, and I use both in my mods for different reasons, depending if it's a class based bonus, or a player based bonus), and although I could do this, I'd much rather avoid the script completely and just use a technology unlock.



For crafting categories: the main "use case" I would have for crafting categories on a player entity would be with my classes mod. Not only do you have to choose a class on spawn, but I'm working on upgrades as you research technology and do things in play (Which is why I wanted to be able to read back achievements, for a "global" unlock, not limited to 1 game). I actually have a fair number of custom categories, like "electronics" and "electronics-machine", most of the latter is to force the recipe to be machine only, because I'm a dick. Having an unlock (again, I'd ask for both LuaControl and a technology unlock) is something I would make use of. For example, if the player were to equip a "crafting aid" suit of armor, or armor module (or just research it), then a script could add in some of those categories to let you craft them by hand instead of being forced to in a machine.

My only current use case for custom mining and crafting categories right now is the Miner class, who can smelt ores in his inventory by hand, or alloy metals together. It's exceptionally useful in the early game, especially when you're trying to get started on electronics, because you suddenly realise you need to built a special furnace to alloy tin and lead to make solder. Miner can just hand craft it to get started a lot faster.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5207
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Runtime alteration of player mining/crafting categories.

Post by eradicator »

Bilka wrote: Wed Feb 20, 2019 9:07 pm Please let me know your usecases for the runtime modification of crafting categories.
Same as bob said, the usecase would be role-playing where the player can unlock (skill based) additional hand-crafting categories independant from force research and in the order they want.
A) because changing crafting categories by swapping the attached character is incompatible with any mod that also manipulates characters (like i.e. the cloning mod where you can have several bodies and teleport to them at will).
B) because even with character swapping N unlockable hand-crafting categories require 2^N different character prototypes to support every possible unlock combination (i.e. to support 3 freely unlockable categories 8 different prototypes are required).
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Rseding91
Factorio Staff
Factorio Staff
Posts: 14360
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Runtime alteration of player mining/crafting categories.

Post by Rseding91 »

Maybe some day but your use-case is well outside of Factorios core concept so if it harms base game performance it's not going to be done.
If you want to get ahold of me I'm almost always on Discord.
Post Reply

Return to “Modding interface requests”