I am trying to make a mod that adds crude early tech speed modules that slowly do damage to the machines they are placed in. Ideally I would only like the machines to be damaged when they are running (miners mining, assembly machines assembling, etc). For assembly machines the is_crafting method is perfect, but I cant use it with mining drills.
How can I determine when a machine is actually working?
Thanks for the help everyone, this is the first time I've given LUA scripting a go, normally I just stick to making plain old new entities and item mods, so this is new for me.
How to determine if machine is running?
-
- Fast Inserter
- Posts: 171
- Joined: Sun Feb 17, 2013 4:31 pm
- Contact:
Re: How to determine if machine is running?
For mining drills there is afaik no method.
Maybe the mining_state property?
Maybe the mining_state property?
-
- Filter Inserter
- Posts: 841
- Joined: Mon Sep 14, 2015 7:40 am
- Contact:
Re: How to determine if machine is running?
It would be resource-intensive, but you could check if the crafting_progress variable has changed lately, if so then crafting has clearly happened, if it hasn't changed at all, then no crafting has happened.
Re: How to determine if machine is running?
That also doesnt work for mining drills.Supercheese wrote:It would be resource-intensive, but you could check if the crafting_progress variable has changed lately, if so then crafting has clearly happened, if it hasn't changed at all, then no crafting has happened.
-
- Fast Inserter
- Posts: 171
- Joined: Sun Feb 17, 2013 4:31 pm
- Contact:
Re: How to determine if machine is running?
Alright, this at least makes me feel better that I didn't miss something simple.
Thanks for the suggestions
Thanks for the suggestions
-
- Filter Inserter
- Posts: 841
- Joined: Mon Sep 14, 2015 7:40 am
- Contact:
Re: How to determine if machine is running?
Wellp, there goes that idea.Natha wrote:That also doesnt work for mining drills.Supercheese wrote:It would be resource-intensive, but you could check if the crafting_progress variable has changed lately, if so then crafting has clearly happened, if it hasn't changed at all, then no crafting has happened.