[mod][api][github]M.I.L.A. 1.3[mila]

User avatar
azekill_DIABLO
Member
Posts: 7507
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

Re: [mod][api][github]M.I.L.A. 1.3[mila]

by azekill_DIABLO » Post

Stix wrote:I thought this might help?: https://github.com/PilzAdam/mobs/wiki/API
It was already one of my references. BTW, I think I know how to implement halos, it will be simple.
*EDIT: i think it would be cool if you merged burlis pathfinder with this mod, it would make mobs more dangerous as they can find paths to you: viewtopic.php?f=9&t=17406
I tried to use the minetest built-in pathfinder it didn't gave anything cuz' I really suck at that. I'm not sure about this one.
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!

User avatar
csirolli
Member
Posts: 133
Joined: Mon Jan 15, 2018 21:46
GitHub: HeyITGuyFixIt
IRC: CSirolli
In-game: CSirolli
Location: Florida, USA
Contact:

Re: [mod][api][github]M.I.L.A. 1.3[mila]

by csirolli » Post

Are there any known mods that use this api?

User avatar
Stix
Member
Posts: 1385
Joined: Fri Aug 04, 2017 14:19
IRC: nil
In-game: Stix [+alts]
Location: USA

Re: [mod][api][github]M.I.L.A. 1.3[mila]

by Stix » Post

csirolli wrote:Are there any known mods that use this api?
This one does: viewtopic.php?f=9&t=18200
Hey, what can i say? I'm the bad guy.

User avatar
azekill_DIABLO
Member
Posts: 7507
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

Re: [mod][api][github]M.I.L.A. 1.3[mila]

by azekill_DIABLO » Post

^ What my friend said.
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!

User avatar
azekill_DIABLO
Member
Posts: 7507
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

Re: [mod][api][github]M.I.L.A. 1.3[mila]

by azekill_DIABLO » Post

M.I.L.A. upcoming functionnality : Auras
Image
Enjoy!
Attachments
auras showcase
auras showcase
screenshot_20180706_154928.jpeg (60.81 KiB) Viewed 730 times
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!

User avatar
Stix
Member
Posts: 1385
Joined: Fri Aug 04, 2017 14:19
IRC: nil
In-game: Stix [+alts]
Location: USA

Re: [mod][api][github]M.I.L.A. 1.3[mila]

by Stix » Post

azekill_DIABLO wrote:M.I.L.A. upcoming functionnality : Auras
Image
Enjoy!
Amazing, just what i always wanted <o/ !

Well that and animations.
Hey, what can i say? I'm the bad guy.

User avatar
Andrey01
Member
Posts: 2574
Joined: Wed Oct 19, 2016 15:18
GitHub: Andrey2470T
In-game: Andrey01
Location: Russia, Moscow

Re: [mod][api][github]M.I.L.A. 1.3[mila]

by Andrey01 » Post

azekill_DIABLO, can you please add a chance mobs to turn their heads? For example, they would can turn the head if they have seen something and somebody. This would be very nice as this would be quite new feature in mobs mods!

User avatar
azekill_DIABLO
Member
Posts: 7507
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

Re: [mod][api][github]M.I.L.A. 1.3[mila]

by azekill_DIABLO » Post

I don't know how to use animations. And the models aren't capable of doing this. I'm as frustrated as you. But i'll see if I can do something.

@Stix: i'm glad you like them!
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!

User avatar
Stix
Member
Posts: 1385
Joined: Fri Aug 04, 2017 14:19
IRC: nil
In-game: Stix [+alts]
Location: USA

Re: [mod][api][github]M.I.L.A. 1.3[mila]

by Stix » Post

So hows progress on the new particles? :3
Also what about spawning and de-spawning particles...
Hey, what can i say? I'm the bad guy.

User avatar
Stix
Member
Posts: 1385
Joined: Fri Aug 04, 2017 14:19
IRC: nil
In-game: Stix [+alts]
Location: USA

Re: [mod][api][github]M.I.L.A. 1.3[mila]

by Stix » Post

Another user is making mobs that work with M.I.L.A.! viewtopic.php?f=9&p=325078#p325078
Hey, what can i say? I'm the bad guy.

