home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Singles (French)
/
Singles-FrenchVersion-Win95.iso
/
data1.cab
/
Statemachine
/
plate.lua
< prev
next >
Wrap
Text File
|
2004-03-05
|
2KB
|
56 lines
-- camera state machine
beginStateMachine()
onMsg("buildMenu", function(msg)
-- build the pie menu
clearPieMenu();
local button;
button = addPieMenuButton("pm_washDishes", "washDishes");
button.addDescription(ACTIVITY, "washDishes");
button.addDescription(ACTIVITY, "improvePlateTidiness");
button.addIcon("guiIconWohnung");
end )
--
onMsg("washDishes", function(msg)
-- get character who initiated this action
local character = getStateObjectFromID(msg.sender);
-- check if activity if possible
local possible, result, activity = activityPossible(character, msg.name, this);
-- don't care if timeslot is not fulfilled
if (possible or enumCompare(result, TIMESLOT)) then
-- get the walk state object
local wso = character.walkSO;
local wsoContext = StateMachineContext();
local dishwashers = character.getObjectsWithBehavior("dishwasher");
local dishwasher = dishwashers[1];
if (dishwasher) then
character.pushCommand("pm_washDishes", "washDishes", dishwasher, "");
character.popQueueEntry();
else
print("no dishwasher found");
instantAbort(character, EMOTICON_CANNOT, "emoThink")
end
else
-- activity not possible
print(msg.name .. " not possible");
local emoticon;
if (enumCompare(result, NO_CONDITION)) then
emoticon = conditionToEmoticon(activity.getUnfulfilledCondition());
else
emoticon = EMOTICON_CANNOT;
end
instantAbort(character, emoticon, "emoThink");
end
end )
endStateMachine()