forked from mtcontrib/mob_horse
		
	tidy code
This commit is contained in:
		
							
								
								
									
										25
									
								
								init.lua
									
									
									
									
									
								
							
							
						
						
									
										25
									
								
								init.lua
									
									
									
									
									
								
							@@ -2,22 +2,8 @@
 | 
				
			|||||||
-- Load support for intllib.
 | 
					-- Load support for intllib.
 | 
				
			||||||
local MP = minetest.get_modpath(minetest.get_current_modname()) .. "/"
 | 
					local MP = minetest.get_modpath(minetest.get_current_modname()) .. "/"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- Check for translation method
 | 
					-- Translation support
 | 
				
			||||||
local S
 | 
					local S = minetest.get_translator("mob_horse")
 | 
				
			||||||
if minetest.get_translator then
 | 
					 | 
				
			||||||
	S = minetest.get_translator("mob_horse") -- 5.x translation function
 | 
					 | 
				
			||||||
else -- boilerplate function
 | 
					 | 
				
			||||||
	S = function(str, ...)
 | 
					 | 
				
			||||||
		local args = {...}
 | 
					 | 
				
			||||||
		return str:gsub("@%d+", function(match)
 | 
					 | 
				
			||||||
			return args[tonumber(match:sub(2))]
 | 
					 | 
				
			||||||
		end)
 | 
					 | 
				
			||||||
	end
 | 
					 | 
				
			||||||
end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
-- 0.4.17 or 5.0 check
 | 
					 | 
				
			||||||
local y_off = minetest.features.object_independent_selectionbox and 10 or 20
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- horse shoes (speed, jump, brake/reverse speed, overlay texture)
 | 
					-- horse shoes (speed, jump, brake/reverse speed, overlay texture)
 | 
				
			||||||
local shoes = {
 | 
					local shoes = {
 | 
				
			||||||
@@ -86,8 +72,8 @@ mobs:register_mob("mob_horse:horse", {
 | 
				
			|||||||
			self.max_speed_reverse = 2
 | 
								self.max_speed_reverse = 2
 | 
				
			||||||
			self.accel = 6
 | 
								self.accel = 6
 | 
				
			||||||
			self.terrain_type = 3
 | 
								self.terrain_type = 3
 | 
				
			||||||
			self.driver_attach_at = {x = 0, y = y_off, z = -2}
 | 
								self.driver_attach_at = {x = 0, y = 10, z = -2}
 | 
				
			||||||
			self.driver_eye_offset = {x = 0, y = y_off + 3, z = 0}
 | 
								self.driver_eye_offset = {x = 0, y = 10 + 3, z = 0}
 | 
				
			||||||
			self.driver_scale = {x = 0.8, y = 0.8} -- shrink driver to fit model
 | 
								self.driver_scale = {x = 0.8, y = 0.8} -- shrink driver to fit model
 | 
				
			||||||
		end
 | 
							end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -203,6 +189,7 @@ mobs:register_mob("mob_horse:horse", {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
				-- apply horseshoe overlay to current horse texture
 | 
									-- apply horseshoe overlay to current horse texture
 | 
				
			||||||
				if overlay then
 | 
									if overlay then
 | 
				
			||||||
 | 
					
 | 
				
			||||||
					self.texture_mods = "^" .. overlay
 | 
										self.texture_mods = "^" .. overlay
 | 
				
			||||||
 | 
					
 | 
				
			||||||
					if self.saddle then
 | 
										if self.saddle then
 | 
				
			||||||
@@ -356,4 +343,4 @@ if minetest.get_modpath("lucky_block") then
 | 
				
			|||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
print("[MOD] Mobs Redo Horse loaded")
 | 
					print("[MOD] Mob Horse loaded")
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										3
									
								
								mod.conf
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								mod.conf
									
									
									
									
									
								
							@@ -1,4 +1,5 @@
 | 
				
			|||||||
name = mob_horse
 | 
					name = mob_horse
 | 
				
			||||||
 | 
					description = Adds a rideable horse into game with horse shoe upgrades.
 | 
				
			||||||
depends = mobs
 | 
					depends = mobs
 | 
				
			||||||
optional_depends = lucky_block
 | 
					optional_depends = lucky_block
 | 
				
			||||||
description = Adds a rideable horse into game with horse shoe upgrades.
 | 
					min_minetest_version = 5.0
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user