/*
    PROJECT Q IV v4.00
    (c) 2022 by Pstemarie

    Stomach Area OnExit Event Script

       Clears the value of the variables and local objects stored on swallowed
       creatures

    Version: 1.0
    Created: 28 Jan 2003
    Author:  Lacero
    v1.1:    3 June 2022 Pstemarie - streamlined coding

*/

void main()
{
    object oPC = GetExitingObject();
    object oWorm = GetLocalObject(oPC,"PW_INSIDE");
    int nSpace = GetLocalInt(oWorm,"PW_SPACE");
    //1 = a tiny creature, 2 = a small one.
    //4 = a large one (or normal)
    int nSize = GetCreatureSize(oPC);
    if (nSize > 2) {nSize=4;}

    SetLocalInt(oWorm,"PW_SPACE",nSpace-nSize);

    if(nSpace-nSize<1) {DeleteLocalInt(oWorm,"PW_SPACE");}

    DeleteLocalObject(oPC,"PW_INSIDE");
    DeleteLocalInt(oPC,"PW_DAMAGEDEALT");
    DeleteLocalInt(oPC,"PW_CLIMBINGOUT");
}
