[Mod] physicsh [physicsh]

Post Reply
rdococ
New member
Posts: 8
Joined: Sat Feb 04, 2017 18:47
GitHub: rdococ
IRC: rdococ
In-game: rdococ

[Mod] physicsh [physicsh]

by rdococ » Post

This mod adds an API that allows other mods to systematically add multiple modifiers at once to a player's physics without overriding other modifiers. Simply depend/opt-depend on physicsh, use the API, and you're good to go.

physicsh on GitHub

The mod adds four functions which can be accessed in the global physicsh table.

player can either be the PlayerRef itself or the player name for the sake of convenience. values can either be nil to remove a modifier, or a table containing speed, jump and/or gravity values.
  • physicsh.set_multiplier(player, id, values): Sets the multiplication modifier named id to values.
  • physicsh.set_adder(player, id, values): Sets the addition modifier named id to values.
  • physicsh.get_multiplier(player, id): Gets the multiplication modifier named id.
  • physicsh.get_adder(player, id): Gets the addition modifier named id.
Multipliers are applied before adders, so if you wear 2x speed boots and +1 speed thrusters then your speed will be 1*2+1 = 3, rather than (1+1)*2 = 4. For this example at least this makes sense; boots that help you to walk faster should have no effect on thrusters that do not use your legs to propel you.

This API may change any time - and indeed, the information above may not be accurate to the latest version of physicsh - but if enough mods come to depend on it then I will ensure that I don't break backwards compatibility.

TenPlus1 also made a mod which you should check out: pova on GitHub. They do basically the same thing but go about it in different ways.
Last edited by rdococ on Thu Apr 19, 2018 08:40, edited 1 time in total.

User avatar
TenPlus1
Member
Posts: 3715
Joined: Mon Jul 29, 2013 13:38
In-game: TenPlus1
Contact:

Re: [Mod] physicsh [physicsh]

by TenPlus1 » Post

Nice, love the way we've done the same task but in different ways :) Gonna play with your mod and see how 3d_armor, playerplus and potions handles it :P

https://github.com/tenplus1/pova

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

Re: [Mod] physicsh [physicsh]

by Byakuren » Post

My player_monoids existed before either of these did.
EDIt: Link: https://github.com/minetest-mods/player_monoids
Last edited by Byakuren on Thu Apr 19, 2018 22:58, edited 1 time in total.
Every time a mod API is left undocumented, a koala dies.

User avatar
TenPlus1
Member
Posts: 3715
Joined: Mon Jul 29, 2013 13:38
In-game: TenPlus1
Contact:

Re: [Mod] physicsh [physicsh]

by TenPlus1 » Post

byakuren: monoids is indeed a good mod but can be easily reset by a rogue mod... What rdococ and myself are trying to do is create a BASE mod which can maybe be added to game someday that mods like monoids and armor and potions can use to apply effects safely.

rdococ
New member
Posts: 8
Joined: Sat Feb 04, 2017 18:47
GitHub: rdococ
IRC: rdococ
In-game: rdococ

Re: [Mod] physicsh [physicsh]

by rdococ » Post

TenPlus1 wrote:byakuren: monoids is indeed a good mod but can be easily reset by a rogue mod... What rdococ and myself are trying to do is create a BASE mod which can maybe be added to game someday that mods like monoids and armor and potions can use to apply effects safely.
player_monoids seems to have much more functionality than either of our mods, though. You can specify exactly how you want effects to combine with it.

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

Re: [Mod] physicsh [physicsh]

by Byakuren » Post

TenPlus1 wrote:byakuren: monoids is indeed a good mod but can be easily reset by a rogue mod... What rdococ and myself are trying to do is create a BASE mod which can maybe be added to game someday that mods like monoids and armor and potions can use to apply effects safely.
Not sure why your mods are more qualified than mine for inclusion into Minetest Game, or why they are less vulnerable to being interfered with set_physics_override-using mods (Maybe you didn't see that my mod includes monoids already for physics properties). The response to this issue (https://github.com/minetest/minetest_game/issues/1909) says that no mod would be qualified for inclusion anyway (an engine implementation is desired).
Every time a mod API is left undocumented, a koala dies.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests