Hi azekill,
Following TenPlus1's post, yes indeed, there is an HP. Check the documentation for LuaEntitySAO. I should have too, before replying so fast :-P
http://dev.minetest.net/LuaEntitySAOYou call register_entity with the name of the entity, then a table with the default values you want your entity to have.
I will confess that I am by no means an expert on this - just I have been picking at TenPlus1's mobs_redo so as to determine how to modify mob behaviour at load-time for my game, without changing his code.... so..... take my advice with my basic level knowledge in mind :-P
Still, if you thought that Minetest engine had some built-in system for mobs so that you could make something even simpler than
mobs_redo or
mobf, well... go talk to the core dev team to ask them for an engine-level API :-)
There is a lot of work to be done here, and I think that rather than building a new mob framework, you should probably fork an existing mob engine and remove things that you think are surplus to a basic mob engine.
Bearing in mind the goal of MILA to be lightweight, I expect the following things need to be taken into account at minimum, and at most:
Prototype:
Default data:
* A default routine to move towards a target position
* A default routine to seek for players
* A default attack routine
* A default runaway routine
* A default routine to handle being punched
* A default state = "idle"
Instances:
* Current state -- whether the mob is walking, running, or attacking, or merely idle
Mod-provided data:
* behaviour = one of {"hostile","friendly"}
* Mesh -- the meshfile to use
* Texture -- texture to use on the mesh
* animation keyframe indices, with animation speeds
* A right-click callback routine
Calling the library -- I suggest the following be a reference example:
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
mila:register_mob("modpack:mobname",
{
mesh = "meshname.x",
textures = {"texture_1.png","texture_2.png"},
hp_max = 30,
animations = {
walk = {start=0,end=20,speed=10},
run = {start=0,end=20,speed=20},
attack = {start=21,end=30,speed=5},
idle = {start=31,end=35,speed = 5}
},
behaviour = "friendly",
})
mila:register_egg("modpack:mobname",{
inventory_image = "texture.png"
})
mila:register_spawn("modpack:mobname",{
min_alt = -100,
max_alt = 31000,
spawn_on = "default:dirt_with_grass",
spawn_by = {"default:tree","default:water_source","group:flowers"},
})
The key areas that MILA would have to manage then will be:
* locating targets
* moving the mob
* animating the mob
* handling the activity state
* spawning mobs to populate the world
* spawning from egg placement
* removing mobs to prevent overpopulation
This should be all that is necessary for a MILA mob. Many fancy things such as spawn time and conditions, environment damage, flight, eating, reproduction etc are absent from this, to keep it light.
Any thoughts? Anything I missed? Should an effort for a lightweight framework be its own project or a pared-down fork of something else?
You're going to need a good reason to be making a new mob engine from scratch when we already have a couple of good, well-featured ones ;-)