[Mod] Mana [1.2.0] [mana]

User avatar
Wuzzy
Member
 
Posts: 2161
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

[Mod] Mana [1.2.0] [mana]

by Wuzzy » Thu Feb 05, 2015 15:31

This mod provides a simple API for mana. And some simple HUD elements. This mod does not provide any actual gameplay on its own.

Mana is intended to be a secondary player attribute. In many RPGs mana is used as a resource for magical items or spells. Each time you use one of those, this reduces your mana reserves until you hit 0 eventually, at which point you cannot use these magical items anymore; you have to recharge your mana level somehow then.
In Minetest, it could be used for all kinds of special items and tools and what else you may think of.
Mana could also be used as a lazy measure to limit the uses of special items without destroying them, so the items do not neccessarily have to be magical.
That's the basic idea behind mana.

By default, all players start with 0/200 mana, and will regenerate 1 mana each fifth of a second. Note that the regeneration rate is the same for all players and can only be changed globally.
The values can be changed on a per-player basis with an API, the mod also recognizes a few server settings.

Here is a screenshot showing a HUD bar for the mana, using the optional dependency on HUD bars mod:
Image

Current API features:
  • Add and subtract mana from a player
  • Set/get the current and maximum mana of a player
  • Set/get the amount of mana regeneration of a player

Also, this mod is configurable with server settings (minetest.conf):
  • mana_default_max: Initial maximum mana for new players (default: 200)
  • mana_default_regen: The initial amount of mana a new player will generate (default: 1)
  • mana_regen_timer: Time in seconds all (!) players will generate mana (default: 0.2)

And that's basically it for now. The functions make sure the mana will never go out of bound, so the current mana is not allowed to be smaller than 0 or larger than the player's maximum.
Also, the maximum must not be smaller than 0 as well.

Version: 1.2.0 (This mod uses semantic versioning, as of 2.0.0 of the standard)
License of mana icon: CC-BY 3.0 by Buch.
License of everything else: WTFPL
Project page (Git): http://repo.or.cz/w/minetest_mana.git

Optional dependencies:

No mandatory dependencies.

Mods using this mod:
Attachments
mana1.2.0.zip
(12.87 KiB) Downloaded 153 times
screenshot_1449056383.png
screenshot_1449056383.png (23.06 KiB) Viewed 1065 times
Last edited by Wuzzy on Sat Nov 12, 2016 19:38, edited 15 times in total.
 

User avatar
Minetestforfun
Member
 
Posts: 936
Joined: Tue Aug 05, 2014 14:09
GitHub: Darcidride
IRC: Darcidride + MinetestForFun
In-game: Darcidride + MinetestForFun

Re: [Mod] Mana [0.1.0] [mana]

by Minetestforfun » Thu Feb 05, 2015 16:26

Wow, very good idea and work, i hope it will be used on many mods, thank you ! :)
 

User avatar
TG-MyinaWD
Member
 
Posts: 355
Joined: Thu May 08, 2014 21:22
GitHub: Maddie-Myina
IRC: Maddie-Myina
In-game: .

Re: [Mod] Mana [0.1.0] [mana]

by TG-MyinaWD » Thu Feb 05, 2015 16:29

Sounds cool. I hope I can find a great use for it in my mods. I might can make it need mana to craft something. if can export it from players and use in crafting.

I will look into can do. but looks great so far.
I'm a Transgender no shame about it.
I prefer to be considered as a "Girl/Lady/Miss/Madam/Female" for now on.
 

User avatar
Krock
Member
 
Posts: 3598
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker

Re: [Mod] Mana [0.1.0] [mana]

by Krock » Fri Feb 06, 2015 09:56

I hope there will be mods using Mana. It has potential for a new type of gameplay!

EDIT: I would like to see your mods on GitHub :)
Newest Win32 builds - Find a mod - All my mods
ALL YOUR DONATION ARE BELONG TO PARAMAT (Please support him and Minetest)
New DuckDuckGo !bang: !mtmod <keyword here>
 

