mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2024-11-07 19:10:23 +01:00
update mod mobs
convert mobs sounds, stereo to mono, 48kb,44100KHz. before 1,2 Mo, after 833,5 ko
This commit is contained in:
parent
8b5d0fe0fa
commit
167a0fe2e3
|
@ -1,4 +1,4 @@
|
||||||
-- Mobs Api (18th August 2015)
|
-- Mobs Api (28th August 2015)
|
||||||
mobs = {}
|
mobs = {}
|
||||||
mobs.mod = "redo"
|
mobs.mod = "redo"
|
||||||
|
|
||||||
|
@ -606,7 +606,8 @@ function mobs:register_mob(name, def)
|
||||||
|
|
||||||
if self.type == "npc"
|
if self.type == "npc"
|
||||||
and self.order == "follow"
|
and self.order == "follow"
|
||||||
and self.state ~= "attack" and self.owner ~= "" then --/MFF (Crabman|07/14/2015) follow diamond if has not owner
|
and self.state ~= "attack"
|
||||||
|
and self.owner ~= "" then
|
||||||
-- npc stop following player if not owner
|
-- npc stop following player if not owner
|
||||||
if self.following
|
if self.following
|
||||||
and self.owner
|
and self.owner
|
||||||
|
@ -1319,7 +1320,6 @@ function mobs:explosion(pos, radius, fire, smoke, sound)
|
||||||
if not fire then fire = 0 end
|
if not fire then fire = 0 end
|
||||||
if not smoke then smoke = 0 end
|
if not smoke then smoke = 0 end
|
||||||
local pos = vector.round(pos)
|
local pos = vector.round(pos)
|
||||||
local radius = 1
|
|
||||||
local vm = VoxelManip()
|
local vm = VoxelManip()
|
||||||
local minp, maxp = vm:read_from_map(vector.subtract(pos, radius), vector.add(pos, radius))
|
local minp, maxp = vm:read_from_map(vector.subtract(pos, radius), vector.add(pos, radius))
|
||||||
local a = VoxelArea:new({MinEdge = minp, MaxEdge = maxp})
|
local a = VoxelArea:new({MinEdge = minp, MaxEdge = maxp})
|
||||||
|
@ -1350,21 +1350,27 @@ function mobs:explosion(pos, radius, fire, smoke, sound)
|
||||||
p.y = pos.y + y
|
p.y = pos.y + y
|
||||||
p.z = pos.z + z
|
p.z = pos.z + z
|
||||||
if p.y >= 19600 --MFF
|
if p.y >= 19600 --MFF
|
||||||
and data[vi] ~= c_air and data[vi] ~= c_ignore
|
and data[vi] ~= c_air
|
||||||
and data[vi] ~= c_obsidian and data[vi] ~= c_brick
|
and data[vi] ~= c_ignore
|
||||||
|
and data[vi] ~= c_obsidian
|
||||||
|
and data[vi] ~= c_brick
|
||||||
and data[vi] ~= c_chest then
|
and data[vi] ~= c_chest then
|
||||||
local n = minetest.get_node(p).name
|
local n = minetest.get_node(p).name
|
||||||
if not minetest.is_protected(p, "") --/MFF (Crabman|06/23/2015) re-added node protected in areas
|
if not minetest.is_protected(p, "") --/MFF (Crabman|06/23/2015) re-added node protected in areas
|
||||||
and minetest.get_item_group(n, "unbreakable") ~= 1 then
|
and minetest.get_item_group(n, "unbreakable") ~= 1 then
|
||||||
-- if chest then drop items inside
|
-- if chest then drop items inside
|
||||||
if n == "default:chest" or n == "3dchest:chest" then
|
if n == "default:chest"
|
||||||
|
or n == "3dchest:chest" then
|
||||||
local meta = minetest.get_meta(p)
|
local meta = minetest.get_meta(p)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
for i = 1,32 do
|
for i = 1,32 do
|
||||||
local m_stack = inv:get_stack("main", i)
|
local m_stack = inv:get_stack("main", i)
|
||||||
local obj = minetest.add_item(pos, m_stack)
|
local obj = minetest.add_item(p, m_stack)
|
||||||
if obj then
|
if obj then
|
||||||
obj:setvelocity({x = math.random(-2, 2), y = 7, z = math.random(-2, 2)})
|
obj:setvelocity({
|
||||||
|
x = math.random(-2, 2),
|
||||||
|
y = 7,
|
||||||
|
z = math.random(-2, 2)})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1506,7 +1512,9 @@ function mobs:register_arrow(name, def)
|
||||||
end
|
end
|
||||||
if self.hit_mob
|
if self.hit_mob
|
||||||
and player:get_luaentity().name ~= self.object:get_luaentity().name
|
and player:get_luaentity().name ~= self.object:get_luaentity().name
|
||||||
and player:get_luaentity().name ~= "__builtin:item" then
|
and player:get_luaentity().name ~= "__builtin:item"
|
||||||
|
and player:get_luaentity().name ~= "gauges:hp_bar"
|
||||||
|
and player:get_luaentity().name ~= "signs:text" then
|
||||||
self.hit_mob(self, player)
|
self.hit_mob(self, player)
|
||||||
self.object:remove() ; -- print ("hit mob")
|
self.object:remove() ; -- print ("hit mob")
|
||||||
return
|
return
|
||||||
|
@ -1604,28 +1612,22 @@ end
|
||||||
-- follow what I'm holding ?
|
-- follow what I'm holding ?
|
||||||
function follow_holding(self, clicker)
|
function follow_holding(self, clicker)
|
||||||
local item = clicker:get_wielded_item()
|
local item = clicker:get_wielded_item()
|
||||||
local follow_item = false
|
|
||||||
local t = type(self.follow)
|
local t = type(self.follow)
|
||||||
|
|
||||||
-- single item
|
-- single item
|
||||||
if t == "string"
|
if t == "string"
|
||||||
and item:get_name() == self.follow then
|
and item:get_name() == self.follow then
|
||||||
follow_item = true
|
return true
|
||||||
|
|
||||||
-- multiple items
|
-- multiple items
|
||||||
elseif t == "table" then
|
elseif t == "table" then
|
||||||
for no = 1, #self.follow do
|
for no = 1, #self.follow do
|
||||||
if self.follow[no] == item:get_name() then
|
if self.follow[no] == item:get_name() then
|
||||||
follow_item = true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- true if can eat/tame with item
|
|
||||||
if follow_item == true then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -60,6 +60,4 @@ dofile(path.."/crafts.lua")
|
||||||
-- Mob menu spawner special MFF
|
-- Mob menu spawner special MFF
|
||||||
dofile(path.."/mff_menu.lua")
|
dofile(path.."/mff_menu.lua")
|
||||||
|
|
||||||
if minetest.setting_get("log_mods") then
|
print ("[MOD] Mobs Redo loaded")
|
||||||
minetest.log("action", "mobs loaded")
|
|
||||||
end
|
|
||||||
|
|
|
@ -100,7 +100,9 @@ mobs:register_mob("mobs:npc", {
|
||||||
end
|
end
|
||||||
local pos = self.object:getpos()
|
local pos = self.object:getpos()
|
||||||
pos.y = pos.y + 0.5
|
pos.y = pos.y + 0.5
|
||||||
minetest.add_item(pos, {name = mobs.npc_drops[math.random(1,#mobs.npc_drops)]})
|
minetest.add_item(pos, {
|
||||||
|
name = mobs.npc_drops[math.random(1,#mobs.npc_drops)]
|
||||||
|
})
|
||||||
return
|
return
|
||||||
-- if owner switch between follow and stand
|
-- if owner switch between follow and stand
|
||||||
elseif self.owner and self.owner == clicker:get_player_name() then
|
elseif self.owner and self.owner == clicker:get_player_name() then
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user