[SOLVED]Make machine not reqire energy

Place to get help with not working mods / modding interface.
Villfuk02
Long Handed Inserter
Long Handed Inserter
Posts: 79
Joined: Mon Apr 30, 2018 7:23 am
Contact:

[SOLVED]Make machine not reqire energy

Post by Villfuk02 »

i want to make a machine for crafting, which doesn't reqire power, but it doesn't let me delete the energy_source and energy_usage
Last edited by Villfuk02 on Tue May 01, 2018 2:02 pm, edited 1 time in total.
Villfuk02
Long Handed Inserter
Long Handed Inserter
Posts: 79
Joined: Mon Apr 30, 2018 7:23 am
Contact:

Re: make machine not reqire energy

Post by Villfuk02 »

Cool idea, but that means there's no way? (i tried it, and it didn't work, so it was just a suggestion)

But i got another idea how to work around it!
When you place burner inserter or roboport, it has some small amount of energy stored inside. How can i do that?
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2905
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: make machine not reqire energy

Post by darkfrei »

Villfuk02 wrote:When you place burner inserter or roboport, it has some small amount of energy stored inside. How can i do that?
http://lua-api.factorio.com/latest/LuaE ... ity.energy
Villfuk02
Long Handed Inserter
Long Handed Inserter
Posts: 79
Joined: Mon Apr 30, 2018 7:23 am
Contact:

Re: make machine not reqire energy

Post by Villfuk02 »

How exactly should i use that?

neither of the exmples below work

Code: Select all

energy_source =
    {
		type = "burner",
		usage_priority = "secondary-input",		
		fuel_inventory_size = 0,
		energy = "420kJ", 
		emissions = -0.02,
    },

Code: Select all

energy_source =
    {
		type = "burner",
		usage_priority = "secondary-input",		
		fuel_inventory_size = 0,
		emissions = -0.02,
    },
    energy = "420kJ", 
I guess I'll have to modify the energy amount after placement, but i do not know how
Villfuk02
Long Handed Inserter
Long Handed Inserter
Posts: 79
Joined: Mon Apr 30, 2018 7:23 am
Contact:

Re: make machine not reqire energy

Post by Villfuk02 »

I found out i can use

Code: Select all

/c game.player.selected.burner.currently_burning="wood"
/c game.player.selected.burner.remaining_burning_fuel=2000000
Now i only need to figure out how to apply those commands after placing the entity
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2905
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: make machine not reqire energy

Post by darkfrei »

Villfuk02 wrote:I found out i can use

Code: Select all

/c game.player.selected.burner.currently_burning="wood"
/c game.player.selected.burner.remaining_burning_fuel=2000000
Now i only need to figure out how to apply those commands after placing the entity
control.lua
http://lua-api.factorio.com/latest/even ... ilt_entity

Code: Select all

script.on_event(defines.events.on_built_entity, function(event)
  local entity = event.created_entity
  if (entity.name == 'my_entity_name') and entity.burner and entity.burner.remaining_burning_fuel then 
    burner.remaining_burning_fuel=2000000
  end
end)
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: make machine not reqire energy

Post by eradicator »

Villfuk02 wrote:I found out i can use

Code: Select all

/c game.player.selected.burner.currently_burning="wood"
/c game.player.selected.burner.remaining_burning_fuel=2000000
Now i only need to figure out how to apply those commands after placing the entity
You can not set a remaining value greater than the maximum for that fuel type. You'll have to define a new fuel item with the value you want. If you set the energy usage to 1J it should last quite a while.

Also it would be nice if you could bump the 'null' source request thread with a link to this topic. Makes it more likely that it might some day be implemented.
Villfuk02
Long Handed Inserter
Long Handed Inserter
Posts: 79
Joined: Mon Apr 30, 2018 7:23 am
Contact:

Re: make machine not reqire energy

Post by Villfuk02 »

One "wood" has exactly 2000000J of energy, so that's fine. For my purposes I have set the power consumption to 500W, so it lasts 4000 seconds, which is exactly 3 items crafted (They take very long).

I know It's off topic but i'd like a way to not be able to place the machine at the same place, until the ground is repaired. My idea is to place entities under this entity which are normally indestructible (like cliffs) and you are able to remove them by special item (like cliff explosives). Is this idea plausible, or not? And would it be possible to set up another collision layer, so only this machine is blocked by the entity?

Btw I implemented the fuel like this:

Code: Select all

script.on_event(defines.events.on_built_entity, function(event)
	local entity = event.created_entity
		if (entity.name == "basic-farmland") and entity.burner and entity.burner.remaining_burning_fuel then 
			event.created_entity.burner.currently_burning="wood"
			event.created_entity.burner.remaining_burning_fuel=2000000			
		end
	end
)
Thanks!
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: [SOLVED]Make machine not reqire energy

Post by eradicator »

Theoretically there are five collision layers not used by the base game.
https://wiki.factorio.com/Types/CollisionMask
The more mods start to use those randomly the less of a "blocks only this one machine" effect you will have though.

What is the exact thing you're trying to do? From what your explaining about crafting machines that only need to craft 3 items it's not very clear and thus hard to give better advice.
Villfuk02
Long Handed Inserter
Long Handed Inserter
Posts: 79
Joined: Mon Apr 30, 2018 7:23 am
Contact:

Re: [SOLVED]Make machine not reqire energy

Post by Villfuk02 »

Don't worry, i first went for a farm, which would deplete the foel over time, because the most basic version has no water input, so the ground dries out. It should not be placeable on concrete/stone path tiles, because it's DIRT and you put none in the crafting recipe. I also wanted for the ground to be unusable after usint the farmland there, because it'S dried out, but i then realised this mechanic would be annoying and confusing, so i just made the crafting time longer and each farm can grow crops 3 times until it has to be crafted again.
Post Reply

Return to “Modding help”