„Chris.MultiNPC.lsl“ ändern

This commit is contained in:
Christopher 2021-07-29 15:18:32 +00:00
parent 56d6c6ea60
commit 7ec2c18f31
1 changed files with 9 additions and 8 deletions

View File

@ -56,12 +56,12 @@ state running
timer() timer()
{ {
if((m_lastTimeCheck + 2) <= llGetUnixTime()) if((m_lastTimeCheck + 2) <= llGetUnixTime())
hardReset(); hardReset("script timeout");
m_lastTimeCheck = llGetUnixTime(); m_lastTimeCheck = llGetUnixTime();
if(getRealAgentCount() == 0) if(getRealAgentCount() == 0)
hardReset(); hardReset("region empty");
doNextScriptStep(); doNextScriptStep();
} }
@ -69,15 +69,15 @@ state running
changed(integer change) changed(integer change)
{ {
if (change & CHANGED_INVENTORY) if (change & CHANGED_INVENTORY)
hardReset(); hardReset("change inventory");
if (change & CHANGED_REGION_START) if (change & CHANGED_REGION_START)
hardReset(); hardReset("region start");
} }
on_rez(integer start_param) on_rez(integer start_param)
{ {
hardReset(); hardReset("reset on rez");
} }
} }
@ -330,10 +330,10 @@ doNextScriptStep()
vector targetPosition = (vector)getDataEntryFromDataList(m_npcdata, "npc." + currentNPCSlot + ".targetPosition"); vector targetPosition = (vector)getDataEntryFromDataList(m_npcdata, "npc." + currentNPCSlot + ".targetPosition");
if(llGetListLength(currentNPCDataList) == 0) if(llGetListLength(currentNPCDataList) == 0)
hardReset(); hardReset("NPC not found");
if(llVecDist(lastKnownPos, currentNPCPosition) <= 0.5) if(llVecDist(lastKnownPos, currentNPCPosition) <= 0.5)
hardReset(); hardReset("npc is stuck");
if(llVecDist(currentNPCPosition, targetPosition) >= 1) if(llVecDist(currentNPCPosition, targetPosition) >= 1)
continue; continue;
@ -474,8 +474,9 @@ checkOSPermissions()
llRemoveInventory("OwnerAppearance" + llGetKey()); llRemoveInventory("OwnerAppearance" + llGetKey());
} }
hardReset() hardReset(string message)
{ {
llSay(0, "Hard reset: " + message);
llSetTimerEvent(0); llSetTimerEvent(0);
integer dataListCount = llGetListLength(m_npcdata); integer dataListCount = llGetListLength(m_npcdata);
while(dataListCount--) while(dataListCount--)