tidy code

This commit is contained in:
tenplus1 2023-08-13 10:45:19 +01:00
parent 83198a8531
commit a97f7e04bb
2 changed files with 8 additions and 20 deletions

View File

@ -2,22 +2,8 @@
-- Load support for intllib.
local MP = minetest.get_modpath(minetest.get_current_modname()) .. "/"
-- Check for translation method
local S
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
-- Translation support
local S = minetest.get_translator("mob_horse")
-- horse shoes (speed, jump, brake/reverse speed, overlay texture)
local shoes = {
@ -86,8 +72,8 @@ mobs:register_mob("mob_horse:horse", {
self.max_speed_reverse = 2
self.accel = 6
self.terrain_type = 3
self.driver_attach_at = {x = 0, y = y_off, z = -2}
self.driver_eye_offset = {x = 0, y = y_off + 3, z = 0}
self.driver_attach_at = {x = 0, y = 10, z = -2}
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
end
@ -203,6 +189,7 @@ mobs:register_mob("mob_horse:horse", {
-- apply horseshoe overlay to current horse texture
if overlay then
self.texture_mods = "^" .. overlay
if self.saddle then
@ -356,4 +343,4 @@ if minetest.get_modpath("lucky_block") then
end
print("[MOD] Mobs Redo Horse loaded")
print("[MOD] Mob Horse loaded")

View File

@ -1,4 +1,5 @@
name = mob_horse
description = Adds a rideable horse into game with horse shoe upgrades.
depends = mobs
optional_depends = lucky_block
description = Adds a rideable horse into game with horse shoe upgrades.
min_minetest_version = 5.0