Modding:StatShifter: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 33: Line 33:


<syntaxhighlight lang="csharp">
<syntaxhighlight lang="csharp">
StatShifter.DefaultDisplayName = "camouflage";
private void CheckCamouflage()
StatShifter.SetStatShift(User, "DV", CurrentBonus);
{
    GameObject User = ParentObject.pPhysics.Equipped;
    if (User == null) return;
    if( User.pPhysics.CurrentCell != null )
    {
        if (User.pPhysics.CurrentCell.HasObjectWithPart("PlantProperties"))
        {
            StatShifter.DefaultDisplayName = "camouflage";
            StatShifter.SetStatShift(User, "DV", CurrentBonus);                      
        }
        else
        {
            StatShifter.RemoveStatShifts(User);
        }
    }
}
</syntaxhighlight>
</syntaxhighlight>