Use Electric Energy as Burner? Is it even possible?
Posted: Thu Jan 14, 2016 9:16 pm
I had a pretty neat idea to make a Electric car which you drive up to for example a Substation and charge it up. I'm new to modding Factorio, so this might be a really simple Problem, but
1. I want to detect if the car is in an powered Area(next to an electric Pole) so i can trigger the charge up and add up the Variable ElectricChargeOfCar which I will be using down below by seconds:
2. I want to simply make the car take a variable as a fuel level so I can charge it up with a loop(I just guess this would be simpler than trying to use energy in the burner bracket):
(Tab is not working in the Editor in this Forum so excuse the bad formating)
I hope you understand this well because I tried to explain my Problem as understandable as possible (with my knowledge of the englisch language, I'm not a native speaker)
I also already thought about solving this Problem by creating a new type like
so I can give this type all the contents the normal type "car", but just not with a burner, just with a electric charge or something else, that would be my Idea #2, even tho I still think Idea #1 (the one above) is better.
1. I want to detect if the car is in an powered Area(next to an electric Pole) so i can trigger the charge up and add up the Variable ElectricChargeOfCar which I will be using down below by seconds:
Code: Select all
local clock = os.clock
function wait(n)
local t0 = clock()
while clock() - t0 <= n do end
end
while(true)do
ElectricChargeOfCar = ElectricChargeOfCar + 1
wait(1)
end
Code: Select all
burner = {
fuellevel= ElectricChargeOfCar
}
Somewhere else, don't know where:
if (driving) then
ElectricChargeOfCar = ElectricChargeOfCar - 1
end
I hope you understand this well because I tried to explain my Problem as understandable as possible (with my knowledge of the englisch language, I'm not a native speaker)
I also already thought about solving this Problem by creating a new type like
Code: Select all
type = "newcartype"