[Mod] Monoidal Effects [0.1.0.0] [monoidal_effects]

Byakuren
Member
 
Posts: 814
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri
In-game: Raymoo + Clownpiece

[Mod] Monoidal Effects [0.1.0.0] [monoidal_effects]

by Byakuren » Sun Jan 24, 2016 18:06

Deprecated by player_monoids.

This is a framework for managing player status, similar to playereffects. There are some parts of player state, such as privileges, physics overrides, player object properties, etc. that could get clobbered if multiple mods try to change it independently. Monoidal Effects provides a way for these to be centrally-managed, and also for effects to work cumulatively.

Download:
0.1.0.0-dev

Source: https://github.com/minetest-mods/monoidal_effects
License: Apache 2.0 (No non-code assets)
Dependencies: None
API: https://github.com/minetest-mods/monoid ... er/API.txt

Differences from playereffects:
+ Spoiler


Mods that use it:
+ Spoiler
Last edited by Byakuren on Tue Jun 14, 2016 23:51, edited 1 time in total.
Every time a mod API is left undocumented, a koala dies.
 

Byakuren
Member
 
Posts: 814
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri
In-game: Raymoo + Clownpiece

Re: [Mod] Monoidal Effects [0.1.0.0] [monoidal_effects]

by Byakuren » Tue Feb 02, 2016 05:54

I've made my first release, since it seems stable enough.
Every time a mod API is left undocumented, a koala dies.
 

User avatar
SaKeL
Member
 
Posts: 651
Joined: Tue Apr 14, 2015 18:39
GitHub: JurajVajda
IRC: SaKeL
In-game: SaKeL

Re: [Mod] Monoidal Effects [0.1.0.0] [monoidal_effects]

by SaKeL » Fri Mar 11, 2016 07:10

Nice job. Will try it very soon on my server too ;) Thanks for sharing.
 

User avatar
SaKeL
Member
 
Posts: 651
Joined: Tue Apr 14, 2015 18:39
GitHub: JurajVajda
IRC: SaKeL
In-game: SaKeL

Re: [Mod] Monoidal Effects [0.1.0.0] [monoidal_effects]

by SaKeL » Fri Mar 11, 2016 20:51

How do i check if the effect was already applied to the player so it will not get applied again ?
Im trying to get my head around it and work with the sets
Code: Select all
monoidal_effects.get_player_effects(user:get_player_name()):effects()

but nothing is working (yet)... just trying to find the simple way how to apply an effect to the player only if it's not already active (so no multiple times)

Your help would be appreciated.
 

Byakuren
Member
 
Posts: 814
Joined: Tue Apr 14, 2015 01:59
GitHub: raymoo
IRC: Hijiri
In-game: Raymoo + Clownpiece

Re: [Mod] Monoidal Effects [0.1.0.0] [monoidal_effects]

by Byakuren » Fri Mar 11, 2016 23:51

SaKeL wrote:How do i check if the effect was already applied to the player so it will not get applied again ?
Im trying to get my head around it and work with the sets
Code: Select all
monoidal_effects.get_player_effects(user:get_player_name()):effects()

but nothing is working (yet)... just trying to find the simple way how to apply an effect to the player only if it's not already active (so no multiple times)

Your help would be appreciated.


get_player_effects returns a set (i.e. a table with { foo = true, bar = true} if foo and bar are in the set }, not an effectset. Effectsets are not part of the public API, the documentation is just there for use while developing the mod.

Unfortunately right now there is no simple way to determine if an effect is of a particular type. I'm not sure if I want to make more additions to monoidal_effects, since I am thinking of merging functionality into playereffects.

It might be possible that your use-case is covered by first canceling effects of that effect type, then reapplying them. That could be done like
Code: Select all
monoidal_effects.cancel_effect_type(eff_type, player_name)
monoidal_effects.apply_effect(eff_type, dur, player_name)
Every time a mod API is left undocumented, a koala dies.
 


Return to Mod Releases



Who is online

Users browsing this forum: No registered users and 6 guests