forked from mtcontrib/awards
		
	Separate triggers from API
This commit is contained in:
		
							
								
								
									
										12
									
								
								api.lua
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								api.lua
									
									
									
									
									
								
							@@ -18,6 +18,7 @@
 | 
				
			|||||||
awards = {
 | 
					awards = {
 | 
				
			||||||
	show_mode = "hud"
 | 
						show_mode = "hud"
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					dofile(minetest.get_modpath("awards").."/helpers.lua")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- Table Save Load Functions
 | 
					-- Table Save Load Functions
 | 
				
			||||||
function awards.save()
 | 
					function awards.save()
 | 
				
			||||||
@@ -47,8 +48,6 @@ function awards.load()
 | 
				
			|||||||
	return {}
 | 
						return {}
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
awards.init()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
function awards.register_trigger(name, func)
 | 
					function awards.register_trigger(name, func)
 | 
				
			||||||
	awards.trigger_types[name] = func
 | 
						awards.trigger_types[name] = func
 | 
				
			||||||
	awards.on[name] = {}
 | 
						awards.on[name] = {}
 | 
				
			||||||
@@ -104,7 +103,7 @@ end
 | 
				
			|||||||
-- It checks if a player already has that achievement, and if they do not,
 | 
					-- It checks if a player already has that achievement, and if they do not,
 | 
				
			||||||
-- it gives it to them
 | 
					-- it gives it to them
 | 
				
			||||||
----------------------------------------------
 | 
					----------------------------------------------
 | 
				
			||||||
--awards.give_achievement(name,award)
 | 
					--awards.give_achievement(name, award)
 | 
				
			||||||
-- name - the name of the player
 | 
					-- name - the name of the player
 | 
				
			||||||
-- award - the name of the award to give
 | 
					-- award - the name of the award to give
 | 
				
			||||||
function awards.give_achievement(name, award)
 | 
					function awards.give_achievement(name, award)
 | 
				
			||||||
@@ -367,9 +366,4 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
 | 
				
			|||||||
	return true
 | 
						return true
 | 
				
			||||||
end)
 | 
					end)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					awards.init()
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
-- Load files
 | 
					 | 
				
			||||||
dofile(minetest.get_modpath("awards").."/helpers.lua")
 | 
					 | 
				
			||||||
dofile(minetest.get_modpath("awards").."/triggers.lua")
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										1
									
								
								init.lua
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								init.lua
									
									
									
									
									
								
							@@ -25,6 +25,7 @@ end
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
dofile(minetest.get_modpath("awards").."/api.lua")
 | 
					dofile(minetest.get_modpath("awards").."/api.lua")
 | 
				
			||||||
dofile(minetest.get_modpath("awards").."/chat_commands.lua")
 | 
					dofile(minetest.get_modpath("awards").."/chat_commands.lua")
 | 
				
			||||||
 | 
					dofile(minetest.get_modpath("awards").."/triggers.lua")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- Light it up
 | 
					-- Light it up
 | 
				
			||||||
awards.register_achievement("award_lightitup",{
 | 
					awards.register_achievement("award_lightitup",{
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user