Phil25 / RTD

Roll The Dice SourceMod plugin for Team Fortress 2
GNU General Public License v3.0
56 stars 20 forks source link

Restore Demo Shield Roll #4

Open fearts opened 5 years ago

fearts commented 5 years ago

Feature request roll. In Freak Fortress and Saxton Hale you can lose your shield if the hale hits you and it blocks some damage. A roll just for Demos that restores your shield would be cool.

Phil25 commented 5 years ago

This should be done via the Freak Fortress plugin. However, the RTD plugin doesn't support custom functions for checking if a perk is applicable for client, such as has they lost their shield.

I may look into supporting such functions, or having more advanced parsing system of the weapon classes in config, so you can include a sort of blacklist for each perk.

For now, what the FF plugin could do, is to use some existing perk to restore the shield. For example, check if Infinite Ammo is being applied and resupply the shield with it.

Batfoxkid commented 5 years ago

Some examples from my version of FF2.

public void SetShield_Call(int client, Perk perk, bool apply){
    if(!apply) return;

    if(FF2_GetClientShield(client)<=0) return;

    FF2_SetClientShield(client, _, perk.GetPrefCell("health"), perk.GetPrefCell("resistance"));
}

public void TimedShield_Call(int client, Perk perk, bool apply){
    if(apply) TimedShield_ApplyPerk(client);
    else TimedShield_RemovePerk(client);
}

public void TimedShield_ApplyPerk(int client){
    if(FF2_GetClientShield(client)<=0) return;

    FF2_SetClientShield(client, _, perk.GetPrefCell("health"), perk.GetPrefCell("resistance"));
}

public void TimedShield_RemovePerk(int client){
    if(FF2_GetClientShield(client)<=0) return;

    FF2_SetClientShield(client, _, 100);
}

public void BreakShield_Call(int client, Perk perk, bool apply){
    if(!apply) return;

    if(FF2_GetClientShield(client)<=0) return;

    FF2_RemoveClientShield(client);
}