forked from mtcontrib/mob_horse
Compare commits
9 Commits
0cbaa0b223
...
af59d1e2b7
Author | SHA1 | Date | |
---|---|---|---|
af59d1e2b7 | |||
|
4022ae9a02 | ||
|
f7ac229ccf | ||
6d4701ca5f | |||
|
8996ad27d8 | ||
f550d5b4a1 | |||
|
9e0021a0f8 | ||
d0ccec70cb | |||
|
7650e9ba5c |
87
init.lua
87
init.lua
@@ -1,8 +1,30 @@
|
|||||||
|
|
||||||
-- 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()) .. "/"
|
||||||
local S = minetest.get_translator and minetest.get_translator("mob_horse") or
|
|
||||||
dofile(MP .. "/intllib.lua")
|
-- Check for translation method
|
||||||
|
local S
|
||||||
|
if minetest.get_translator ~= nil then
|
||||||
|
S = minetest.get_translator("mob_horse") -- 5.x translation function
|
||||||
|
else
|
||||||
|
if minetest.get_modpath("intllib") then
|
||||||
|
dofile(minetest.get_modpath("intllib") .. "/init.lua")
|
||||||
|
if intllib.make_gettext_pair then
|
||||||
|
gettext, ngettext = intllib.make_gettext_pair() -- new gettext method
|
||||||
|
else
|
||||||
|
gettext = intllib.Getter() -- old text file method
|
||||||
|
end
|
||||||
|
S = gettext
|
||||||
|
else -- boilerplate function
|
||||||
|
S = function(str, ...)
|
||||||
|
local args = {...}
|
||||||
|
return str:gsub("@%d+", function(match)
|
||||||
|
return args[tonumber(match:sub(2))]
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
-- 0.4.17 or 5.0 check
|
-- 0.4.17 or 5.0 check
|
||||||
local y_off = 20
|
local y_off = 20
|
||||||
@@ -10,7 +32,8 @@ if minetest.features.object_independent_selectionbox then
|
|||||||
y_off = 10
|
y_off = 10
|
||||||
end
|
end
|
||||||
|
|
||||||
-- horse shoes (speed, jump, break, overlay texture)
|
|
||||||
|
-- horse shoes (speed, jump, brake/reverse speed, overlay texture)
|
||||||
local shoes = {
|
local shoes = {
|
||||||
["mobs:horseshoe_steel"] = {7, 4, 2, "mobs_horseshoe_steelo.png"},
|
["mobs:horseshoe_steel"] = {7, 4, 2, "mobs_horseshoe_steelo.png"},
|
||||||
["mobs:horseshoe_bronze"] = {7, 4, 4, "mobs_horseshoe_bronzeo.png"},
|
["mobs:horseshoe_bronze"] = {7, 4, 4, "mobs_horseshoe_bronzeo.png"},
|
||||||
@@ -19,6 +42,7 @@ local shoes = {
|
|||||||
["mobs:horseshoe_crystal"] = {11, 6, 9, "mobs_horseshoe_crystalo.png"}
|
["mobs:horseshoe_crystal"] = {11, 6, 9, "mobs_horseshoe_crystalo.png"}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
-- rideable horse
|
-- rideable horse
|
||||||
mobs:register_mob("mob_horse:horse", {
|
mobs:register_mob("mob_horse:horse", {
|
||||||
type = "animal",
|
type = "animal",
|
||||||
@@ -39,7 +63,7 @@ mobs:register_mob("mob_horse:horse", {
|
|||||||
walk_start = 75,
|
walk_start = 75,
|
||||||
walk_end = 100,
|
walk_end = 100,
|
||||||
run_start = 75,
|
run_start = 75,
|
||||||
run_end = 100,
|
run_end = 100
|
||||||
},
|
},
|
||||||
textures = {
|
textures = {
|
||||||
{"mobs_horse.png"}, -- textures by Mjollna
|
{"mobs_horse.png"}, -- textures by Mjollna
|
||||||
@@ -60,7 +84,7 @@ mobs:register_mob("mob_horse:horse", {
|
|||||||
armor = 200,
|
armor = 200,
|
||||||
lava_damage = 5,
|
lava_damage = 5,
|
||||||
fall_damage = 5,
|
fall_damage = 5,
|
||||||
water_damage = 1,
|
water_damage = 0,
|
||||||
makes_footstep_sound = true,
|
makes_footstep_sound = true,
|
||||||
drops = {
|
drops = {
|
||||||
{name = "mobs:leather", chance = 1, min = 0, max = 2}
|
{name = "mobs:leather", chance = 1, min = 0, max = 2}
|
||||||
@@ -227,16 +251,28 @@ mobs:register_mob("mob_horse:horse", {
|
|||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
mobs:spawn({
|
|
||||||
name = "mob_horse:horse",
|
-- check for custom spawn.lua
|
||||||
nodes = {"default:dirt_with_grass", "ethereal:dry_dirt"},
|
local input = io.open(MP .. "spawn.lua", "r")
|
||||||
min_light = 14,
|
|
||||||
interval = 60,
|
if input then
|
||||||
chance = 16000,
|
input:close()
|
||||||
min_height = 10,
|
input = nil
|
||||||
max_height = 31000,
|
dofile(MP .. "spawn.lua")
|
||||||
day_toggle = true,
|
else
|
||||||
})
|
|
||||||
|
mobs:spawn({
|
||||||
|
name = "mob_horse:horse",
|
||||||
|
nodes = {"default:dirt_with_grass", "ethereal:dry_dirt"},
|
||||||
|
min_light = 14,
|
||||||
|
interval = 60,
|
||||||
|
chance = 16000,
|
||||||
|
min_height = 10,
|
||||||
|
max_height = 31000,
|
||||||
|
day_toggle = true
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
mobs:register_egg("mob_horse:horse", S("Horse"), "wool_brown.png", 1)
|
mobs:register_egg("mob_horse:horse", S("Horse"), "wool_brown.png", 1)
|
||||||
|
|
||||||
@@ -252,14 +288,14 @@ minetest.register_craft({
|
|||||||
recipe = {
|
recipe = {
|
||||||
{"", "default:steelblock", ""},
|
{"", "default:steelblock", ""},
|
||||||
{"default:steel_ingot", "", "default:steel_ingot"},
|
{"default:steel_ingot", "", "default:steel_ingot"},
|
||||||
{"default:steel_ingot", "", "default:steel_ingot"},
|
{"default:steel_ingot", "", "default:steel_ingot"}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
-- bronze horseshoes
|
-- bronze horseshoes
|
||||||
minetest.register_craftitem(":mobs:horseshoe_bronze", {
|
minetest.register_craftitem(":mobs:horseshoe_bronze", {
|
||||||
description = S("Bronze HorseShoes (use on horse to apply)"),
|
description = S("Bronze HorseShoes (use on horse to apply)"),
|
||||||
inventory_image = "mobs_horseshoe_bronze.png",
|
inventory_image = "mobs_horseshoe_bronze.png"
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
@@ -267,14 +303,14 @@ minetest.register_craft({
|
|||||||
recipe = {
|
recipe = {
|
||||||
{"", "default:bronzeblock", ""},
|
{"", "default:bronzeblock", ""},
|
||||||
{"default:bronze_ingot", "", "default:bronze_ingot"},
|
{"default:bronze_ingot", "", "default:bronze_ingot"},
|
||||||
{"default:bronze_ingot", "", "default:bronze_ingot"},
|
{"default:bronze_ingot", "", "default:bronze_ingot"}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
-- mese horseshoes
|
-- mese horseshoes
|
||||||
minetest.register_craftitem(":mobs:horseshoe_mese", {
|
minetest.register_craftitem(":mobs:horseshoe_mese", {
|
||||||
description = S("Mese HorseShoes (use on horse to apply)"),
|
description = S("Mese HorseShoes (use on horse to apply)"),
|
||||||
inventory_image = "mobs_horseshoe_mese.png",
|
inventory_image = "mobs_horseshoe_mese.png"
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
@@ -282,14 +318,14 @@ minetest.register_craft({
|
|||||||
recipe = {
|
recipe = {
|
||||||
{"", "default:mese", ""},
|
{"", "default:mese", ""},
|
||||||
{"default:mese_crystal_fragment", "", "default:mese_crystal_fragment"},
|
{"default:mese_crystal_fragment", "", "default:mese_crystal_fragment"},
|
||||||
{"default:mese_crystal_fragment", "", "default:mese_crystal_fragment"},
|
{"default:mese_crystal_fragment", "", "default:mese_crystal_fragment"}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
-- diamond horseshoes
|
-- diamond horseshoes
|
||||||
minetest.register_craftitem(":mobs:horseshoe_diamond", {
|
minetest.register_craftitem(":mobs:horseshoe_diamond", {
|
||||||
description = S("Diamond HorseShoes (use on horse to apply)"),
|
description = S("Diamond HorseShoes (use on horse to apply)"),
|
||||||
inventory_image = "mobs_horseshoe_diamond.png",
|
inventory_image = "mobs_horseshoe_diamond.png"
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
@@ -297,7 +333,7 @@ minetest.register_craft({
|
|||||||
recipe = {
|
recipe = {
|
||||||
{"", "default:diamondblock", ""},
|
{"", "default:diamondblock", ""},
|
||||||
{"default:diamond", "", "default:diamond"},
|
{"default:diamond", "", "default:diamond"},
|
||||||
{"default:diamond", "", "default:diamond"},
|
{"default:diamond", "", "default:diamond"}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -306,7 +342,7 @@ if minetest.get_modpath("ethereal") then
|
|||||||
|
|
||||||
minetest.register_craftitem(":mobs:horseshoe_crystal", {
|
minetest.register_craftitem(":mobs:horseshoe_crystal", {
|
||||||
description = S("Crystal HorseShoes (use on horse to apply)"),
|
description = S("Crystal HorseShoes (use on horse to apply)"),
|
||||||
inventory_image = "mobs_horseshoe_crystal.png",
|
inventory_image = "mobs_horseshoe_crystal.png"
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
@@ -314,12 +350,13 @@ minetest.register_craft({
|
|||||||
recipe = {
|
recipe = {
|
||||||
{"", "ethereal:crystal_block", ""},
|
{"", "ethereal:crystal_block", ""},
|
||||||
{"ethereal:crystal_ingot", "", "ethereal:crystal_ingot"},
|
{"ethereal:crystal_ingot", "", "ethereal:crystal_ingot"},
|
||||||
{"ethereal:crystal_ingot", "", "ethereal:crystal_ingot"},
|
{"ethereal:crystal_ingot", "", "ethereal:crystal_ingot"}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- lucky blocks
|
-- lucky blocks
|
||||||
if minetest.get_modpath("lucky_block") then
|
if minetest.get_modpath("lucky_block") then
|
||||||
|
|
||||||
|
@@ -1,3 +0,0 @@
|
|||||||
-- Support for the old multi-load method
|
|
||||||
dofile(minetest.get_modpath("intllib").."/init.lua")
|
|
||||||
|
|
72
spawn_example.lua
Normal file
72
spawn_example.lua
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
|
||||||
|
--[[ Spawn Template, defaults to values shown if line not provided
|
||||||
|
|
||||||
|
mobs:spawn({
|
||||||
|
|
||||||
|
name = "",
|
||||||
|
|
||||||
|
- Name of mob, must be provided e.g. "mymod:my_mob"
|
||||||
|
|
||||||
|
nodes = {"group:soil, "group:stone"},
|
||||||
|
|
||||||
|
- Nodes to spawn on top of.
|
||||||
|
|
||||||
|
neighbors = {"air"},
|
||||||
|
|
||||||
|
- Nodes to spawn beside.
|
||||||
|
|
||||||
|
min_light = 0,
|
||||||
|
|
||||||
|
- Minimum light level.
|
||||||
|
|
||||||
|
max_light = 15,
|
||||||
|
|
||||||
|
- Maximum light level, 15 is sunlight only.
|
||||||
|
|
||||||
|
interval = 30,
|
||||||
|
|
||||||
|
- Spawn interval in seconds.
|
||||||
|
|
||||||
|
chance = 5000,
|
||||||
|
|
||||||
|
- Spawn chance, 1 in every 5000 nodes.
|
||||||
|
|
||||||
|
active_object_count = 1,
|
||||||
|
|
||||||
|
- Active mobs of this type in area.
|
||||||
|
|
||||||
|
min_height = -31000,
|
||||||
|
|
||||||
|
- Minimum height level.
|
||||||
|
|
||||||
|
max_height = 31000,
|
||||||
|
|
||||||
|
- Maximum height level.
|
||||||
|
|
||||||
|
day_toggle = nil,
|
||||||
|
|
||||||
|
- Daytime toggle, true to spawn during day, false for night, nil for both
|
||||||
|
|
||||||
|
on_spawn = nil,
|
||||||
|
|
||||||
|
- On spawn function to run when mob spawns in world
|
||||||
|
|
||||||
|
on_map_load = nil,
|
||||||
|
|
||||||
|
- On map load, when true mob only spawns in newly generated map areas
|
||||||
|
})
|
||||||
|
]]--
|
||||||
|
|
||||||
|
|
||||||
|
-- Horse
|
||||||
|
|
||||||
|
mobs:spawn({
|
||||||
|
name = "mob_horse:horse",
|
||||||
|
nodes = {"default:dirt_with_grass", "ethereal:dry_dirt"},
|
||||||
|
min_light = 14,
|
||||||
|
interval = 60,
|
||||||
|
chance = 16000,
|
||||||
|
min_height = 10,
|
||||||
|
max_height = 31000,
|
||||||
|
day_toggle = true
|
||||||
|
})
|
Reference in New Issue
Block a user