How to coordinate player physics modifications from mods

Post Reply
User avatar
joe7575
Member
Posts: 851
Joined: Mon Apr 24, 2017 20:38
GitHub: joe7575
In-game: JoSto wuffi
Location: Germany, in the deep south

How to coordinate player physics modifications from mods

by joe7575 » Post

I for myself made several mods, which change player privs, physics and the ability for free movement.
For example:
- the Towercrane mod gives a player fly privs but only in the construction area under the crane
- the Autobahn mod give a player fast privs but only when he moves on Autobahn nodes
- the Moonwalk mod gives the player low gravity but only in a dedicated area with a time limit

and so on.

If a player is in one mode and simultaneously tries to activate another mode, strange things can happen.
It will become more complicated if teleportation mods or chat commands are used, players die, and so on...

Any ideas how to solve this problem?

My first approaches:
- a player "semaphore" which synchronizes these temporary player modes (only one mod can lock the player)
- a stack for these attributes so that you can switch from one mode into another and back
- it should consider when a player leaves, respawns, dies, and so on
Last edited by joe7575 on Sat Sep 01, 2018 14:29, edited 1 time in total.
Sent from my Commodore 64. Some of my Mods: Tech Age, TechPack, Hyperloop, Tower Crane, Lumberjack, vm16, Minecart, Signs Bot.

User avatar
Krock
Developer
Posts: 4650
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

Re: How to coordinate player physics modifications from seve

by Krock » Post

- per-mod modifiers so that they can be registered and removed without side-effects -> controversial PR
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

User avatar
joe7575
Member
Posts: 851
Joined: Mon Apr 24, 2017 20:38
GitHub: joe7575
In-game: JoSto wuffi
Location: Germany, in the deep south

Re: How to coordinate player physics modifications from seve

by joe7575 » Post

Krock wrote:- per-mod modifiers so that they can be registered and removed without side-effects -> controversial PR
But this goes into another direction, more the question, if modifiers should be added or mutliplied.

What I mean is more: Is it allowed to modify any player attribute while the player is captured in another mod state?

For example: A player is sitting in a cart and while moving, tries to hit the button of a Towercrane or tries to activate any other mod, which manipulates player attributes.
Or the admin tries to teleport a player while this player is captured in one mod state.

For these scenaros it should be possibe to temporary lock the resource "player"

Code: Select all

take_player(name, id, prio)
release_player(name, id)

Or it should be possible to perform a safe hand-over from one state into the other.
And it should consider all other player state changes.
Sent from my Commodore 64. Some of my Mods: Tech Age, TechPack, Hyperloop, Tower Crane, Lumberjack, vm16, Minecart, Signs Bot.

User avatar
orwell
Member
Posts: 958
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

Re: How to coordinate player physics modifications from seve

by orwell » Post

There are several mods that handle such situations:
playereffects (Wuzzy)
player_monoids
LATE (in WIP stage viewtopic.php?f=9&t=20724)
and probably more

The problem is that all the mods you mentioned should use those API mods, which they simply don't do. Also, I don't know whether any of those mods support granting and revoking temporary privileges.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

User avatar
Pyrollo
Developer
Posts: 385
Joined: Mon Jan 08, 2018 15:14
GitHub: pyrollo
In-game: Naj
Location: Paris

Re: How to coordinate player physics modifications from seve

by Pyrollo » Post

Last weeks, sleepless nights and headaches, trying to find clever solutions to these questions while developping LATE.

Depending on their nature, some modifiers have to be added, some have to be multiplied, or what ever. The important thing is that combination of modifiers have to be associative. In other words, if you have several modifiers active at some point, the global modification should not depend on which order modifiers have been applied.

This limits operator combination. For example, you can't combine a +3 speed with a x2 speed.

That was the thought of the day.
[ Display Modpack ] - [ Digiterms ] - [ Crater MG ] - [ LATE ]

User avatar
Pyrollo
Developer
Posts: 385
Joined: Mon Jan 08, 2018 15:14
GitHub: pyrollo
In-game: Naj
Location: Paris

Re: How to coordinate player physics modifications from seve

by Pyrollo » Post

I forgot, in LATE I added a hacky mechanism that handles other mods modifications on player physics. This was actualy to ensure a good integration with 3D armor (speed, jump, weight modified by some armors).
[ Display Modpack ] - [ Digiterms ] - [ Crater MG ] - [ LATE ]

User avatar
orwell
Member
Posts: 958
Joined: Wed Jun 24, 2015 18:45
GitHub: orwell96
IRC: orwell96_mt
In-game: orwell
Location: Raxacoricofallapatorius

Re: How to coordinate player physics modifications from mods

by orwell » Post

Pyrollo: I've got an idea for you to keep associativity with e.g. +3 and x2 speed modifiers:
you just need to specify the order in which those transformations are applied
you can, for example, first add all multiplicative modifiers, and then all additive modifiers.
Lua is great!
List of my mods
I like singing. I like dancing. I like ... niyummm...

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

Re: How to coordinate player physics modifications from mods

by TenPlus1 » Post

We use POVA mod on server for player effects which is compatible with 3d_armor, playerplus, stamina and catcommands mods: https://notabug.org/tenplus1/pova

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

Re: How to coordinate player physics modifications from seve

by Byakuren » Post

orwell wrote:There are several mods that handle such situations:
playereffects (Wuzzy)
player_monoids
LATE (in WIP stage viewtopic.php?f=9&t=20724)
and probably more

The problem is that all the mods you mentioned should use those API mods, which they simply don't do. Also, I don't know whether any of those mods support granting and revoking temporary privileges.
player_monoids has the modder supply a function for applying the effect value to a player. Giving / removing the privilege can be part of that function.

EDIT: playereffects also has the modder supply custom functions, so you could do it there too.
Every time a mod API is left undocumented, a koala dies.

User avatar
Pyrollo
Developer
Posts: 385
Joined: Mon Jan 08, 2018 15:14
GitHub: pyrollo
In-game: Naj
Location: Paris

Re: How to coordinate player physics modifications from mods

by Pyrollo » Post

orwell wrote:Pyrollo: I've got an idea for you to keep associativity with e.g. +3 and x2 speed modifiers:
you just need to specify the order in which those transformations are applied
you can, for example, first add all multiplicative modifiers, and then all additive modifiers.
Yes, that's a good idea. But anyway, I can hardly find any good usecase of a +3 and x2 modifiers that can't be replaced by multipliers only. I can imagine a "max value" use case, for example, boots that makes x2 speed with a maximum speed of 3.
[ Display Modpack ] - [ Digiterms ] - [ Crater MG ] - [ LATE ]

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests