forked from VoxeLibre/VoxeLibre
Compare commits
1 Commits
master
...
mobs_api_u
Author | SHA1 | Date |
---|---|---|
TenPlus1 | 55813c153f |
|
@ -139,6 +139,7 @@ functions needed for the mob to work properly which contains the following:
|
||||||
{"default:sword_wood",0} -- causes no damage.
|
{"default:sword_wood",0} -- causes no damage.
|
||||||
{"default:gold_lump", -10} -- heals by 10 health points.
|
{"default:gold_lump", -10} -- heals by 10 health points.
|
||||||
{"default:coal_block", 20} -- 20 damage when hit on head with coal blocks.
|
{"default:coal_block", 20} -- 20 damage when hit on head with coal blocks.
|
||||||
|
{"all"} -- stops all weapons causing damage apart from those on list.
|
||||||
|
|
||||||
'makes_footstep_sound' when true you can hear mobs walking.
|
'makes_footstep_sound' when true you can hear mobs walking.
|
||||||
'sounds' this is a table with sounds of the mob
|
'sounds' this is a table with sounds of the mob
|
||||||
|
|
|
@ -614,6 +614,9 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir)
|
||||||
|
|
||||||
damage = self.immune_to[n][2] or 0
|
damage = self.immune_to[n][2] or 0
|
||||||
break
|
break
|
||||||
|
-- if "all" then no tool does damage unless it's specified in list
|
||||||
|
elseif self.immune_to[n][1] == "all" then
|
||||||
|
damage = self.immune_to[n][2] or 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -387,8 +387,7 @@ end
|
||||||
-- are we flying in what we are suppose to? (taikedz)
|
-- are we flying in what we are suppose to? (taikedz)
|
||||||
function mob_class:flight_check()
|
function mob_class:flight_check()
|
||||||
|
|
||||||
local nod = self.standing_in
|
local def = minetest.registered_nodes[self.standing_in]
|
||||||
local def = minetest.registered_nodes[nod]
|
|
||||||
|
|
||||||
if not def then return false end -- nil check
|
if not def then return false end -- nil check
|
||||||
|
|
||||||
|
@ -402,7 +401,7 @@ function mob_class:flight_check()
|
||||||
end
|
end
|
||||||
|
|
||||||
for _,checknode in pairs(fly_in) do
|
for _,checknode in pairs(fly_in) do
|
||||||
if nod == checknode or nod == "ignore" then
|
if self.standing_in == checknode or self.standing_in == "ignore" then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -664,16 +663,27 @@ function mob_class:do_env_damage()
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- get node at foot level every quarter second
|
||||||
|
self.node_timer = (self.node_timer or 0) + dtime
|
||||||
|
|
||||||
|
if self.node_timer > 0.25 then
|
||||||
|
|
||||||
|
self.node_timer = 0
|
||||||
|
|
||||||
local y_level = self.collisionbox[2]
|
local y_level = self.collisionbox[2]
|
||||||
|
|
||||||
if self.child then
|
if self.child then
|
||||||
y_level = self.collisionbox[2] * 0.5
|
y_level = self.collis77ionbox[2] * 0.5
|
||||||
end
|
end
|
||||||
|
|
||||||
-- what is mob standing in?
|
-- what is mob standing in?
|
||||||
pos.y = pos.y + y_level + 0.25 -- foot level
|
self.standing_in = node_ok({
|
||||||
|
x = pos.x, y = pos.y + y_level + 0.25, z = pos.z}, "air").name
|
||||||
|
-- print ("standing in " .. self.standing_in)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- check if falling, flying, floating
|
||||||
local pos2 = {x=pos.x, y=pos.y-1, z=pos.z}
|
local pos2 = {x=pos.x, y=pos.y-1, z=pos.z}
|
||||||
self.standing_in = node_ok(pos, "air").name
|
|
||||||
self.standing_on = node_ok(pos2, "air").name
|
self.standing_on = node_ok(pos2, "air").name
|
||||||
|
|
||||||
local pos3 = vector.offset(pos, 0, 1, 0)
|
local pos3 = vector.offset(pos, 0, 1, 0)
|
||||||
|
@ -937,7 +947,7 @@ function mob_class:falling(pos)
|
||||||
|
|
||||||
local acc = self.object:get_acceleration()
|
local acc = self.object:get_acceleration()
|
||||||
|
|
||||||
local registered_node = minetest.registered_nodes[node_ok(pos).name]
|
local registered_node = minetest.registered_nodes[self.standing_in]
|
||||||
|
|
||||||
if registered_node.groups.lava then
|
if registered_node.groups.lava then
|
||||||
if acc and self.floats_on_lava == 1 then
|
if acc and self.floats_on_lava == 1 then
|
||||||
|
@ -948,7 +958,7 @@ function mob_class:falling(pos)
|
||||||
-- in water then float up
|
-- in water then float up
|
||||||
if registered_node.groups.water then
|
if registered_node.groups.water then
|
||||||
if acc and self.floats == 1 and minetest.registered_nodes[node_ok(vector.offset(pos,0,self.collisionbox[5] -0.25,0)).name].groups.water then
|
if acc and self.floats == 1 and minetest.registered_nodes[node_ok(vector.offset(pos,0,self.collisionbox[5] -0.25,0)).name].groups.water then
|
||||||
self.object:set_acceleration(vector.new(0, -self.fall_speed / (math.max(1, v.y) ^ 2), 0))
|
self.object:set_acceleration(vector.new(0, -self.fall_speed / (math.max(1, v.y) ^ 8), 0))
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
-- fall damage onto solid ground
|
-- fall damage onto solid ground
|
||||||
|
|
|
@ -20,6 +20,7 @@ mcl_mobs_mob_poof.ogg:
|
||||||
------------
|
------------
|
||||||
|
|
||||||
Changelog from original Mobs Redo mod:
|
Changelog from original Mobs Redo mod:
|
||||||
|
- 1.42- Added "all" option to immune_to table, tidied floating mobs to be less intensive
|
||||||
- 1.41- Mob pathfinding has been updated thanks to Elkien3
|
- 1.41- Mob pathfinding has been updated thanks to Elkien3
|
||||||
- 1.40- Updated to use newer functions, requires Minetest 0.4.16+ to work.
|
- 1.40- Updated to use newer functions, requires Minetest 0.4.16+ to work.
|
||||||
- 1.39- Added 'on_breed', 'on_grown' and 'do_punch' custom functions per mob
|
- 1.39- Added 'on_breed', 'on_grown' and 'do_punch' custom functions per mob
|
||||||
|
|
Loading…
Reference in New Issue