Module commit
Module commit.
This commit is contained in:
53
_module/nss/clean_store.nss
Normal file
53
_module/nss/clean_store.nss
Normal file
@@ -0,0 +1,53 @@
|
||||
void main()
|
||||
{ // start main
|
||||
object oPC = GetExitingObject();
|
||||
object oArea = GetArea(OBJECT_SELF);
|
||||
int nPCFlag = FALSE;
|
||||
if(GetIsPC(oPC))
|
||||
{ // start main if
|
||||
object oObject = GetFirstObjectInArea(oArea);
|
||||
|
||||
while(GetIsObjectValid(oObject))
|
||||
{ //start while loop
|
||||
if(GetIsPC(oObject))
|
||||
{ //start if
|
||||
nPCFlag = TRUE;
|
||||
break; // leave while loop if a PC is in the area
|
||||
} // end if
|
||||
else
|
||||
{ //start else
|
||||
oObject = GetNextObjectInArea(oArea);
|
||||
} // end else
|
||||
} // end while
|
||||
if(nPCFlag == FALSE)
|
||||
{
|
||||
object oStore = GetFirstObjectInArea(oArea);
|
||||
while(GetIsObjectValid(oStore))
|
||||
{
|
||||
int nObjectType = GetObjectType(oStore);
|
||||
if(nObjectType == OBJECT_TYPE_STORE)
|
||||
{
|
||||
object oItem = GetFirstItemInInventory(oStore);
|
||||
while(GetIsObjectValid(oItem))
|
||||
{
|
||||
int nItemFlag = GetLocalInt(oItem, "PCItem");
|
||||
if(nItemFlag != 0)
|
||||
{
|
||||
if(nItemFlag < 4)
|
||||
{
|
||||
nItemFlag++;
|
||||
SetLocalInt(oItem, "PCItem", nItemFlag);
|
||||
}
|
||||
else
|
||||
{
|
||||
DestroyObject(oItem);
|
||||
}
|
||||
}
|
||||
oItem = GetNextItemInInventory(oStore);
|
||||
} // end second while
|
||||
} // end if
|
||||
oStore = GetNextObjectInArea(oArea);
|
||||
} // end first while
|
||||
} // end if
|
||||
} // end main if
|
||||
} // end main
|
Reference in New Issue
Block a user