mirror of
https://github.com/AntumMT/mod-slimes.git
synced 2024-12-23 01:00:28 +01:00
Merge pull request #1 from TomasJLuis/mobsredoapi
Mobs redo API integration
This commit is contained in:
commit
8d618688c5
288
api.lua
288
api.lua
@ -1,288 +0,0 @@
|
||||
slimes = {}
|
||||
function slimes:register_slime (name, def)
|
||||
|
||||
local defbox = def.size/2
|
||||
minetest.register_entity(name,{
|
||||
initial_properties = {
|
||||
name = name,
|
||||
hp_max = def.max_hp,
|
||||
visual_size = {x = def.size, y = def.size, z = def.size},
|
||||
visual = "cube",
|
||||
textures = def.textures, -- top, bottom, front, back, left, right
|
||||
collisionbox = {-defbox, -defbox, -defbox, defbox, defbox, defbox},
|
||||
physical = true,
|
||||
},
|
||||
alpha = 160,
|
||||
timer = 6,
|
||||
timer2 = 1,
|
||||
timer3 = 0, --regularly check if slime touches ground and possibly set x/z velocity/acceleration to 0
|
||||
yaw = 0,
|
||||
direction = {},
|
||||
status = 2, --1 = jump, 2 = rotate
|
||||
found_target = false,
|
||||
|
||||
-- ON ACTIVATE --
|
||||
on_activate = function(self)
|
||||
self.object:setacceleration({x = 0, y = -def.gravity, z = 0})
|
||||
end,
|
||||
|
||||
-- ON PUNCH --
|
||||
on_punch = function(self)
|
||||
local pos = self.object:getpos()
|
||||
minetest.sound_play(def.sounds.damage.file, {pos = pos,gain = (def.sounds.damage.gain or 0.25)})
|
||||
effect(pos, 20*math.random(), def.blood)
|
||||
check_for_slime_death (self,def)
|
||||
end,
|
||||
|
||||
-- ON STEP --
|
||||
on_step = function(self, dtime)
|
||||
|
||||
self.timer2 = self.timer2 + dtime
|
||||
local pos = self.object:getpos()
|
||||
|
||||
if self.status == 2 and (self.timer2 >= 0.5) then
|
||||
|
||||
self.timer2 = 1.2
|
||||
self.status = 1
|
||||
|
||||
-- FIXME
|
||||
if slime_lonely(pos) and not minetest.env:find_node_near(pos, 24, def.spawn) then
|
||||
self.object:remove()
|
||||
end
|
||||
|
||||
-- FIXME improve IA
|
||||
local objs = minetest.env:get_objects_inside_radius(pos, 24)
|
||||
local ppos = {}
|
||||
self.found_target = false
|
||||
self.yaw = math.random() * 360
|
||||
for i, obj in ipairs(objs) do
|
||||
if obj:is_player() and damage_enabled and not def.passive then self.found_target = obj break end
|
||||
if self.found_target == false
|
||||
and obj:get_luaentity()
|
||||
and (obj:get_luaentity().name == "slimes:" .. def.class .. "biga"
|
||||
or obj:get_luaentity().name == "slimes:" .. def.class .. "medium") then
|
||||
self.found_target = obj
|
||||
end
|
||||
end
|
||||
|
||||
if self.found_target ~= false then
|
||||
local target = self.found_target:getpos()
|
||||
ppos = {x = target.x - pos.x, z = target.z - pos.z}
|
||||
if ppos.x ~= 0 and ppos.z ~= 0 then --found itself as an object
|
||||
self.yaw = math.abs(math.atan(ppos.x/ppos.z) - math.pi / 2)
|
||||
if ppos.z < 0 then self.yaw = self.yaw + math.pi end
|
||||
--self.found_target = true
|
||||
end
|
||||
end
|
||||
|
||||
self.object:setyaw(self.yaw)
|
||||
self.object:set_properties({automatic_rotate = 0})
|
||||
self.direction = {x = math.cos(self.yaw)*2, y = 6, z = math.sin(self.yaw)*2}
|
||||
minetest.sound_play(def.sounds.jump.file, {pos = pos,gain = (def.sounds.jump.gain or 0.25)})
|
||||
self.object:set_properties({visual_size = {x = def.size, y = def.size - (def.size/8), z = def.size}})
|
||||
end
|
||||
|
||||
self.timer = self.timer + dtime
|
||||
self.timer3 = self.timer3 + dtime
|
||||
|
||||
if self.timer2 > 1.3 and self.object:getvelocity().y == 0 then
|
||||
|
||||
self.object:setvelocity(self.direction)
|
||||
self.object:setacceleration({x = self.direction.x/5, y = -def.gravity, z = self.direction.z/5})
|
||||
self.timer2 = 0
|
||||
self.object:set_properties({visual_size = {x = def.size, y = def.size + (def.size/8), z = def.size}})
|
||||
|
||||
end
|
||||
|
||||
if (self.timer >= 6
|
||||
or (self.timer >= 1
|
||||
and self.found_target ~= false))
|
||||
and self.object:getvelocity().y == 0 then
|
||||
|
||||
self.timer = 0
|
||||
self.timer2 = 0
|
||||
self.status = 2
|
||||
|
||||
if self.found_target == false then self.object:set_properties({automatic_rotate = math.pi * 8}) end
|
||||
|
||||
minetest.sound_play(def.sounds.land.file, {pos = pos,gain = (def.sounds.land.gain or 0.25)})
|
||||
|
||||
local n = minetest.get_node(pos)
|
||||
if def.footprint
|
||||
and minetest.get_item_group(n.name, "water") == 0
|
||||
then minetest.set_node(pos, {name=def.footprint}) end
|
||||
effect(pos, 20*math.random(), def.blood)
|
||||
self.object:set_properties({visual_size = {x = def.size, y = def.size - (def.size/8), z = def.size}})
|
||||
|
||||
if damage_enabled then
|
||||
|
||||
local tod = minetest.get_timeofday()
|
||||
|
||||
--FIXME water and lava damage detection is not working like it should.
|
||||
|
||||
-- sunlight damage
|
||||
if def.light_damage and def.light_damage ~= 0
|
||||
and minetest.get_item_group(n.name, "water") == 0 -- no sun damage in water
|
||||
and pos.y > 0
|
||||
and (minetest.get_node_light(pos) or 0) > 10 -- direct sunlight (was 4)
|
||||
and tod > 0.2 and tod < 0.8 then
|
||||
self.object:set_hp(self.object:get_hp()-def.light_damage)
|
||||
effect(pos, 20*math.random(), "tnt_smoke.png")
|
||||
minetest.chat_send_all("me derrito ".. (minetest.get_node_light(pos) or 0))
|
||||
end
|
||||
|
||||
-- water damage
|
||||
if def.water_damage and def.water_damage ~= 0
|
||||
and minetest.get_item_group(n.name, "water") ~= 0 then
|
||||
self.object:set_hp(self.object:get_hp()-def.water_damage)
|
||||
effect(pos, 20*math.random(), "bubble.png")
|
||||
end
|
||||
|
||||
-- lava damage
|
||||
if def.lava_damage and def.lava_damage ~= 0
|
||||
and minetest.get_item_group(n.name, "lava") ~= 0 then
|
||||
self.object:set_hp(self.object:get_hp()-def.lava_damage)
|
||||
effect(pos, 20*math.random(), "fire_basic_flame.png")
|
||||
end
|
||||
|
||||
-- fall damage
|
||||
if self.fall_damage == 1 and self.object:getvelocity().y == 0 then
|
||||
local d = self.old_y - self.object:getpos().y
|
||||
self.old_y = self.object:getpos().y
|
||||
if d > 5 then
|
||||
self.object:set_hp(self.object:get_hp() - math.floor(d - 5))
|
||||
end
|
||||
end
|
||||
|
||||
check_for_slime_death (self,def)
|
||||
|
||||
local objs = minetest.env:get_objects_inside_radius(pos, def.size*1.75)
|
||||
for i, obj in ipairs(objs) do
|
||||
if obj:is_player() and not def.passive then
|
||||
obj:punch(self.object, 1.0, {full_punch_interval=1.0,damage_groups = {fleshy=def.damage}})
|
||||
minetest.sound_play(def.sounds.attack.file, {pos = pos,gain = (def.sounds.attack.gain or 0.25)})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if self.timer3 > 0.07 then
|
||||
local vel = self.object:getvelocity()
|
||||
if vel.y == 0 and (vel.x ~= 0 or vel.z ~= 0) then
|
||||
self.object:setvelocity({x = 0, y = 0, z = 0})
|
||||
self.object:setacceleration({x = 0, y = -def.gravity, z = 0})
|
||||
self.object:set_properties({visual_size = {x = def.size, y = def.size, z = def.size}})
|
||||
end
|
||||
self.timer3 = 0
|
||||
end
|
||||
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
-- check if slime is alone
|
||||
function slime_lonely (pos)
|
||||
local objs = minetest.env:get_objects_inside_radius(pos, 32)
|
||||
for i, obj in pairs(objs) do
|
||||
if obj:is_player() then return false end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
-- check for death
|
||||
function check_for_slime_death(self,def)
|
||||
|
||||
if self.object:get_hp() > 0 then return end
|
||||
|
||||
local pos = self.object:getpos()
|
||||
pos.y = pos.y + 0.5
|
||||
|
||||
if (def.sounds.death.file ~= nil ) then minetest.sound_play(def.sounds.death.file, {pos = pos,gain = (def.sounds.death.gain or 0.25)}) end
|
||||
self.object:remove()
|
||||
|
||||
local chance = def.drops.chance
|
||||
if math.random(1, def.drops.chance+1) == 1 or def.drops.chance == 0 then
|
||||
local min = def.drops.min
|
||||
local max = def.drops.max
|
||||
local num = math.floor(math.random(min, max+1))
|
||||
if def.drops.type == "item" then
|
||||
for i=1,num do minetest.env:add_item(pos, def.drop) end
|
||||
end
|
||||
if def.drops.type == "entity" then
|
||||
for i=1,num do minetest.env:add_entity({x=pos.x, y=pos.y + (def.size*math.random()), z=pos.z + (def.size*math.random())}, def.drops.name) end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- particle effects
|
||||
function effect(pos, amount, texture)
|
||||
minetest.add_particlespawner({
|
||||
amount = amount,
|
||||
time = 0.25,
|
||||
minpos = pos,
|
||||
maxpos = pos,
|
||||
minvel = {x=-0, y=-2, z=-0},
|
||||
maxvel = {x=2, y=2, z=2},
|
||||
minacc = {x=-4, y=-4, z=-4},
|
||||
maxacc = {x=4, y=4, z=4},
|
||||
minexptime = 0.1,
|
||||
maxexptime = 1,
|
||||
minsize = 0.5,
|
||||
maxsize = 1,
|
||||
texture = texture,
|
||||
})
|
||||
end
|
||||
|
||||
-- spawn slimes
|
||||
slimes.spawn = {}
|
||||
function slimes:register_spawn(name, nodes, neighbors, max_light, min_light, chance, active_object_count, max_height)
|
||||
slimes.spawn[name] = true
|
||||
minetest.register_abm({
|
||||
nodenames = nodes,
|
||||
neighbors = neighbors,
|
||||
interval = 30,
|
||||
chance = chance,
|
||||
action = function(pos, node, _, active_object_count_wider)
|
||||
|
||||
-- do not spawn if too many active in area
|
||||
if active_object_count_wider > active_object_count
|
||||
or not pos then
|
||||
return
|
||||
end
|
||||
|
||||
-- mobs cannot spawn inside protected areas
|
||||
if minetest.is_protected(pos, "") then
|
||||
return
|
||||
end
|
||||
|
||||
-- spawn above node
|
||||
pos.y = pos.y + 1
|
||||
|
||||
-- check if light and height levels are ok to spawn
|
||||
local light = minetest.get_node_light(pos)
|
||||
if not light or light > max_light or light < min_light
|
||||
or pos.y > max_height then
|
||||
return
|
||||
end
|
||||
|
||||
-- are we spawning inside a solid node?
|
||||
local nod = minetest.get_node_or_nil(pos)
|
||||
if not nod or not minetest.registered_nodes[nod.name]
|
||||
or minetest.registered_nodes[nod.name].walkable == true then
|
||||
return
|
||||
end
|
||||
pos.y = pos.y + 1
|
||||
nod = minetest.get_node_or_nil(pos)
|
||||
if not nod or not minetest.registered_nodes[nod.name]
|
||||
or minetest.registered_nodes[nod.name].walkable == true then
|
||||
return
|
||||
end
|
||||
|
||||
-- spawn mob half block higher
|
||||
pos.y = pos.y - 0.5
|
||||
minetest.add_entity(pos, name)
|
||||
|
||||
end
|
||||
})
|
||||
end
|
||||
|
@ -1,2 +1,5 @@
|
||||
mesecons_materials
|
||||
default:tnt
|
||||
default
|
||||
tnt
|
||||
mobs
|
||||
mesecons_materials?
|
||||
|
||||
|
190
greenslimes.lua
190
greenslimes.lua
@ -1,94 +1,124 @@
|
||||
-- Green Slimes by TomasJLuis & TenPlus1
|
||||
|
||||
-- sounds
|
||||
local green_sounds = {
|
||||
damage = { file = "green_slime_damage", gain = 0.25},
|
||||
death = { file = "green_slime_death", gain = 0.25},
|
||||
jump = { file = "green_slime_jump", gain = 0.25},
|
||||
land = { file = "green_slime_land", gain = 0.25},
|
||||
attack = { file = "green_slime_attack", gain = 0.25},
|
||||
random = {}
|
||||
damage = "slimes_damage",
|
||||
death = "slimes_death",
|
||||
jump = "slimes_jump",
|
||||
attack = "slimes_attack",
|
||||
}
|
||||
-- textures: top, bottom, front, back, left, right
|
||||
local green_textures = {"green_slime_top.png", "green_slime_bottom.png", "green_slime_front.png", "green_slime_sides.png", "green_slime_sides.png", "green_slime_sides.png"}
|
||||
|
||||
slimes:register_slime ("slimes:greenbig", {
|
||||
name = "slimes:greenbig",
|
||||
-- green slime textures
|
||||
local green_textures = {"green_slime_sides.png", "green_slime_sides.png", "green_slime_sides.png", "green_slime_sides.png", "green_slime_front.png", "green_slime_sides.png"}
|
||||
|
||||
-- register small green slime
|
||||
mobs:register_mob("slimes:greensmall", {
|
||||
type = "monster",
|
||||
class = "green",
|
||||
hp_min = 1, hp_max = 2,
|
||||
collisionbox = {-0.25, -0.25, -0.25, 0.25, 0.25, 0.25},
|
||||
visual = "cube",
|
||||
visual_size = {x = 0.5, y = 0.5},
|
||||
textures = { green_textures },
|
||||
blood_texture = "green_slime_blood.png",
|
||||
makes_footstep_sound = false,
|
||||
sounds = green_sounds,
|
||||
attack_type = "dogfight",
|
||||
attacks_monsters = true,
|
||||
damage = 1,
|
||||
passive = false,
|
||||
size = 2,
|
||||
textures = green_textures,
|
||||
blood = "green_slime_blood.png",
|
||||
gravity = 9.8,
|
||||
min_hp = 4,
|
||||
max_hp = 6,
|
||||
walk_velocity = 2,
|
||||
run_velocity = 2,
|
||||
walk_chance = 0,
|
||||
jump_chance = 30,
|
||||
jump_height = 6,
|
||||
armor = 100,
|
||||
view_range = 15,
|
||||
drops = {
|
||||
{name = "mesecons_materials:glue", chance = 4, min = 1, max = 2},
|
||||
},
|
||||
drawtype = "front",
|
||||
water_damage = 0,
|
||||
lava_damage = 10,
|
||||
light_damage = 0,
|
||||
})
|
||||
mobs:register_egg("slimes:greensmall", "Small Green Slime", "green_slime_egg.png", 1)
|
||||
|
||||
-- register medium green slime
|
||||
mobs:register_mob("slimes:greenmedium", {
|
||||
type = "monster",
|
||||
hp_min = 3, hp_max = 4,
|
||||
collisionbox = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
|
||||
visual = "cube",
|
||||
visual_size = {x = 1, y = 1},
|
||||
textures = { green_textures },
|
||||
blood_texture = "green_slime_blood.png",
|
||||
makes_footstep_sound = false,
|
||||
sounds = green_sounds,
|
||||
attack_type = "dogfight",
|
||||
attacks_monsters = true,
|
||||
damage = 1,
|
||||
passive = false,
|
||||
walk_velocity = 2,
|
||||
run_velocity = 2,
|
||||
walk_chance = 0,
|
||||
jump_chance = 30,
|
||||
jump_height = 6,
|
||||
armor = 100,
|
||||
view_range = 15,
|
||||
on_die = function(self, pos)
|
||||
local num = math.random(2, 4)
|
||||
for i=1,num do
|
||||
minetest.add_entity({x=pos.x + math.random(-2, 2), y=pos.y + 1, z=pos.z + (math.random(-2, 2))}, "slimes:greensmall")
|
||||
end
|
||||
end,
|
||||
drawtype = "front",
|
||||
water_damage = 0,
|
||||
lava_damage = 10,
|
||||
light_damage = 0,
|
||||
})
|
||||
mobs:register_egg("slimes:greenmedium", "Medium Green Slime", "green_slime_egg.png", 1)
|
||||
|
||||
-- register big green slime
|
||||
mobs:register_mob("slimes:greenbig", {
|
||||
type = "monster",
|
||||
hp_min = 5, hp_max = 6,
|
||||
collisionbox = {-1, -1, -1, 1, 1, 1},
|
||||
visual = "cube",
|
||||
visual_size = {x = 2, y = 2},
|
||||
textures = { green_textures },
|
||||
blood_texture = "green_slime_blood.png",
|
||||
makes_footstep_sound = false,
|
||||
sounds = green_sounds,
|
||||
attack_type = "dogfight",
|
||||
attacks_monsters = true,
|
||||
damage = 2,
|
||||
sounds = green_sounds,
|
||||
drops = {
|
||||
type = "entity",
|
||||
name = "slimes:greenmedium",
|
||||
chance = 0, min = 1, max = 2},
|
||||
-- damage by
|
||||
water_damage = 0,
|
||||
lava_damage = 10,
|
||||
light_damage = 0,
|
||||
fall_damage = 0,
|
||||
-- spawn block
|
||||
spawn = "default:junglegrass"
|
||||
})
|
||||
slimes:register_slime ("slimes:greenmedium", {
|
||||
name = "slimes:greenmedium",
|
||||
type = "monster",
|
||||
class ="green",
|
||||
passive = false,
|
||||
size = 1,
|
||||
min_hp = 3,
|
||||
max_hp = 4,
|
||||
damage = 1,
|
||||
sounds = green_sounds,
|
||||
textures = green_textures,
|
||||
blood = "green_slime_blood.png",
|
||||
gravity = 9.8,
|
||||
drop = "",
|
||||
drops = {
|
||||
type = "entity",
|
||||
name = "slimes:greensmall",
|
||||
chance = 0, min = 2, max = 4},
|
||||
-- damage by
|
||||
walk_velocity = 2,
|
||||
run_velocity = 2,
|
||||
walk_chance = 0,
|
||||
jump_chance = 30,
|
||||
jump_height = 6,
|
||||
armor = 100,
|
||||
view_range = 15,
|
||||
on_die = function(self, pos)
|
||||
local num = math.random(1, 2)
|
||||
for i=1,num do
|
||||
minetest.add_entity({x=pos.x + math.random(-2, 2), y=pos.y + 1, z=pos.z + (math.random(-2, 2))}, "slimes:greenmedium")
|
||||
end
|
||||
end,
|
||||
drawtype = "front",
|
||||
water_damage = 0,
|
||||
lava_damage = 10,
|
||||
light_damage = 0,
|
||||
fall_damage = 0,
|
||||
spawn = "default:junglegrass"
|
||||
})
|
||||
slimes:register_slime ("slimes:greensmall", {
|
||||
name = "slimes:greensmall",
|
||||
type = "monster",
|
||||
class ="green",
|
||||
passive = false,
|
||||
size = 0.5,
|
||||
min_hp = 1,
|
||||
max_hp = 2,
|
||||
damage = 1,
|
||||
sounds = green_sounds,
|
||||
textures = green_textures,
|
||||
blood = "green_slime_blood.png",
|
||||
gravity = 9.8,
|
||||
drop = "mesecons_materials:glue 1",
|
||||
drops = {
|
||||
type = "item",
|
||||
name = "mesecons_materials:glue 1",
|
||||
chance = 4, min = 1, max = 2},
|
||||
-- damage by
|
||||
water_damage = 0,
|
||||
lava_damage = 10,
|
||||
light_damage = 0,
|
||||
fall_damage = 0,
|
||||
spawn = "default:junglegrass"
|
||||
})
|
||||
mobs:register_egg("slimes:greenbig", "Big Green Slime", "green_slime_egg.png", 1)
|
||||
|
||||
slimes:register_spawn("slimes:greenbig", {"default:junglegrass"},{"air","default:junglegrass"}, 20, 4, 5000, 8, 32000)
|
||||
slimes:register_spawn("slimes:greenmedium", {"default:junglegrass"},{"air","default:junglegrass"}, 20, 4, 10000, 8, 32000)
|
||||
slimes:register_spawn("slimes:greensmall", {"default:junglegrass"},{"air","default:junglegrass"}, 20, 4, 15000, 8, 32000)
|
||||
slimes:register_spawn("slimes:greenmedium", {"default:mossycobble"},{"air"}, 20, 4, 10000, 8, 32000)
|
||||
slimes:register_spawn("slimes:greensmall", {"default:mossycobble"},{"air"}, 20, 4, 10000, 8, 32000)
|
||||
--mobs:spawn_specific(name, nodes, neighbors, min_light, max_light, interval, chance, active_object_count, min_height, max_height)
|
||||
mobs:spawn_specific("slimes:greenbig", {"default:junglegrass"},{"air","default:junglegrass"}, 4, 20, 30, 5000, 8, 0, 32000)
|
||||
mobs:spawn_specific("slimes:greenmedium", {"default:junglegrass"},{"air","default:junglegrass"}, 4, 20, 30, 10000, 8, 0, 32000)
|
||||
mobs:spawn_specific("slimes:greensmall", {"default:junglegrass"},{"air","default:junglegrass"}, 4, 4, 30, 15000, 8, 0, 32000)
|
||||
|
||||
--mobs:register_spawn(name, nodes, max_light, min_light, chance, active_object_count, max_height)
|
||||
mobs:register_spawn("slimes:greenmedium", {"default:mossycobble"}, 20, 4, 10000, 8, 32000)
|
||||
mobs:register_spawn("slimes:greensmall", {"default:mossycobble"}, 20, 4, 10000, 8, 32000)
|
||||
|
||||
|
16
init.lua
16
init.lua
@ -1,11 +1,17 @@
|
||||
-- API
|
||||
dofile(minetest.get_modpath("slimes").."/api.lua")
|
||||
-- Slimes by TomasJLuis
|
||||
-- Migration to Mobs Redo API by TenPlus1
|
||||
|
||||
-- SLIMES
|
||||
-- load mod files
|
||||
dofile(minetest.get_modpath("slimes").."/greenslimes.lua")
|
||||
dofile(minetest.get_modpath("slimes").."/lavaslimes.lua")
|
||||
--dofile(minetest.get_modpath("slimes").."/waterslimes.lua")
|
||||
|
||||
-- cannot find mesecons?, craft glue instead
|
||||
if not minetest.get_modpath("mesecons_materials") then
|
||||
minetest.register_craftitem(":mesecons_materials:glue", {
|
||||
image = "jeija_glue.png",
|
||||
description="Glue",
|
||||
})
|
||||
end
|
||||
|
||||
if minetest.setting_get("log_mods") then minetest.log("action", "Slimes loaded") end
|
||||
damage_enabled = minetest.setting_getbool("enable_damage")
|
||||
|
||||
|
189
lavaslimes.lua
189
lavaslimes.lua
@ -1,90 +1,127 @@
|
||||
-- Lava Slimes by TomasJLuis & TenPlus1
|
||||
|
||||
-- sounds
|
||||
local lava_sounds = {
|
||||
damage = { file = "lava_slime_damage", gain = 0.25},
|
||||
death = { file = "lava_slime_death", gain = 0.25},
|
||||
jump = { file = "lava_slime_jump", gain = 0.25},
|
||||
--land = { file = "default_cool_lava.3", gain = 5},
|
||||
land = { file = "lava_slime_land", gain = 0.25},
|
||||
attack = { file = "lava_slime_attack", gain = 0.25},
|
||||
random = {}
|
||||
damage = "slimes_damage",
|
||||
death = "slimes_death",
|
||||
jump = "slimes_jump",
|
||||
attack = "slimes_attack",
|
||||
}
|
||||
-- textures : top, bottom, front, back, left, right
|
||||
local lava_textures = {"lava_slime_top.png", "lava_slime_bottom.png", "lava_slime_front.png", "lava_slime_sides.png", "lava_slime_sides.png", "lava_slime_sides.png"}
|
||||
|
||||
slimes:register_slime ("slimes:lavabig", {
|
||||
-- lava slime textures
|
||||
local lava_textures = {"lava_slime_sides.png", "lava_slime_sides.png", "lava_slime_sides.png", "lava_slime_sides.png", "lava_slime_front.png", "lava_slime_sides.png"}
|
||||
|
||||
-- register small lava slime
|
||||
mobs:register_mob("slimes:lavasmall", {
|
||||
type = "monster",
|
||||
class ="lava",
|
||||
name = "slimes:lavabig",
|
||||
passive = false,
|
||||
size = 2,
|
||||
max_hp = 6,
|
||||
damage = 3,
|
||||
hp_min = 1, hp_max = 2,
|
||||
collisionbox = {-0.25, -0.25, -0.25, 0.25, 0.25, 0.25},
|
||||
visual = "cube",
|
||||
visual_size = {x = 0.5, y = 0.5},
|
||||
textures = { lava_textures },
|
||||
blood_texture = "lava_slime_blood.png",
|
||||
makes_footstep_sound = false,
|
||||
sounds = lava_sounds,
|
||||
textures = lava_textures,
|
||||
blood = "lava_slime_blood.png",
|
||||
footprint = "fire:basic_flame",
|
||||
gravity = 9.8,
|
||||
drops = {
|
||||
type = "entity",
|
||||
name = "slimes:lavamedium",
|
||||
chance = 0, min = 1, max = 2},
|
||||
-- damage by
|
||||
water_damage = 10,
|
||||
lava_damage = 0,
|
||||
light_damage = 0,
|
||||
fall_damage = 0,
|
||||
spawn = "default:lava_source"
|
||||
})
|
||||
slimes:register_slime ("slimes:lavamedium", {
|
||||
type = "monster",
|
||||
class ="lava",
|
||||
name = "slimes:lavamedium",
|
||||
passive = false,
|
||||
size = 1,
|
||||
max_hp = 4,
|
||||
damage = 2,
|
||||
sounds = lava_sounds,
|
||||
textures = lava_textures,
|
||||
blood = "lava_slime_blood.png",
|
||||
footprint = "fire:basic_flame",
|
||||
gravity = 9.8,
|
||||
drops = {
|
||||
type = "entity",
|
||||
name = "slimes:lavasmall",
|
||||
chance = 0, min = 1, max = 4},
|
||||
-- damage by
|
||||
water_damage = 10,
|
||||
lava_damage = 0,
|
||||
light_damage = 0,
|
||||
fall_damage = 0,
|
||||
spawn = "default:lava_source"
|
||||
})
|
||||
slimes:register_slime ("slimes:lavasmall", {
|
||||
type = "monster",
|
||||
class ="lava",
|
||||
name = "slimes:lavasmall",
|
||||
passive = false,
|
||||
size = 0.5,
|
||||
max_hp = 2,
|
||||
attack_type = "dogfight",
|
||||
attacks_monsters = true,
|
||||
damage = 1,
|
||||
sounds = lava_sounds,
|
||||
textures = lava_textures,
|
||||
blood = "lava_slime_blood.png",
|
||||
footprint = "fire:basic_flame",
|
||||
gravity = 9.8,
|
||||
passive = false,
|
||||
walk_velocity = 2,
|
||||
run_velocity = 2,
|
||||
walk_chance = 0,
|
||||
jump_chance = 30,
|
||||
jump_height = 6,
|
||||
armor = 90,
|
||||
view_range = 15,
|
||||
drops = {
|
||||
type = "item",
|
||||
name = "tnt:gunpowder",
|
||||
chance = 4, min = 1, max = 2},
|
||||
-- damage by
|
||||
{name = "tnt:gunpowder", chance = 4, min = 1, max = 2},
|
||||
},
|
||||
drawtype = "front",
|
||||
water_damage = 10,
|
||||
lava_damage = 0,
|
||||
light_damage = 0,
|
||||
fall_damage = 0,
|
||||
spawn = "default:lava_source"
|
||||
replace_rate = 20,
|
||||
footstep = "fire:basic_flame",
|
||||
})
|
||||
mobs:register_egg("slimes:lavasmall", "Small Lava Slime", "lava_slime_egg.png", 1)
|
||||
|
||||
slimes:register_spawn("slimes:lavabig", {"default:lava_source"},{"default:lava_source","default:lava_flowing"}, 20, 4, 5000, 8, -64)
|
||||
slimes:register_spawn("slimes:lavamedium", {"default:lava_source"},{"default:lava_source","default:lava_flowing"}, 20, 4, 10000, 8, -64)
|
||||
slimes:register_spawn("slimes:lavasmall", {"default:lava_source"},{"default:lava_source","default:lava_flowing"}, 20, 4, 15000, 8, -64)
|
||||
-- register medium lava slime
|
||||
mobs:register_mob("slimes:lavamedium", {
|
||||
type = "monster",
|
||||
hp_min = 3, hp_max = 4,
|
||||
collisionbox = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
|
||||
visual = "cube",
|
||||
visual_size = {x = 1, y = 1},
|
||||
textures = { lava_textures },
|
||||
blood_texture = "lava_slime_blood.png",
|
||||
makes_footstep_sound = false,
|
||||
sounds = lava_sounds,
|
||||
attack_type = "dogfight",
|
||||
attacks_monsters = true,
|
||||
damage = 2,
|
||||
passive = false,
|
||||
walk_velocity = 2,
|
||||
run_velocity = 2,
|
||||
walk_chance = 0,
|
||||
jump_chance = 30,
|
||||
jump_height = 6,
|
||||
armor = 90,
|
||||
view_range = 15,
|
||||
on_die = function(self, pos)
|
||||
local num = math.random(2, 4)
|
||||
for i=1,num do
|
||||
minetest.add_entity({x=pos.x + math.random(-2, 2), y=pos.y + 1, z=pos.z + (math.random(-2, 2))}, "slimes:lavasmall")
|
||||
end
|
||||
end,
|
||||
drawtype = "front",
|
||||
water_damage = 10,
|
||||
lava_damage = 0,
|
||||
light_damage = 0,
|
||||
replace_rate = 20,
|
||||
footstep = "fire:basic_flame",
|
||||
})
|
||||
mobs:register_egg("slimes:lavamedium", "Medium Lava Slime", "lava_slime_egg.png", 1)
|
||||
|
||||
-- register big lava slime
|
||||
mobs:register_mob("slimes:lavabig", {
|
||||
type = "monster",
|
||||
hp_min = 5, hp_max = 6,
|
||||
collisionbox = {-1, -1, -1, 1, 1, 1},
|
||||
visual = "cube",
|
||||
visual_size = {x = 2, y = 2},
|
||||
textures = { lava_textures },
|
||||
blood_texture = "lava_slime_blood.png",
|
||||
makes_footstep_sound = false,
|
||||
sounds = lava_sounds,
|
||||
attack_type = "dogfight",
|
||||
attacks_monsters = true,
|
||||
damage = 3,
|
||||
passive = false,
|
||||
walk_velocity = 2,
|
||||
run_velocity = 2,
|
||||
walk_chance = 0,
|
||||
jump_chance = 30,
|
||||
jump_height = 6,
|
||||
armor = 90,
|
||||
view_range = 15,
|
||||
on_die = function(self, pos)
|
||||
local num = math.random(1, 2)
|
||||
for i=1,num do
|
||||
minetest.add_entity({x=pos.x + math.random(-2, 2), y=pos.y + 1, z=pos.z + (math.random(-2, 2))}, "slimes:lavamedium")
|
||||
end
|
||||
end,
|
||||
drawtype = "front",
|
||||
water_damage = 10,
|
||||
lava_damage = 0,
|
||||
light_damage = 0,
|
||||
replace_rate = 20,
|
||||
replace_offset = -1,
|
||||
footstep = "fire:basic_flame",
|
||||
})
|
||||
mobs:register_egg("slimes:lavabig", "Big Lava Slime", "lava_slime_egg.png", 1)
|
||||
|
||||
--mobs:spawn_specific(name, nodes, neighbors, min_light, max_light, interval, chance, active_object_count, min_height, max_height)
|
||||
|
||||
mobs:spawn_specific("slimes:lavabig", {"default:lava_source"},{"default:lava_flowing"}, 4, 20, 30, 5000, 8, -32000, -64)
|
||||
mobs:spawn_specific("slimes:lavamedium", {"default:lava_source"},{"default:lava_flowing"}, 4, 20, 30, 10000, 8, -32000, -64)
|
||||
mobs:spawn_specific("slimes:lavasmall", {"default:lava_source"},{"default:lava_flowing"}, 4, 20, 30, 15000, 8, -32000, -64)
|
||||
|
57
readme.txt
57
readme.txt
@ -1,27 +1,22 @@
|
||||
|
||||
"Slimes Redone" - Mod for Minetest (http://www.minetest.net/)
|
||||
"Slimes Redo" - Mod for Minetest (http://www.minetest.net/)
|
||||
|
||||
Introduction
|
||||
==========================================================================================================================
|
||||
This mod adds two type of mobs in the world of Minetest: green slimes and lava slimes. They are hostile and will attack the
|
||||
players as soon as they see them. If they are defeated, the slimes maybe will reward the player with useful resources.
|
||||
===========================================================================
|
||||
This mod adds two type of mobs in the world of Minetest: green slimes and lava slimes. They are hostile and will attack the players as soon as they see them. If they are defeated, the slimes maybe will reward the player with useful resources.
|
||||
|
||||
Green slimes live in the tall grass of the jungles and in the ancient ruins of lost temples. And lava slimes live deep
|
||||
underground near the lava pools.
|
||||
Green slimes live in the tall grass of the jungles and in the ancient ruins of lost temples. And lava slimes live deep underground near the lava pools.
|
||||
|
||||
I've made this mod inspired by this other: https://forum.minetest.net/viewtopic.php?f=11&t=2979&hilit=slimes which adds friendly
|
||||
I've made this mod inspired by this other mod: https://forum.minetest.net/viewtopic.php?f=11&t=2979&hilit=slimes which adds friendly
|
||||
slimes. Thank you Jeija!
|
||||
|
||||
Details
|
||||
==========================================================================================================================
|
||||
===========================================================================
|
||||
- Adds two new hostile mobs: green slimes and lava slimes.
|
||||
- They attack players and hurt them on touch. (i'm not sure if the amount of damage is enough or too much...:/)
|
||||
- They attack players and hurt them on touch.
|
||||
- The biger ones split in a random amout of smaller versions when defeated: big > medium > small.
|
||||
- They can get different enviromental damage: water, lava, sunlight and falling.
|
||||
- Thaks to Mob Redo API they can get different enviromental damage: water, lava, sunlight and falling.
|
||||
- They use custom textures and sounds. (more work needs to be done here ;P)
|
||||
- Cartoonish animation (they deform a bit when landing and stretch out when jumping).
|
||||
- Effects (blood, smoke, bubbles, footprints,..).
|
||||
- API to add new slimes.
|
||||
|
||||
Green slimes:
|
||||
> spawn in jungle grass or in temples mossy cobble (default:mossycobble).
|
||||
@ -32,10 +27,10 @@ Lava slimes:
|
||||
> spawn in lava pools deep under ground.
|
||||
> on die, they drop a randomish amount of gunpowder (from default tnt mod).
|
||||
> water hurts them.
|
||||
> when they jump they leave behind a footprint of fire. ^^
|
||||
> when they jump they can leave behind a footprint of fire. ^^
|
||||
|
||||
Install
|
||||
==========================================================================================================================
|
||||
===========================================================================
|
||||
Unzip the archive an place it in minetest-base-directory/mods/minetest/
|
||||
If you have a windows client or a linux run-in-place client.
|
||||
If you have a linux system-wide instalation place it in ~/.minetest/mods/minetest/.
|
||||
@ -43,35 +38,37 @@ If you want to install this mod only in one world create the folder worldmods/ i
|
||||
For further information or help see: http://wiki.minetest.com/wiki/Installing_Mods
|
||||
|
||||
How to use the mod:
|
||||
==========================================================================================================================
|
||||
Just install it an everything should work.
|
||||
===========================================================================
|
||||
1. Install Mobs Redo >= 1.9
|
||||
2. Install Slimes Redo.
|
||||
3. Enjoy
|
||||
|
||||
Mod Information
|
||||
==========================================================================================================================
|
||||
Version: 0.1
|
||||
===========================================================================
|
||||
Version: 0.2
|
||||
Required Minetest Version: >=0.4.12
|
||||
Dependencies: default, default:tnt, mesecon (https://forum.minetest.net/viewtopic.php?f=11&t=628&hilit=mesecon)
|
||||
Dependencies: default, tnt, mobs redo >=1.9 (https://forum.minetest.net/viewtopic.php?f=9&t=9917)
|
||||
Soft Dependencies: (none)
|
||||
Highly Recommended: (none)
|
||||
Highly Recommended: mesecon_materials (https://forum.minetest.net/viewtopic.php?f=11&t=628&hilit=mesecon)
|
||||
Craft Recipies: (none)
|
||||
Git Repo: https://github.com/TomasJLuis/mt-slimes-redone
|
||||
Git Repo: https://github.com/TomasJLuis/mt-slimes-redone branch: mobsredoapi
|
||||
|
||||
Modders/Developers
|
||||
=========================================================================================================================
|
||||
If you are a modder, you should know that I've never used LUA before. this is my first mod for Mintetest, and I've used
|
||||
this mod to learn how to mod on Minetest. So may be you will find a code full of mistakes and bad practices... ;P
|
||||
If you spot someting that can/must be improved/changed/removed and want to help me to improve this mode and my knowledge,
|
||||
please tell me here: https://forum.minetest.net/viewtopic.php?f=9&t=11743&p=175186#p175186
|
||||
===========================================================================
|
||||
If you are a modder, you should know that I've never used LUA before. this is my first mod for Mintetest, and I've used this mod to learn how to mod on Minetest. So may be you will find a code full of mistakes and bad practices... ;P
|
||||
If you spot someting that can/must be improved/changed/removed and want to help me to improve this mode and my knowledge, please report to me on GitHub or on Minetest forum (https://forum.minetest.net/viewtopic.php?f=9&t=11743&p=175186#p175186)
|
||||
Thank you!
|
||||
|
||||
Version history
|
||||
==========================================================================================================================
|
||||
===========================================================================
|
||||
0.2 - Now using Mob Redo API (Thank you TenPlus1). Changed mod name to Slimes Redo to reflect better this.
|
||||
0.1 - Initial release
|
||||
|
||||
Copyright and Licensing
|
||||
==========================================================================================================================
|
||||
===========================================================================
|
||||
|
||||
- Author: Tomas J. Luis
|
||||
- Authors: Tomas J. Luis (textures, code)
|
||||
TenPlus1 (migration to Mobs Redo API)
|
||||
|
||||
- Original sound for slime damage by RandomationPictures under licence CC0 1.0.
|
||||
http://www.freesound.org/people/RandomationPictures/sounds/138481/
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
textures/green_slime_egg.png
Normal file
BIN
textures/green_slime_egg.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
textures/jeija_glue.png
Normal file
BIN
textures/jeija_glue.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 487 B |
BIN
textures/lava_slime_egg.png
Normal file
BIN
textures/lava_slime_egg.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 874 B |
Loading…
Reference in New Issue
Block a user