home *** CD-ROM | disk | FTP | other *** search
/ Singles (French) / Singles-FrenchVersion-Win95.iso / data1.cab / Statemachine / kommodeChar.lua < prev    next >
Text File  |  2004-03-05  |  2KB  |  83 lines

  1. -- kommode character state machine
  2. beginStateMachine()
  3.     
  4.     onEnter(function(msg)
  5.         local kommode = getStateObjectFromID(msg.sender);
  6.         storeStateObject("kommode", kommode);
  7.         
  8.         
  9.         if (kommode) then
  10.             -- kommode does exist
  11.             local actionPointName = retrieveData("actionPointName");
  12.             local actionPoint = getParent().getFreeActionPoint(kommode, actionPointName);
  13.             
  14.             if exitIfWrongPosition(getParent(), kommode, actionPointName) then return end;    
  15.             
  16.             if (not actionPoint) then
  17.                 -- action points is locked
  18.                 getParent().setEmoticon(EMOTICON_CANNOT, EMOTICON_DELAY);
  19.                 sendMsg("emoThink", getParent().walkSO);
  20.                 exitStateMachine();
  21.             else
  22.                 getParent().lockActionPoint(kommode, actionPointName);
  23.             end
  24.         else
  25.             -- kommode does not exist anymore
  26.             getParent().setEmoticon(EMOTICON_CANNOT, EMOTICON_DELAY);
  27.             sendMsg("emoThink", getParent().walkSO);
  28.             exitStateMachine();
  29.         end
  30.         
  31.         
  32.         freeHands(getParent());
  33.         
  34.     end )
  35.     
  36.     onExit(function(msg)
  37.         local kommode = retrieveStateObject("kommode");
  38.         getParent().unlockActionPoints(kommode);
  39.         removeStateObject("kommode");
  40.     end )
  41.     
  42.     state("outfit")
  43.     
  44.     
  45.         
  46.         onEnter(function(msg)
  47.             --startAnimation("ausziehen2");
  48.             startAnimation(getChangeOutfitAnim(getParent()));
  49.             sendDelayedMsgThis("change", 1600);
  50.         end )
  51.         
  52.         onMsg("change", function(msg)
  53.             local outfit = retrieveData("outfit")
  54.             changeOutfit(getParent(), getParent().numberToOutfit(outfit)); -- lua function checks if out fit allready on
  55.         end )
  56.     
  57.         onMsg("end", function(msg)
  58.             exitAndGoAway();
  59.         end )
  60.         
  61.         
  62. --        onEnter(function(msg)
  63. --            setPose(archize(getParent(), "stand1"));
  64. --        end )
  65. --        
  66. --        onMsg("end", function(msg)
  67. --            local outfit = retrieveData("outfit")
  68. --            getParent().changeOutfit(getParent().numberToOutfit(outfit));
  69. --            exitAndGoAway();
  70. --        end)
  71. --        
  72.         
  73.         
  74.         
  75.     
  76.         
  77.         
  78.         
  79.         
  80.         
  81.         
  82. endStateMachine()
  83.