Page 1 of 1

more lua functionality for mods

Posted: Thu Feb 28, 2013 4:56 pm
by ficolas
Lua apis that I think that should be added, because they can be very usefull

Calling a lua event from a .json item definition.

Like for example:
when you use item "gift" the event itemused.gift is called

Code: Select all

if event="itemused.gift" then
    i=math.random(1,3)
    if i==1 then
		game.getplayer().insert{name="iron-plate", count=8}
	elseif i==2 then
		game.getplayer().insert{name="inserter", count=4}
	elseif i==3 then
		game.getplayer().insert{name="alien-artifact", count=2}
	end
end
way of adding drop entities to the map (alredy said to kovarex)
rotation of an entity (alredy said to kovarex)
a function to get the cords of all the entitys with that name in the game (alredy sugested to kovarex)

with those three we can create for example a wood farm, that drops wood like the drill, but with wood, and things like that

Re: more lua functionality for mods

Posted: Thu May 28, 2015 2:59 pm
by ssilk
Necroing.

Unclear what the state of this is. Are there such lua-methods? Is this even possible? Needed?

Re: more lua functionality for mods

Posted: Thu May 28, 2015 7:31 pm
by Rseding91
ssilk wrote:Necroing.

Unclear what the state of this is. Are there such lua-methods? Is this even possible? Needed?
Everything requested has been added at some point and now exists in 0.11.22.

Re: more lua functionality for mods

Posted: Thu May 28, 2015 8:10 pm
by Koub
All right then, moved to implemented.