After playing arround with some selfmade turrets and rockets, wich is basically copy and paste with some litle changes to the original code. I feel it's kinda next step to do this. Even some other mods did this already aka treefarm, blueprint ... So please dont blame me for reinventing the wheel. It's just my way to getting used to all that stuff because i learned programming only in C/C++ and of course Basic. So Lua didn't apear that much different to me but sometimes i get stuck with the syntax.
I got this so far, maybe already cluttered with potential errors ?
Code: Select all
local var1 = game.findentities{{-5,-5}{5,5}}								     --get entitys in a 10*10 area
local var2 = math.random(#var1)									               --pic a random entity
if (var1[var2].type == "tree") then									           --if it's a tree
	var1[var2].destroy()											                 --destroy it
	if (game.canplaceentity{name="raw-wood", position = {-2, 0}}) then	 --check outpotside
		game.createentity{name="raw-wood", position = {-0.5, -1.3}}        --drop ""raw-wood" on ground
	end						
end
and how on earth get i this code to work with an placeable entity in the world. I thought about changing the miner to harvest wood instead of ore, at least for now.




 3 is the big one
 3 is the big one (why didn't I copy and paste from console? I'd tested it...sigh)
 (why didn't I copy and paste from console? I'd tested it...sigh)

 he has helped me more then 1 time, and most of the time i use his code and modify it slighty to my wises
 he has helped me more then 1 time, and most of the time i use his code and modify it slighty to my wises