added water/fire cube
This commit is contained in:
parent
4857359c73
commit
40280366e8
@ -26,9 +26,10 @@ function mobs.register_mob(name, def)
|
||||
makes_footstep_sound = false,
|
||||
automatic_rotate = true,
|
||||
speed = 0,
|
||||
anim = "",
|
||||
on_step = function(self, dtime)
|
||||
if math.random(0, 50) == 15 then
|
||||
self.object:setvelocity({x=math.random(-2, 2), y=-4, z=math.random(-2, 2)})
|
||||
self.object:setvelocity({x=math.random(-2, 2), y=(def.gravity or -9.2), z=math.random(-2, 2)})
|
||||
|
||||
local all_objects = minetest.get_objects_inside_radius(self.object:getpos(), def.range)
|
||||
local _,obj
|
||||
@ -38,6 +39,12 @@ function mobs.register_mob(name, def)
|
||||
obj:punch(self.object, 10, def.dmg, nil)
|
||||
end
|
||||
end
|
||||
if def.animations then
|
||||
if self.anim ~= "walk" then
|
||||
self.object:set_animation({x=def.animations.walk.x,y=def.animations.walk.y}, 30, 0)
|
||||
self.anim = "walk"
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
@ -50,7 +57,8 @@ function mobs.register_mob(name, def)
|
||||
if pointed_thing.type ~= "node" then
|
||||
return
|
||||
end
|
||||
minetest.add_entity(pointed_thing.above, name)
|
||||
local p = {x=pointed_thing.above.x, y=pointed_thing.above.y+2, z=pointed_thing.above.z}
|
||||
minetest.add_entity(p, name)
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
itemstack:take_item()
|
||||
end
|
||||
@ -75,3 +83,45 @@ mobs.register_mob("mobs:angry_player", {
|
||||
description = "Angry Player",
|
||||
range = 3,
|
||||
})
|
||||
|
||||
mobs.register_mob("mobs:fire_cube", {
|
||||
mesh = "mobs_fire_cube.x",
|
||||
textures = {"mobs_fire_cube.png",},
|
||||
lvl = 5,
|
||||
hits = 6,
|
||||
dmg = {
|
||||
full_punch_interval = 0.9,
|
||||
max_drop_level = 0,
|
||||
groupcaps = {
|
||||
},
|
||||
damage_groups = {friendly=4},
|
||||
},
|
||||
collisionbox = {-1, -1, -1, 1, 1, 1},
|
||||
description = "Fire Cube",
|
||||
range = 5,
|
||||
animations = {
|
||||
walk = {x=0, y=30},
|
||||
punch = {x=35, y = 60}
|
||||
},
|
||||
})
|
||||
|
||||
mobs.register_mob("mobs:water_cube", {
|
||||
mesh = "mobs_fire_cube.x",
|
||||
textures = {"mobs_water_cube.png",},
|
||||
lvl = 10,
|
||||
hits = 6,
|
||||
dmg = {
|
||||
full_punch_interval = 0.9,
|
||||
max_drop_level = 0,
|
||||
groupcaps = {
|
||||
},
|
||||
damage_groups = {friendly=5},
|
||||
},
|
||||
collisionbox = {-1, -1, -1, 1, 1, 1},
|
||||
description = "Water Cube",
|
||||
range = 5,
|
||||
animations = {
|
||||
walk = {x=0, y=30},
|
||||
punch = {x=35, y = 60}
|
||||
},
|
||||
})
|
||||
|
1142
mods/mobs/models/mobs_fire_cube.x
Normal file
1142
mods/mobs/models/mobs_fire_cube.x
Normal file
File diff suppressed because it is too large
Load Diff
BIN
mods/mobs/textures/mobs_fire_cube.png
Normal file
BIN
mods/mobs/textures/mobs_fire_cube.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
BIN
mods/mobs/textures/mobs_water_cube.png
Normal file
BIN
mods/mobs/textures/mobs_water_cube.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
@ -372,7 +372,10 @@ minetest.register_entity("story:human", {
|
||||
end,
|
||||
|
||||
on_step = function(self, dtime)
|
||||
-- nothing
|
||||
self.object:setvelocity({x=0, y=-9.2, z=0})
|
||||
if math.random(50) == 15 then
|
||||
self.object:setyaw(math.random(10))
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user