User avatar
Wuzzy
Member
 
Posts: 2161
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

Release 0.2.0

by Wuzzy » Sun Feb 08, 2015 03:35

I just released version 0.2.0 of this mod!

I have added the API documentation, and it is surprisingly short. It really just boils down to setter and getter functions, and addition and subtraction.
I have tweaked the adder and subtractor functions a bit. Now you can decide whether you allow “excess” amount (over the maximum or below 0) or if you want to abort the whole operation if a limit would be exceeded.

I.e. if player X has 40/50 mana and you want to add 20, you can either call mana.add, in which call the addition will fail and no mana will be added, or you can call mana.add_up_to, in which case 10 mana will be added (capped at 50), plus the function reports how much excess mana you had (in this case 10, obviously).
It is similar for subtraction.
I hope this little tweak makes using the API a bit more flexible to use.

*Probably* there is not much else in the way for a 1.0.0 release already, if you have ideas for new functions, please let me know. I will probably add the one or other convenience function.
But I want to have at least one real world example before I release 1.0.0, to be sure everything works fine.

@Krock:
I will not put this on GitHub, but I will put this on repo.or.cz whenever I feel like it, but certainly at the release of 1.0.0.

In the meanwhile, the Zip archive also contains the .git folder and thus the entire Git repository. ;-)

I now use Git for most of my mods and upload them to repo.or.cz, but I don't use Git at all for very simple mods like Galaxy Skybox.
 

User avatar
TenPlus1
Member
 
Posts: 1874
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: [Mod] Mana [0.2.0] [mana]

by TenPlus1 » Sun Feb 08, 2015 09:50

Great concept... Killing mobs could drop mana items, or even using special weapons or staffs could use mana to operate... so much potantial...
 

User avatar
Wuzzy
Member
 
Posts: 2161
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

Version 0.3.0 released!

by Wuzzy » Tue Feb 10, 2015 01:54

Version 0.3.0 released!

This version has been made for compability with the HUD bars mod 0.3.0. It is currently only compatible with this version, unless you decide to not install and activate HUD bars.
That's all, bye!

Edit: Version 0.4.0 of the HUD bars mod has been released. Mana 0.3.0 is also compatible with 0.4.0 of the HUD bars mod now.

Edit: Same for 1.0.0.
 

User avatar
Wuzzy
Member
 
Posts: 2161
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

Version 0.4.0 released!

by Wuzzy » Sat Feb 14, 2015 06:26

Version 0.4.0 is released!
This version works with major version 1 of the HUD bars mod. Versions 0.3.0 and 0.4.0 are probably OK, too, but not supported.

Changelog:
  • Mana now is regenerated by players
  • By default, new players start with 0/200 mana and will regenerate 1 mana each fifth of a second
  • The mod recognizes now three minetest.conf settings / server settings, for configuring regeneration rate, default regeneration amount for new players and max. mana for new players
  • New API functions for regeneration: mana.getregen and mana.setregen

Regeneration can be easily disabled by setting the regeneration amount to 0. I added the support for minetest.conf settings mainly for subgame developers and server operators. This way, you have to change not a single file within the mana mod, only your minetest.conf to configure this mod. :-)

See also the first post, it is a bit more detailed on that. The README.txt file is the most detailed info.

I also uploaded the Git repository here:
http://repo.or.cz/w/minetest_mana.git

I also have decided which direction this mod will go: I will stay with mana only, so the aim is now not a generic mod to add generic attributes, etc.

Edit: I have released the first mod using the Mana mod: Mirror of Returning
 

User avatar
Wuzzy
Member
 
Posts: 2161
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

Version 1.0.0 released!

by Wuzzy » Fri Feb 20, 2015 14:56

Version 1.0.0 is released today!

I consider the API finished and stable, it should now be safe to use by other mods.

