HDest-Community / Ugly-as-Sin

Enhancement modules for Hideous Destructor
zlib License
21 stars 17 forks source link

Add optional "vest only" variants of armor #202

Open caligari87 opened 1 year ago

caligari87 commented 1 year ago

Feature Notes

Possible roadblocks

If this works maybe separate leg and helmet armor items as well

caligari87 commented 1 year ago

Looks like this block is what controls the calculated "armor level" alv based on the impact position and some randomness.

//which is just a vest not a bubble...
if(
    inflictor
    &&inflictor.default.bmissile
){
    double impactheight=inflictor.pos.z+inflictor.height*0.5;
    double shoulderheight=victim.pos.z+victim.height-16;
    double waistheight=victim.pos.z+victim.height*0.4;
    double impactangle=absangle(victim.angle,victim.angleto(inflictor));
    if(impactangle>90)impactangle=180-impactangle;
    bool shouldhitflesh=(
        impactheight>shoulderheight
        ||impactheight<waistheight
        ||impactangle>80
    )?!random(0,5):!random(0,31);
    if(shouldhitflesh)alv=0;
    else if(impactangle>80)alv=random(1,alv);
}

Likely TODO: Make a PR to virtualize the calculation of the armor level. Once that's done, theoretically all I need to do is inherit from the desired armor and change the return of that function (changing names and refids)