Toribash
Prev Previous Post   Next Post Next
Originally Posted by neoliminal View Post
Explain?

My Faked Shaders script checks when the mod is changed so it can reflect the objects.

This is how it should work:
check_mod should be hooked to trigger at game start (or constantly). load_slave_script loads the right script or each mod.
current_mod="no mod loaded"

function load_slave_script(s)
	if (s=="classic") then --or other mod
		run_cmd("/ls classic_script.lua") --or other script for this mod
	end
	dofile("master_script.lua") --reload the master script (this file) on top so both will be running and new mods are detected
	current_mod=get_game_rules().mod --prevent master script from reloading the slave script
end

function check_mod()
	if (current_mod~=get_game_rules().mod)then
		current_mod=get_game_rules().mod
		load_slave_script(current_mod)
	end
end