Changelog:
  • All input values will first be rounded before they are used. This ensures the mana mod only stores integer numbers for mana, so you can't have 2.342 mana, etc.
  • Add brief “general recommendations” section into API.md
  • A bit of refactoring

The following mods are currently using this mod and are compatible with major version 1 of this mana mod:

Have fun!
 

User avatar
philipbenr
Member
 
Posts: 1665
Joined: Fri Jun 14, 2013 01:56
GitHub: philipbenr
IRC: philipbenr
In-game: WisdomFire or philipbenr

Re: [Mod] Mana [1.0.0] [mana]

by philipbenr » Sat Feb 21, 2015 03:26

Looks good Wuzzy.
 

User avatar
Wuzzy
Member
 
Posts: 2161
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

Re: [Mod] Mana [1.0.1] [mana]

by Wuzzy » Sun Feb 22, 2015 17:26

Quick bugfix release 1.0.1:

The mana regeneration did not work well on slow servers, it was far slower than it should be. Now the mana regeneration is more stable so that it even works properly on slow servers, but the granularity of mana updates is still increased on slow servers.
If you have a slow server, consider increasing the mana tick (and, if desired, scale the default mana regeneration amount inversely proportional).
 

User avatar
Wuzzy
Member
 
Posts: 2161
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

1.0.2

by Wuzzy » Wed Apr 01, 2015 07:40

New version 1.0.2 released.

This fixes the following bugs found by Jordach (thanks!):
  • The server crashed when a player left on a multiplayer server and HUD Bars mod was active, too
  • The player's mana values were reset to the default values when a player rejoined on a server
 

User avatar
Don
Member
 
Posts: 1641
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: [Mod] Mana [1.0.2] [mana]

by Don » Wed Apr 01, 2015 14:35

Just a thought. What about a mana container or bottle that can store mana. That way people can go collect mana and store it. Then if their mana is low they can refill it similar to eating.
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here
 

User avatar
Ben
Member
 
Posts: 157
Joined: Tue Mar 31, 2015 20:09

Re: [Mod] Mana [1.0.2] [mana]

by Ben » Wed Apr 01, 2015 20:45

Nice mod! My first thought was "hey, what if mana regeneration only worked in sunlight?" This would add some importance to the time of day, and make spelunking more of a challenge.

Since the regen value is settable by player, one could easily write another mod that takes care of the regeneration rate. In fact, I think I'll try my hand at it myself ;-)

Two questions about some design decisions, though:

First, all values are stored and calculated as integers. What prompted this? I think you lose a lot of tunability and precision that way. You could always round the values just before output (HUD bars / text), if that was the reason.

Second, I see that negative regen values are not allowed. One idea would be to have biomes / blocks / mobs with a "mana sapping" effect, by setting a negative value.
 

User avatar
Minetestforfun
Member
 
Posts: 936
Joined: Tue Aug 05, 2014 14:09
GitHub: Darcidride
IRC: Darcidride + MinetestForFun
In-game: Darcidride + MinetestForFun

Re: [Mod] Mana [1.0.2] [mana]

by Minetestforfun » Thu Apr 02, 2015 22:45

Hi,

Because of your versionning system based on repo.or.cz, I post this here.

It's a modified and "improved" version of your mod, contains :
- Some crashfixs
- Add hud compatibility / support (with many different textures for potions, you can see alternative textures and xcf with calcs potions in the second folder)
- be carful, in our modified version, every 10 seconds the mana is increased by 10
- be carful, we don't have yet merged your latest improve wich save the mana if deconnection/reconnection
- Add a sound for the returnmirror teleportation (but we need to improve it...)
- One potion = 20 mana, they are 10 potions, so 10*20 = 200, and avery ten second, one half potion is filled

That's all, i think, Great mod Wuzzy, i hope it will help you :)

PS : license WTFPL for all
Attachments
Mana-MinetestForFun.7z
Mana mod modified for MinetestForFun
(32.19 KiB) Downloaded 71 times
 

