1
0
mirror of https://codeberg.org/tenplus1/mobs_redo.git synced 2024-11-14 06:20:18 +01:00

udpate api.txt

This commit is contained in:
tenplus1 2024-08-11 08:17:02 +01:00
parent 59c19fca98
commit e561864e82

146
api.txt
View File

@ -841,7 +841,6 @@ External Settings for "minetest.conf"
'mob_height_fix' Enabled by default, increases smaller mob heights so they wont
glitch through certain nodes.
'mob_pathfinding_enable' Enable pathfinding.
'mob_pathfinder_enable' Use pathfinder mod if available.
'mob_pathfinding_stuck_timeout' How long before stuck mobs start searching. (default 3.0)
'mob_pathfinding_stuck_path_timeout' How long will mob follow path before giving up. (default 5.0)
'mob_pathfinding_algorithm' Which pathfinding algorithm to use Dijkstra (default), A*_noprefetch (AStar_noprefetch) or A* (AStar)
@ -864,130 +863,27 @@ mobs_animal:cow = 8000,4 <-- 4 cows per mapblock at 8000 spawn chance
mobs_monster:dirt_monster = ,20 <-- 20 dirt monsters per mapblock
Node Sounds
-----------
Mobs Redo will detect wether the Default mod or MineClone/VoxeLibre mod is active and
store whichever sound set is available inside the following to save any mob mobs
having to detect it themselves:
mobs.node_sound_defaults()
mobs.node_sound_stone_defaults()
mobs.node_sound_dirt_defaults()
mobs.node_sound_sand_defaults()
mobs.node_sound_gravel_defaults()
mobs.node_sound_wood_defaults()
mobs.node_sound_leaves_defaults()
mobs.node_sound_ice_defaults()
mobs.node_sound_metal_defaults()
mobs.node_sound_water_defaults()
mobs.node_sound_snow_defaults()
Rideable Horse Example Mob
--------------------------
mobs:register_mob("mob_horse:horse", {
type = "animal",
visual = "mesh",
visual_size = {x = 1.20, y = 1.20},
mesh = "mobs_horse.x",
collisionbox = {-0.4, -0.01, -0.4, 0.4, 1.25, 0.4},
animation = {
speed_normal = 15,
speed_run = 30,
stand_start = 25,
stand_end = 75,
walk_start = 75,
walk_end = 100,
run_start = 75,
run_end = 100,
},
textures = {
{"mobs_horse.png"},
{"mobs_horsepeg.png"},
{"mobs_horseara.png"}
},
fear_height = 3,
runaway = true,
fly = false,
walk_chance = 60,
view_range = 5,
follow = {"farming:wheat"},
passive = true,
hp_min = 12,
hp_max = 16,
armor = 200,
lava_damage = 5,
fall_damage = 5,
water_damage = 1,
makes_footstep_sound = true,
drops = {
{name = "mobs:meat_raw", chance = 1, min = 2, max = 3}
},
sounds = {
random = "horse_neigh.ogg",
damage = "horse_whinney.ogg",
},
do_custom = function(self, dtime)
-- set needed values if not already present
if not self.v2 then
self.v2 = 0
self.max_speed_forward = 6
self.max_speed_reverse = 2
self.accel = 6
self.terrain_type = 3
self.driver_attach_at = {x = 0, y = 20, z = -2}
self.driver_eye_offset = {x = 0, y = 3, z = 0}
self.driver_scale = {x = 1, y = 1}
end
-- if driver present allow control of horse
if self.driver then
mobs.drive(self, "walk", "stand", false, dtime)
return false -- skip rest of mob functions
end
return true
end,
on_die = function(self, pos)
-- drop saddle when horse is killed while riding
-- also detach from horse properly
if self.driver then
minetest.add_item(pos, "mobs:saddle")
mobs.detach(self.driver, {x = 1, y = 0, z = 1})
end
end,
on_rightclick = function(self, clicker)
-- make sure player is clicking
if not clicker or not clicker:is_player() then
return
end
-- feed, tame or heal horse
if mobs:feed_tame(self, clicker, 10, true, true) then
return
end
-- make sure tamed horse is being clicked by owner only
if self.tamed and self.owner == clicker:get_player_name() then
local inv = clicker:get_inventory()
-- detatch player already riding horse
if self.driver and clicker == self.driver then
mobs.detach(clicker, {x = 1, y = 0, z = 1})
-- add saddle back to inventory
if inv:room_for_item("main", "mobs:saddle") then
inv:add_item("main", "mobs:saddle")
else
minetest.add_item(clicker.get_pos(), "mobs:saddle")
end
-- attach player to horse
elseif not self.driver
and clicker:get_wielded_item():get_name() == "mobs:saddle" then
self.object:set_properties({stepheight = 1.1})
mobs.attach(self, clicker)
-- take saddle from inventory
inv:remove_item("main", "mobs:saddle")
end
end
-- used to capture horse with magic lasso
mobs:capture_mob(self, clicker, 0, 0, 80, false, nil)
end
})
See mob_horse mod https://codeberg.org/tenplus1/mob_horse