User avatar
azekill_DIABLO
Member
Posts: 7507
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

Re: [mod][api][github]M.I.L.A. 1.3[mila]

by azekill_DIABLO » Post

Yay! I've checked it, it's a nice start!
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!

User avatar
Hamlet
Member
Posts: 766
Joined: Sat Jul 29, 2017 21:09
IRC: H4mlet
In-game: Hamlet
Location: Lombardy, Italy

Re: [mod][api][github]M.I.L.A. 1.3[mila]

by Hamlet » Post

I've tried to add animations' support to your API, eventually I've managed to make a working function. I've tried it with the wolves and it seems to work acceptably. \o/

First of all, to use an animation you must know which are its first and last frames. Quick method: fetch them from an existing mob's definition; Other method: open (import) the mob's model using Blender, at the window's bottom will be displayed a meter showing the animation frames, with markers named "walk start", "walk end", and alike - those markers will tell you the frame's number.

Secondarily, the animation function itself isn't very useful if the API does not specify when the function has to be called; e.g. you can call the function to load the "moving fast" animation when the mob is moving toward its targed, but it should also be called when the mob is standing still, or simply walking, or digging, etc.
Usage example: apply_animation(self, "moving")

Last but not least: this is my very first attempt to do such a thing, thus don't expect this code to be "bug-proof", elegant or performant; it's just a first step. :)

Now, the code.
The function must be added to your api.lua, while the animations definition must be added to the mob that you want to use it.

I'm releasing this code under the GPLv3 license, which basically means "credit me please, share alike (freely you have been given, freely you shall give), don't use it for closed source software (else your soul will be doomed to <insert unpleasant things here>)".

api.lua

Code: Select all

function apply_animation(self, action)
	if (self.animations ~= nil) then
	-- For backward compatibility: if the existing entities have been
	-- spawned without the "animations" specification in the entity
	-- definition, the game will not crash.
	-- If (self.animations == nil) then it will trigger line #78

		local animations_table = self.animations
		-- fetch the "animations" specification from the entity's definition

		local standing = animations_table["standing"]
		-- fetch the values for the "standing" animation
		-- i.e. the mob stands still

		local moving = animations_table["moving"]
		-- fetch the values for the "moving" animation
		-- i.e. the mob walks, swims or flies

		local moving_fast = animations_table["moving_fast"]
		-- fetch the values for the "moving_fast" animation
		-- same as the previous, but for running or similar

		local attacking = animations_table["attacking"]
		-- fetch the values for the "attacking" animation
		-- i.e. the mob bites, punches, digs, etc.

		if (action ~= nil) then
		-- When calling the function you must specify which action
		-- is being done, else the function will abort.
		-- It triggers line #80

			if (action == "standing") then
				self.object:set_animation(
					standing[1],
					-- i.e. {x = N1, y = N2}
					-- N1 = first animation's frame
					-- N2 = last animation's frame

					standing["frame_speed"],
					-- usually a number like 30, or 60, etc.

					standing["frame_blend"],
					-- a number, 0 to disable, I guess it makes animations smoother

					standing["frame_loop"]
					-- whether if the animation must be repeated when the last frame
					-- has been reached
				)

			elseif (action == "moving") then
				self.object:set_animation(
					moving[1],
					moving["frame_speed"],
					moving["frame_blend"],
					moving["frame_loop"]
				)

			elseif (action == "moving_fast") then
				self.object:set_animation(
					moving_fast[1],
					moving_fast["frame_speed"],
					moving_fast["frame_blend"],
					moving_fast["frame_loop"]
				)

			elseif (action == "attacking") then
				self.object:set_animation(
					attacking[1],
					attacking["frame_speed"],
					attacking["frame_blend"],
					attacking["frame_loop"]
				)

			else
				print("M.I.L.A " ..mila.version..": action \"" .. action ..
					"\" not supported or typed wrong.")
			end

		else
			print("M.I.L.A " ..mila.version..": action's value is nil.")
		end
	end
