[Idea]Add mod-dependencies in the mod?

User avatar
MineYoshi
Member
 
Posts: 4267
Joined: Wed Jul 08, 2015 13:20
GitHub: MineYosh
IRC: MineYoshi
In-game: Kirby_Retro

[Idea]Add mod-dependencies in the mod?

by MineYoshi » Mon Nov 28, 2016 19:11

I was justly wondering. Some mods needs mod dependencies as the api of the mobs mod. Then why not to add the "api.lua" in the mod and auto-identify?
Something like this:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
if not( minetest.get_modpath("dependency_mod")) then
dofile(minetest.get_modpath("Your_mod").."/dependency_code.lua"),
end

You justly include the desired and needed file in your mod folder, this code will load the file, if the player has that mod already, you "dependency_code.lua" won't load for skip incompatibility, but if the player doesn't have it hen the mod loads the file and you don't need to download anything! What do you think? :)
People talk about freedom of speech, so i'll say that God exists.
Open your eyes!! See The big unicorn conspiracy.!! :D The government has been lying to us about unicorns!!
"I've learned there are three things you don't discuss with people: religion, politics and the Great Pumpkin" - Linus Van Pelt
I'm the Officially 1st ABJist in the world ( ͡° ͜ʖ ͡°)
 

User avatar
Wuzzy
Member
 
Posts: 2161
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

Re: [Idea]Add mod-dependencies in the mod?

by Wuzzy » Tue Nov 29, 2016 02:51

Congratulations! You just figured out how to add an optional dependency! :D

This is nothing new. This is how I basically added optional dependencies for mods since … forever?
Also, this is a common idiom, but usually people check for the positive case and rarely use a “dofile” like that. But the idea is the same.
I'm creating MineClone 2, a Minecraft clone for Minetest.
I made the Help modpack, adding in-game help to Minetest.
 


Return to Modding Discussion

Who is online

Users browsing this forum: No registered users and 9 guests

cron