Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- minetest.register_entity("better_minetest_test:testentity",
- {
- hp_max = 100,
- physical = true,
- weight = 5,
- collisionbox = {-0.35,0.0,-0.35, 0.35,1.8,0.35},
- visual = "mesh",
- visual_size = {x=1, y=1},
- mesh = "better_minetest_creeper.obj",
- textures = {"better_minetest_creeper.png"},
- colors = {},
- is_visible = true,
- makes_footstep_sound = true,
- automatic_rotate = false,
- stepheight = 0,
- automatic_face_movement_dir = false,
- armor_groups = {immortal=1},
- animation = {
- --[[stand_START = 0,
- stand_END = 79,
- sit_START = 81,
- sit_END = 160,
- lay_START = 162,
- lay_END = 166,
- walk_START = 168,
- walk_END = 187,
- mine_START = 189,
- mine_END = 198,
- run_START = 221,
- run_END = 240,]]
- },
- --animation_speed = 12,
- decription = "Test NPC",
- show_nametag = true,
- inventory_image = "npcf_inv_top.png",
- nametag_color = "white",
- metadata = {
- free_roaming = "false",
- follow_players = "false",
- anim_stop = "Stand",
- },
- var = {
- speed = 1,
- avoid_dir = 1,
- last_pos = {x=0,y=0,z=0},
- target = nil,
- },
- --[[initial_properties {
- hp_max = 200,
- hp = 200
- },]]
- on_activate = function(self, data)
- --this is called when the entity is spawned, and loaded in!
- --the data, is the serialized data! deserialize before use
- print("activate?")
- end,
- on_step = function(self, dtime)
- end,
- on_punch = function(self, puncher, time_from_last_punch,
- tool_capibilities, dir)
- end,
- on_rightclick = function(self, clicker)
- --self.object:remove()
- print("setting bone position?!")
- self.object:set_bone_position("head", {x=math.random(1000), y=math.random(1000), z=math.random(1000)}, {x=math.random(1000), y=math.random(1000), z=math.random(1000)})
- print(tostring(self))
- for i, v in pairs(self) do
- print("self["..i.."] = ", v)
- end
- end,
- on_staticdata = function(self)
- print("static data?")--this is used to serialize the data! must return serialized string!
- end,
- on_step = function(self, dtime)
- --print("self: "..tostring(self))
- --print("self.object: "..tostring(self.object))
- end
- }
- )
- minetest.register_abm(
- {
- nodenames = {
- "testmod:decowood"
- },
- interval = 2,
- chance = 10,
- action = function(pos)
- pos.y = pos.y+1
- minetest.add_entity(pos, "better_minetest_test:testentity")
- end
- }
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement