everamzah wrote:The original furnace does not use a node timer, so why should Dragonop's claycrafter? I'd like to also point out that in minetest_game there are only two nodes which use node timers: Bones, and TNT. In my experience they are not always reliable.
Merlin wrote:Hi,
I would like to add more animations to the animation table of PilzAdam's Simple Mobs (like the walk and stand animations).
I looked into the code of the API, but as it is not commented I have difficulties understanding what's going on.
Can anyone explain to me how I would go about adding new animations?
elseif type == "pick" and self.animation.current ~= "pick" then
if
self.animation.pick_start
and self.animation.pick_end
and self.animation.speed_normal
then
self.object:set_animation(
{x=self.animation.pick_start,y=self.animation.pick_end},
self.animation.speed_normal, 0
)
self.animation.current = "pick"
end
if self.state == "stand" then
if math.random(1, 4) == 1 then
self.object:setyaw(self.object:getyaw()+((math.random(0,360)-180)/180*math.pi))
end
self.set_velocity(self, 0)
self.set_animation(self, "stand")
if math.random(1, 100) <= 50 then
self.set_velocity(self, self.walk_velocity)
self.state = "walk"
self.set_animation(self, "walk")
elseif math.random(1, 100) >= 60 then
self.set_velocity(self, 0)
self.state = "pick"
self.set_animation(self, "pick")
end
elseif self.state == "pick" then
if math.random(1, 100) <= 30 then
self.object:setyaw(self.object:getyaw()+((math.random(0,360)-180)/180*math.pi))
end
self:set_animation("pick")
self.set_velocity(self, 0)
if math.random(1, 100) >= 10 then
self.set_velocity(self, 0)
self.state = "stand"
self:set_animation("stand")
end
animation = {
speed_normal = 15,
stand_start = 0,
stand_end = 33,
walk_start = 50,
walk_end = 62,
pick_start = 34,
pick_end = 42,
}
minetest.setting_set("name", "value")
waypoint = {
hud_elem_type = "waypoint",
name = "My pos",
number = "0x000000",
world_pos = {x=0,y=0,z=0}
}
player:hud_add(waypoint)
...
player:hud_remove(waypoint)
BrunoMine wrote:About method:Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
minetest.setting_set("name", "value")
He did not keep the values set after a server shutdown.
What the correct way to remove an element HUD?Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
waypoint = {
hud_elem_type = "waypoint",
name = "My pos",
number = "0x000000",
world_pos = {x=0,y=0,z=0}
}
player:hud_add(waypoint)
...
player:hud_remove(waypoint)
The above example does not remove the HUD of the waypoint.
Another question: how to know the id of an element of HUD?
local id = player:hud_add(hud_def)
...
player:hud_remove(id)
hit_node = function(self, pos, node)
local num = math.random(1, 10)
if num == 1 then
pos.y = pos.y + 1
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
local mob = minetest.add_entity(pos, "mobs:chicken")
local ent2 = mob:get_luaentity()
mob:set_properties({
textures = ent2.child_texture[1],
visual_size = {
x = ent2.base_size.x / 2,
y = ent2.base_size.y / 2
},
collisionbox = {
ent2.base_colbox[1] / 2,
ent2.base_colbox[2] / 2,
ent2.base_colbox[3] / 2,
ent2.base_colbox[4] / 2,
ent2.base_colbox[5] / 2,
ent2.base_colbox[6] / 2
},
})
ent2.child = true
ent2.tamed = true
ent2.owner = self.playername
end
minetest.setting_set("name", "value")
TenPlus1 wrote:using /set -n <name> <value> does the same sadly, would be handy to have a -f in there to FORCE the setting and save to minetest.conf
minetest.register_decoration({
deco_type = "simple",
decoration = "huntandgather:rock",
place_on = {
"default:stone",
},
y_min = -32000,
y_max = 32000
})
minetest.register_decoration({
deco_type = "simple",
decoration = "default:stick",
place_on = {
"default:dirt",
"default:dirt_with_grass",
"default:dirt_with_grass_footsteps",
"default:dirt_with_dry_grass",
"default:dirt_with_snow",
},
biomes = {
"coniferous_forest",
"deciduous_forest",
"rainforest",
"rainforest_swamp",
"savanna",
"taiga"
}
})
minetest.register_on_generated(function(minp, maxp)
-- place stones between -30 and -3000
if minp.y > -30 or maxp.y < -3000 then
return
end
-- place them on top of coal blocks
local coal = minetest.find_nodes_in_area_under_air(minp, maxp, "default:stone_with_coal")
local bpos
for n = 1, #coal do
bpos = {x = coal[n].x, y = coal[n].y + 1, z = coal[n].z }
-- not on all coal blocks, only 1 in every 8
if math.random(1, 8) == 1 then
minetest.set_node(bpos, {name = "yourmod:stone"})
end
end
end)
drkwv wrote:How to know if ALT is pressed by the player?
Users browsing this forum: No registered users and 39 guests