Stalker_GAMMA icon indicating copy to clipboard operation
Stalker_GAMMA copied to clipboard

Monkey patch prevention

Open windelicato opened this issue 1 year ago • 8 comments

Two things in this PR:

  • Please share your s_hit.power and k_ap calculations so that other mods/scripts can leverage them

I've been working on a mod that requires an accurate s_hit.power and right now there isn't really a great way to get that since grok_bo sets it to 0 and redoing all those calcs kinda sucks. There are a few workarounds but I've found them inconsistent and prone to break when grok_bo is updated. This way everyone will have access to the same calculations

  • Break at least the headshot particle into a variable that can be changed

A bunch of mods that touch on effects include or recommend including a monkey patch of this script just to prevent that one particle being played on headshot. I couldn't find a way to define it in DLTX so there might be a better way here

Keep up the great work @Grokitach and let me know if there's anything i can do to make your life easier

  • (sunn in discord)

windelicato avatar Oct 11 '24 08:10 windelicato

And just an example of how much easier this would make things to sync up across mods:

Base anomaly:

hit_power = s_hit.power

Current GAMMA workaround

if grok_bo ~= nil then 
    hit_power = functionThatClonesGrokBoLogic(s_hit, target, bone_id) or hit_power
end

Suggested fix (mod would still need to do bone grouping logic but still not as bad)

if grok_bo ~= nil then
    hit_power = grok_bo.custom_bone_power[target:id() .. "_" .. bone_group_id]
end

windelicato avatar Oct 11 '24 11:10 windelicato

If you want to edit grok_bo.script, just replace the script in your mod. I don't want mods to sneakily edit the grok_bo or adb scripts.

But I'll look into it. Pulling the values given by the script is fine.

Grokitach avatar Oct 11 '24 19:10 Grokitach

If you want to edit grok_bo.script, just replace the script in your mod. I don't want mods to sneakily edit the grok_bo or adb scripts.

But I'll look into it. Pulling the values given by the script is fine.

Would you consider just sharing the values calculated and not the particle adjustments? The three problems i see with replacing in mods are:

  • Mod cannot be compatible with different versions of gamma unless multiple replacements are maintained
  • If the author abandons a mod their replacement will be out of date until updated manually
  • If multiple mods accept that they need replace it they will all be incompatible with eachother

With the current setup we don't have a single source of truth for hit calculations. The only way to get that is by copy/pasting/porting this entire script. Any mod that uses s_hit.power in a calculation will be broken unless it does since you're setting it to 0 :(

Thank you for considering :)

windelicato avatar Oct 11 '24 23:10 windelicato

I'll just return the damage value, the k_ap, the bone armor and the depleted bone armor values at the end of the functions I think. What's your mod about ?

Grokitach avatar Oct 12 '24 09:10 Grokitach

I'll just return the damage value, the k_ap, the bone armor and the depleted bone armor values at the end of the functions I think. What's your mod about ?

That's huge you can close this PR if you want or I can update it.

mod is just a replacement for blood pools without any of the actor_on_updates or footsteps, replacement for dismemberment without spawning meshes, floor splash marks when no walls around. when blood pools got disabled combat was looking dry

windelicato avatar Oct 12 '24 22:10 windelicato

I'll just return the damage value, the k_ap, the bone armor and the depleted bone armor values at the end of the functions I think. What's your mod about ?

I can do you one better. I followed what ArtiBalls did, monkey-patching the mutant/stalker on_hit _G functions and doing a SendCallback(...) to those functions after doing GBO's damage calculations. This allows GBO to not only work well with other mods that deal with the mutant/stalker on_hit callbacks (ones that never worked for stalker hits when using GAMMA/GBO), but I also made sure to incorporate other parts attached to GBO in GAMMA Close Quarters Combat. The only difference ofc being that PBA functions are now done on the final damage value rather than right before any no-pen penalty is give, and I may have a few things here and there that are missing from any GAMMA updates since my last full work on it. But, it should be what you are looking for and have it be GAMMA ready with a few more tweaks.

Here is the file from the Suggestions post so that you don't have to hunt it down, attached to this comment. GAMMA Close Quarters Recoded V3.zip

ilrathCXV avatar Oct 13 '24 22:10 ilrathCXV

As I said: I don't want other mods to change damage based on GBO.

Grokitach avatar Oct 14 '24 05:10 Grokitach

Here's what I'm doing that doesn't touch @Grokitach calculations or modify them in any way

A little messy cuz this is a workaround to avoid replacing your script in my mod, but something like this would be a welcome addition:

https://github.com/windelicato/painterofthezone/blob/main/gamedata/scripts/short_range_blood_lookup.script#L331

My mod uses demonized before_hit_after_calcs to ensure GBO is finished, and then uses this table as a cache for other scripts to lookup the damage calculation with this:

https://github.com/windelicato/painterofthezone/blob/3014ff4eb2451c4a4b221dc76dab812374f0cff8/gamedata/scripts/short_range_blood_lookup.script#L144

https://github.com/windelicato/painterofthezone/blob/main/gamedata/scripts/short_range_blood_dismemb.script#L58

It also supports @ilrathCXV for addons that use it

https://github.com/windelicato/painterofthezone/blob/main/gamedata/scripts/short_range_blood_lookup.script#L32

If you would like I can modify this PR to save a lookup table of damage calculations like this

windelicato avatar Oct 21 '24 23:10 windelicato