end
mob definition (frames' values are from the "Mobs Wolf" mob)

Code: Select all

animations = { -- ../minetest/doc/lua_api.txt at line 3278
	standing = { -- the mob stands still
		{x = 1, y = 60}, -- x: animation start, y: animation end
		frame_speed = 30, -- animation's speed
		frame_blend = 0, -- should make the animation smoother
		frame_loop = true -- if false then  the animation runs just once
	},

	moving = { -- the mob walks, swims or flies
		{x = 61, y = 120}, -- x: animation start, y: animation end
		frame_speed = 65, -- animation's speed
		frame_blend = 0, -- should make the animation smoother
		frame_loop = true -- if false then  the animation runs just once
	},

	moving_fast = { -- the mob runs, swims or flies faster
		{x = 61, y = 120}, -- x: animation start, y: animation end
		frame_speed = 70, -- animation's speed
		frame_blend = 0, -- should make the animation smoother
		frame_loop = true -- if false then  the animation runs just once
	},

	attacking = { -- the mob bites, punches, etc.
		{x = 1, y = 60}, -- x: animation start, y: animation end
		frame_speed = 60, -- animation's speed
		frame_blend = 0, -- should make the animation smoother
		frame_loop = true -- if false then  the animation runs just once
	},
}
EDIT--
Happy 14 July, froggy. ;)
My repositories: Codeberg.org | My ContentDB's page

User avatar
azekill_DIABLO
Member
Posts: 7507
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

Re: [mod][api][github]M.I.L.A. 1.3[mila]

by azekill_DIABLO » Post

Wow, you deserve a price of kindness ;D
I must admit one thing: I'll probably don't work on minetest anymore. So feel free to fork my mod and make it live.

I love frogs btw.
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!

User avatar
Hamlet
Member
Posts: 766
Joined: Sat Jul 29, 2017 21:09
IRC: H4mlet
In-game: Hamlet
Location: Lombardy, Italy

Re: [mod][api][github]M.I.L.A. 1.3[mila]

by Hamlet » Post

azekill_DIABLO wrote:I must admit one thing: I'll probably don't work on minetest anymore. So feel free to fork my mod and make it live.
Ah this is bad news, however if you decide so, then I wish you all the best for your current/future projects about real life and your other interests. :)

I will fork your mod and try my best to keep it alive.
My repositories: Codeberg.org | My ContentDB's page

User avatar
azekill_DIABLO
Member
Posts: 7507
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

Re: [mod][api][github]M.I.L.A. 1.3[mila]

by azekill_DIABLO » Post

Thank you so much. PM me if you need help, I'll still be here from time to time.
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!

User avatar
Hamlet
Member
Posts: 766
Joined: Sat Jul 29, 2017 21:09
IRC: H4mlet
In-game: Hamlet
Location: Lombardy, Italy

Re: [mod][api][github]M.I.L.A. 1.3[mila]

by Hamlet » Post

Hello azekillDIABLO,
during the past month I've been working on a mob API, and I've used M.I.L.A.'s source code to learn how to register a mob, register a mob spawner, etc.

M.I.L.A.'s license requires to release modified versions under the same license (LGPL v3.0), but I have chosen the European Union Public License v1.2 ("EUPL") for my code; basically it is GPL v3.0 compatible but it is legal in 23 languages (while the GPL is legal only in English).

Info site (license in 23 languages): https://joinup.ec.europa.eu/collection/ ... text-11-12
European Union's offical legal site: https://eur-lex.europa.eu/legal-content ... 32017D0863

So, given that my source code is based on your work (and contributors' work) I am asking you if I can change M.I.L.A.'s license from LGPL v3 to EUPL v1.2 - granted that this change would apply only to M.I.L.A. v.1.4 and later, not to v1.3 and earlier versions.
My repositories: Codeberg.org | My ContentDB's page

User avatar
azekill_DIABLO
Member
Posts: 7507
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

Re: [mod][api][github]M.I.L.A. 1.3[mila]

by azekill_DIABLO » Post

If you wish to change you can; But remember i'll probably be back one day. :D Thanks Hamlet.
Gone, but not dead. Contact me on discord: azekill_DIABLO#6565
DMs are always open if you want to get in touch!

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 15 guests