AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   New Plugin Submissions (https://forums.alliedmods.net/forumdisplay.php?f=26)
-   -   Conservation of Momentum fix 1.0.1 - Elevators fix (https://forums.alliedmods.net/showthread.php?t=250942)

Kidev 11-02-2014 10:48

Conservation of Momentum fix 1.0.1 - Elevators fix
 
1 Attachment(s)
Conservation of Momentum Fix - v1.0.1 by Kidev
A simple physic fix


Description:

Tired of getting fall damage because you jumped in an elevator? In real life, jumping in an elevator moving down or up at a constant speed will be the same as if you jumped on the floor. But in Gold Src games, it's bugged. This plugin simply fixes it.


Note:

- In some Gold Src games (like Opposing Force, in the monorail for exemple), jumping while you're in an entity moving forward will push you back. To fix this, simply replace in the source code
PHP Code:

new const giAxis] = { 00}; 

by
PHP Code:

new const giAxis] = { 11}; 

Known bugs:

- If you jump quickly in a moving entity (bhop), some jumps may still be bugged.


Changelog:

Code:

v1.0.1  @ 02/11/14
*
Code optimized
v1.0.0  @ 02/11/14
^
First public release

Credits:

HamletEagle - For some optimizations
fysiks - For some optimizations


Current version (stable):

zmd94 11-02-2014 10:53

Re: Conservation of Momentum Fix
 
This remind me about Physic subject in secondary school.
Quote:

Originally Posted by -Kid- (Post 2219251)
In real life, jumping in an elevator moving down or up at a constant speed will be the same as if you jumped on the floor. But in Gold Src games, it's bugged. This plugin simply fixes it.

Maybe, in Gold Src games there is an external force that acted upon the system which make it bugged. ;)

Nice, -Kid-.

ezio_auditore 11-02-2014 11:01

Re: Conservation of Momentum Fix
 
You picked a nice issue. Good job. Keep working on it.

HamletEagle 11-02-2014 11:26

Re: Conservation of Momentum Fix
 
Code:
for ( i = 0; i < 3; i++ ) {         flEntPlayerIsOnSpeed[ i ] = flSpeed[ i ]; }
This should work too:
Code:
flEntPlayerIsOnSpeed = flSpeed

Also you should check if AMXX_VERSION_NUM < 183 and define MAX_PLAYERS.

GoldSrc engine has some bugs, glad to see that there are peoples which try to fix them.

Kidev 11-02-2014 14:38

Re: Conservation of Momentum Fix
 
Thank you all!
Quote:

Originally Posted by HamletEagle (Post 2219271)
you should check if AMXX_VERSION_NUM < 183 and define MAX_PLAYERS.

I'm modifying this right now.

fysiks 11-02-2014 15:14

Re: Conservation of Momentum Fix
 
Quote:

Originally Posted by HamletEagle (Post 2219271)
This should work too:
Code:
flEntPlayerIsOnSpeed = flSpeed

That is not the proper way to assign arrays.

In this case, you can simply do this:
Code:

entity_get_vector(iEnt, EV_VEC_velocity, flEntPlayerIsOnSpeed);

Kidev 11-02-2014 17:42

Re: Conservation of Momentum Fix
 
Here it is, updated.

meTaLiCroSS 11-02-2014 18:55

Re: Conservation of Momentum Fix
 
Quote:

Originally Posted by fysiks (Post 2219338)
That is not the proper way to assign arrays.

In this case, you can simply do this:
Code:

entity_get_vector(iEnt, EV_VEC_velocity, flEntPlayerIsOnSpeed);

Can you explain why? I don't know how exactly that can be wrong also, it's correct but wrong (?)

Arkshine 11-02-2014 20:24

Re: Conservation of Momentum fix 1.0.1 - Elevators fix
 
Array assignment is valid when both arrays have the same size. This is just another compiler tip among others.

Kidev 11-03-2014 07:00

Re: Conservation of Momentum fix 1.0.1 - Elevators fix
 
Ok it's good to know! But it wasn't needed here finally since the method I used was redundant. I changed it.


All times are GMT -4. The time now is 16:02.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.