User avatar
Wuzzy
Member
 
Posts: 2161
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

Re: [Mod] Mana [1.0.2] [mana]

by Wuzzy » Fri Apr 03, 2015 17:11

@Minetestforfun: First of all, my versioning is not based on repo.or.cz. My versioning system is Semantig Versioning 2.0.0, documented at http://www.semver.org.
Also, if you want to fork this mod, remember that the versioning of the new mod is now independent from the other mod. You could continue to use Semantic Versioning in that fork, but you could also choose to abandon Semantic Versioning for another versioning system for whatever reason.

You already changed a lot.

I do not want to apply these changes into this mod all at once. If you want to contribute, fork my repository and use Git and publish the repository somewhere (it does not matter much where). Alternatively, you could send me a patch file (if you know what this is).
I want to have a clean Git history. I don't want to have a super-commit like “Some random changes from Minetestforfun, I don't know exactly what has changes”. ;-)
My rule of thumb is: One change per commit.

Also, I will not add mana potions into this mod because I want to keep this mostly an API mod. However, I think it would be perfectly possible to implement mana potions in a seperate mod. I am to lazy to do it myselves, so you are on your own.

As for the crash fixes: Please tell me of which crashes you are talking about (in other words: report the bug). If you have a fix, that's great, but please post one patch/commit per bugfix.

I don't know what you mean with “sound for returnmirror teleportation”. It already has a sound, so what's the point? This is also off-topic, why don't you post in the returnmirror thread?
 

User avatar
Ben
Member
 
Posts: 157
Joined: Tue Mar 31, 2015 20:09

Re: [Mod] Mana [1.0.2] [mana]

by Ben » Sat Apr 04, 2015 20:19

Ben wrote:Since the regen value is settable by player, one could easily write another mod that takes care of the regeneration rate. In fact, I think I'll try my hand at it myself ;-)


And I just did: Solar Mana. I wouldn't count it as a mod that "uses the mana mod", though :-P
 

TeTpaAka
Member
 
Posts: 131
Joined: Sat Dec 28, 2013 21:54

Re: [Mod] Mana [1.0.2] [mana]

by TeTpaAka » Thu Apr 30, 2015 21:00

I just noticed that your fall back functions don't work properly. Instead of updating the displayed text, you update "number", which is the colour for a text HUD. So, instead of slowly increasing numbers, the colour of the HUD string changes.
 

User avatar
Wuzzy
Member
 
Posts: 2161
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

Re: [Mod] Mana [1.1.0] [mana]

by Wuzzy » Mon May 25, 2015 21:08

I have released Mana version 1.1.0!

Changelog:
  • Regeneration can be negative now. This means, players lose mana over time.
  • Regeneration can also be a floating-point number. A number between 0 and 1 simply means that it takes longer than 1 mana tick (default: 0.2 s) to regenerate 1 mana. For instance, if mana regeneration is 0.5, it takes 2 mana ticks to regenerate 1 mana. (Note: The player's mana values are still strictly whole numbers, it is only the regeneration which has changed).
  • Update for the new HUD bars version 1.2.0 or later: Statbar background image added. This is only interesting if you use HUD bars with the “modern statbars” style. Otherwise, this has no effect.
  • I finally fixed the fallback text bug reported by TeTpaAka.
 

User avatar
Wuzzy
Member
 
Posts: 2161
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

Version 1.2.0

by Wuzzy » Sat Nov 12, 2016 19:40

I have release Mana version 1.2.0. This is a rather small update only.

Changelog:
  • Add intllib support
  • Add German translation
  • Update/fix readme file
  • Clean up / refactor code (undeclared globals, etc.)
I'm creating MineClone 2, a Minecraft clone for Minetest.
I made the Help modpack, adding in-game help to Minetest.
 


Return to Mod Releases

Who is online

Users browsing this forum: No registered users and 7 guests

cron