Page 1 of 1

[0.2.10] Modloader

Posted: Sat Mar 16, 2013 5:08 pm
by ficolas
Well so I have created a modloader, this is more a concept than a mod, because is very short, to use it, you need to do this to your code:

yourmod.lua

Code: Select all

module(..., package.seeall)
function all()
--your code mod goes here
end
And to make it work, you need to place it in the lualib folder, and edit this file:
modlist.lua

Code: Select all

module(..., package.seeall)
require "nameofyourmod"
function all()
	nameofyourmod.all()
end
And adding more than one mods you can do this

Code: Select all

module(..., package.seeall)
require "nameoffirstmod"
require "nameofsecondmod"
function all()
	nameoffirestmod.all()
	nameofsecondmod.all()
end
I will make a java program (yes java, is the language im better at, but if somebody can add this to his mod manager, it would be better) when my computer is fixed (3 weeks...), and I can have the jdk, because I cant download it in this comp.

Also, I know this will be implemented to the game in future updates, but I wanted to do it :), and I will add "APIs" later for easyer things, like "terraforming" for world generation (clearing a land and placing entities), and other stuff to make some modding things easy, another thing I want to say, is that the devs are making modding really good, so not much "APIs" are needed :)

http://rapidshare.com/files/3283273573/ ... %201.1.rar

Re: [0.2.10] Modloader

Posted: Sat Mar 16, 2013 8:46 pm
by drs9999
Did you notice that you didnt included the oninit, onsave and onload functions?

Btw. the CC-Mod already use a similar system.

But yeah a programm that do the copy+paste work etc. for you would be pretty well and a must-have in my opinion.

Re: [0.2.10] Modloader

Posted: Sat Mar 16, 2013 9:05 pm
by ficolas
why should I include those methods?

Re: [0.2.10] Modloader

Posted: Sat Mar 16, 2013 9:32 pm
by drs9999
why not? ;)

So I see no reason why to restrict the functions a mod is able/allowed to use.

Re: [0.2.10] Modloader

Posted: Sat Mar 16, 2013 10:51 pm
by ficolas
the mod can still use those with if event.name==oninit then etc

Re: [0.2.10] Modloader

Posted: Sat Mar 16, 2013 11:10 pm
by drs9999
nope. A quick test with

Code: Select all

game.onevent = function(event)
   if event.name =="oninit" then
	  game.getplayer().insert{name="wooden-chest", count=100}
   end

   if event.name =="onload" then
	  game.getplayer().insert{name="wooden-chest", count=100}
   end
end
Dont give me anything after start or load.

Re: [0.2.10] Modloader

Posted: Sat Mar 16, 2013 11:13 pm
by slpwnd
Actually we really want to have this thing in the game sooner than later :) Seeing what kind of crazy mods you guys are doing even with limited options.

At the moment we are working on enhancing the mod support. Mods as packages should make it into the next release. Mod installation will be a breeze afterwards.