Added poison box mob. Included screenshot.

master
William 2020-05-25 12:59:38 -04:00
parent bea17da5ad
commit f23f67b63c
7 changed files with 61 additions and 2 deletions

View File

@ -18,4 +18,5 @@ dofile(path .. "/mobs/box_shoot.lua")
dofile(path .. "/mobs/box_dig.lua")
dofile(path .. "/mobs/box_spike.lua")
dofile(path .. "/mobs/box_fire.lua")
dofile(path .. "/mobs/box_poison.lua")

54
mobs/box_poison.lua Normal file
View File

@ -0,0 +1,54 @@
minetest.register_entity("cube_mobs:box_poison",{
-- common props
physical = true,
collide_with_objects = false,
collisionbox = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
visual = "cube",
visual_size = {x = 1, y = 1},
textures = {"cube_mobs_box_poison_side.png","cube_mobs_box_poison_side.png","cube_mobs_box_poison_side.png","cube_mobs_box_poison_side.png","cube_mobs_box_poison_front.png","cube_mobs_box_poison_side.png"},
spritediv = {x = 1, y = 1},
initial_sprite_basepos = {x = 0, y = 0},
static_save = true,
makes_footstep_sound = true,
on_step = mobkit.stepfunc, -- required
on_activate = cube_mobkit.actfunc, -- required
get_staticdata = mobkit.statfunc,
-- api props
springiness=0,
buoyancy = 0.75, -- portion of hitbox submerged
max_speed = 5,
jump_height = 1.26,
view_range = 24,
lung_capacity = 10, -- seconds
max_hp = 10,
timeout=600,
attack={melee_range=1.5,speed=8, damage_groups={fleshy=4}},
sounds = {
attack='player_damage',
},
brainfunc = cube_mobkit.box_brain,
on_punch= function(self, puncher, time_from_last_punch, tool_capabilities, dir)
cube_mobkit.on_punch(self, puncher, time_from_last_punch, tool_capabilities, dir)
end,
on_death = function(self) -- fill area with poison for 10 seconds
local pos = self.object:get_pos()
for i=-2,2 do
for j =-2,2 do
local npos = {x=pos.x+i,y=pos.y+1,z=pos.z+j}
minetest.set_node( npos ,{name="cube_mobs:poison"})
local timer = minetest.get_node_timer(npos)
timer:start(10) -- poison dissappear after 10 seconds
end
end
end,
drops = {
{name="cube_mobs:bits", min=1, max=2,prob=255/3},
}
})
cube_mobkit.mob_names[#cube_mobkit.mob_names+1] = "cube_mobs:box_poison"

View File

@ -4,4 +4,4 @@ author = Xanthus
release = 1
description = Adds various cube mobs with different abilities using mobkit.
depends = default,mobkit
optional_depends = fire
optional_depends = fire,hudbars

View File

@ -154,5 +154,9 @@ minetest.register_node("cube_mobs:poison", {
groups = {
cracky = 3, catchable=1
},
on_timer = function(pos)
minetest.remove_node(pos)
return false
end,
sounds = default.node_sound_leaves_defaults(),
})
})

BIN
screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 677 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 639 B