-
-
Notifications
You must be signed in to change notification settings - Fork 212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement GetArmorDamageFactor hook #600
Conversation
Something I suggested to s1lentq but who ignore as usual, here is a better format I recommend and the reasons why. QUOTE FROM MY EMAIL TO HIM: Request #5 (on ReGameDLL_CS): On L1086 inside player.cpp, all the content of the armor ratios are internally hardcoded inside that "if (pAttack->m_pActiveItem)" part, I would like you make a new API hook chain for that whole content, in order to allow coders to alter armor ratios. I might recommend a format like: And it should return in the "float" the new value of "flRatio" (flRatio = CBasePlayer_GetArmorRatioFromAttackerWeapon(...)). Feel free to name it differently, but all of the parameters I have specified must be added (useful informations), so we can know the attacker's informations and what is the current ratio depending on some conditions (VIP/Shield holding, etc.), and readjust it, and also set "flShieldRatio" parameter to 0.0 in case of we do not want to perform different armor ratio protection for victim clients holding shield (I personnaly do not see why the game has been coded with such differences about armor ratios, and I even think it is not realistic, because despite in real life there are different kind of "bullet proof vests", they usually protect the same way, the "higher protection ones" are the military's ones where soldiers can put "metal plates" in it to make it more resistant or even stop large calibers). It will also be good if this new function could be used for grenade/blast damage (so, also put in some lines above, like around L903 inside player.cpp). |
Better, but you still could add more of the parameters I have suggested. The "CBasePlayerItem *pAttackerItemCBase" could be skipped (because we can if we wish, retrieve it via the attacker's CBasePlayer pointer & inventory item type ID), but the others are useful (the victim & attacker infos could be used in a lot of situations for different settings), and the "flBonus" could be passed via reference in order to allow us to alter it before the armor code (around 30 lines after the end of that part) got executed. If a new useful hook is added, most complete it is, better this is huh! |
And put the hooks in the end of the API to avoid breaking listing. |
@StevenKal |
Yes, and armor calculation process code being "duplicated" is kind of ugly. |
You could even add support for other entities, as "func_tank" (with different ratios depending on the bullet type used from the tank), because right now this will use the holstered active item ratio when someone shoot a client via a tank sentry. |
@StevenKal Unfortunately, my knowledge does not yet allow it to be beautifully done. |
Whatever it is true or not, I think you can at least add the parameters I have specified, like: |
Well, I like it better now, sounds good. The "flShieldRatio" is no longer alterable via parameter, but, we can still "workaround" by unsetting shield/VIP properties in a PRE hook of that function, then set them back at their previous status in a POST one, so not dramatic. |
@StevenKal works!
|
little plugin (super armor for bomb explosion)
|
Good too, I will just recommend to put "bitsDamageType" parameter right after "pevInflictor" in order to "follow a bit" the "TakeDamage" order, and keep "flBonus" & "flBaseRatio" at the end. EDIT: You could still add default support for "func_tank" entitites (above "if(pAttack->m_pActiveItem)") if you find some motivation for that! |
well now the hook has stopped working. |
Because some parts in the AMXX's ReAPI module have missing code (in "reapi/include/cssdk/dlls/regamedll_api.h" for example, this must contain same functions than the ReGameDLL_CS binary, so the 3 Fire* functions to have same IDs positions when the hooks are loaded). Make your other PR in ReAPI module use the same functions and problem will be solved after recompiling your both ReGameDLL_CS & ReAPI binaries. So in ReAPI's "regamedll_api.h", change this: Into:
And also add the typedef ... of the Fire* functions (from ReGameDLL_CS's "regamedllcs_api.h" file). |
What? Why closed? Do you give it up, or want to rework it? About the "func_tank" entities support, not much people use them, and not many maps have them, but there are also possible plugins which has such entities, like a M2 I made. You could easily implement the code right before your "if (pAttack->m_pActiveItem)", do a "if(pAttack->m_pTank) {", then inside, check if class name is "func_tank", if yes, do a switch with "pAttack->m_pTank->m_bulletType" (like it is done in "CFuncTankGun::Fire"), then do not forget a "default" where you set, probably the same value you will put than for the "TANK_BULLET_9MM" value, set some default values for "flRatio" & the "TANK_BULLET_*" (high for the 12mm please!). |
No. |
Bouhhhhh... |
Any chance you open & push it back? I do not get the reason why this has been closed, while it is an useful hook. |
This comment was marked as off-topic.
This comment was marked as off-topic.
Not sure if ignored, maybe you will have better chance quoting wopox or silent, just be patient... |
* Update wpn_knife.cpp. * New CVar: mp_dying_time. * Shield constants code cleaning. * Adjust gib's velocity limit according to sv_maxvelocity. * API: Implement PM_LadderMove hook. * TutorMessageEvent::GetNextParameter: Fixed corrupted stack. * Enable location feature if bots allowed or listen server is running. * mp_fadetoblack 2 fade timings now depends from mp_dying_time CVar and code fixes.
No description provided.