My rough draft of this

Well here ya go
master
Chinchow 2012-11-04 00:39:23 -07:00
parent ceafd006b5
commit 7e4b332b42
1 changed files with 21 additions and 21 deletions

View File

@ -1,32 +1,32 @@
SLIME_SIZE = 0.5
SLIME_SIZE = 25.0
SLIME_BOX = math.sqrt(2*math.pow(SLIME_SIZE, 2))/2
GRAVITY = 9.8
GRAVITY = 12.0
minetest.register_entity("slimes:small",{
minetest.register_entity("slimes:humongous",{
initial_properties = {
hp_max = 4,
hp_max = 70,
visual_size = {x = SLIME_SIZE, y = SLIME_SIZE, z = SLIME_SIZE},
visual = "cube",
textures = {
"slime_top.png",
"slime_bottom.png",
"slime_front.png",
"slime_sides.png",
"slime_sides.png",
"slime_sides.png",
"big_slime_top.png",
"big_slime_bottom.png",
"big_slime_front.png",
"big_slime_sides.png",
"big_slime_sides.png",
"big_slime_sides.png",
},
collisionbox = {-SLIME_BOX, -SLIME_SIZE/2, -SLIME_BOX, SLIME_BOX, SLIME_SIZE/2, SLIME_BOX},
physical = true,
},
timer = 6,
timer2 = 1,
timer3 = 0, --regularly check if slime touches ground and possibly set x/z velocity/acceleration to 0
timer = 12,
timer2 = 3,
timer3 = 1, --regularly check if slime touches ground and possibly set x/z velocity/acceleration to 0
yaw = 0,
direction = {},
status = 2, --1 = jump, 2 = rotate
attracts_slime = true,
found_friend = false,
found_friend = true,
on_activate = function(self)
self.object:setacceleration({x = 0, y = -GRAVITY, z = 0})
@ -34,7 +34,7 @@ minetest.register_entity("slimes:small",{
on_punch = function(self)
if self.object:get_hp() <= 0 then
minetest.env:add_item(self.object:getpos(), "mesecons_materials:glue 4")
minetest.env:add_item(self.object:getpos(), "slimes:small") --not sure if that would work?--
self.object:remove()
end
end,
@ -46,7 +46,7 @@ minetest.register_entity("slimes:small",{
self.status = 1
local pos = self.object:getpos()
if slime_lonely(pos) and not minetest.env:find_node_near(pos, 16, "default:mese") then
if slime_lonely(pos) and minetest.env:find_node_near(pos, 16, "default:mese") then
self.object:remove()
end
self.yaw = slime_getyaw(pos)
@ -111,7 +111,7 @@ end
function slime_getyaw (pos) -- get yaw, only if objects to follow nearby
objs = minetest.env:get_objects_inside_radius(pos, 7)
for i, obj in ipairs(objs) do
if obj:is_player() or obj:get_luaentity().name == "slimes:small" then
if obj:is_player() or obj:get_luaentity().name == "slimes:humongous" then
local ppos = {x = obj:getpos().x - pos.x,
z = obj:getpos().z - pos.z}
if ppos.x ~= 0 and ppos.z ~= 0 then --found itself as an object
@ -125,10 +125,10 @@ function slime_getyaw (pos) -- get yaw, only if objects to follow nearby
end
minetest.register_abm({
nodenames = {"default:leaves"},
interval = 10.0,
chance = 100000,
nodenames = {"default:cobble"},
interval = 15.0,
chance = 100000000,
action = function(pos, node)
minetest.env:add_entity({x=pos.x, y=pos.y + 1, z=pos.z}, "slimes:small")
minetest.env:add_entity({x=pos.x, y=pos.y + 1, z=pos.z}, "slimes:humongous")
end,
})