home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Singles (French)
/
Singles-FrenchVersion-Win95.iso
/
data1.cab
/
Statemachine
/
showerChar.lua
< prev
next >
Wrap
Text File
|
2004-03-05
|
7KB
|
271 lines
-- shower character state machine
beginStateMachine()
onEnter(function(msg)
local shower = getStateObjectFromID(msg.sender);
storeStateObject("shower", shower);
storeData("initOutfit", getParent().getOutfit());
if (shower) then
-- shower does exist
local actionPointName = retrieveData("actionPointName");
if exitIfWrongPosition(getParent(), shower, actionPointName) then return end;
if (getParent().isOneActionPointLocked(shower)) then
-- action point is locked
getParent().setEmoticon(EMOTICON_CANNOT, EMOTICON_DELAY);
sendMsg("emoThink", getParent().walkSO);
exitStateMachine();
else
getParent().lockActionPoints(shower);
end
else
-- shower does not exist anymore
getParent().setEmoticon(EMOTICON_CANNOT, EMOTICON_DELAY);
sendMsg("emoThink", getParent().walkSO);
exitStateMachine();
end
freeHands(getParent());
end )
onExit(function(msg)
-- local shower = retrieveStateObject("shower");
-- getParent().stopAllActivities(shower);
-- getParent().unlockActionPoints(shower);
-- removeStateObject("shower");
unlockAll("shower");
getParent().stopAllActivities();
end )
onMsg("startShowerLoopSound", function(msg)
print("startShowerLoopSound");
local shower = retrieveStateObject("shower");
shower.loopSound("showerLoop");
end )
-- undress outside the shower
state("undressOutside")
onEnter(function(msg)
print("undressOutside onEnter");
local character = getParent();
local other, result = getDisturbingChar(character, "showNaked");
if (other) then
exitStateMachine();
character.setEmoticon(EMOTICON_SHY, EMOTICON_DELAY);
other.sendMsg("emoShameChar", character.walkSO);
return
end;
-- local character = getParent();
-- local others = character.getCharactersInRoom();
--
-- for c = 1, getn(others) do
-- local other = others[c];
-- --print("checkShyness other found");
-- if (not activityPossible(character, "showInUnderwear", other)) then
-- exitStateMachine();
-- --print("checkShyness sendMsg emoShame");
-- character.setEmoticon(EMOTICON_SHY, EMOTICON_DELAY);
-- other.sendMsg("emoShameChar", character.walkSO);
-- return
-- end;
-- end;
--startAnimation("ausziehen2");
startAnimation(getChangeOutfitAnim(getParent()));
sendDelayedMsgThis("underwear", 1600);
local shower = retrieveStateObject("shower");
shower.playSound("showerFadein");
sendDelayedMsg("startShowerLoopSound", this, 4100);
shower.setChildEnable("damp", true);
end )
onMsg("underwear", function(msg)
if (not hasOutfit(getParent(), UNDERWEAR) and not hasOutfit(getParent(), NOTHING)) then
getParent().changeOutfit(UNDERWEAR);
end
end )
-- onMsg("startLoopSound", function(msg)
-- print("undressOutside startLoopSound");
-- local shower = retrieveStateObject("shower");
-- shower.loopSound("showerLoop");
-- end )
onMsg("end", function(msg)
print("undressOutside end");
if testCancel() then
local shower = retrieveStateObject("shower");
shower.stopSound("showerLoop");
shower.playSound("showerFadeout");
shower.setChildEnable("damp", false);
local initOutfit = retrieveData("initOutfit");
getParent().changeOutfit(initOutfit);
exitStateMachine();
else
setState("enterShower");
sendDelayedMsgThis("act", 5000);
end
end )
-- enter the shower
state("enterShower")
onEnter(function(msg)
startAnimation("enterShowerElaine");
local shower = retrieveStateObject("shower");
--shower.playSound("enterShower");
sendDelayedMsgThis("playEnterShowerSound", 500);
--shower.startAnimation("showerDesignEnter");
playShowerAnim(shower, "Enter");
end )
onMsg("playEnterShowerSound", function(msg)
local shower = retrieveStateObject("shower");
shower.playSound("enterShower");
end )
onMsg("end", function(msg)
if testCancel() then
setState("exitShower")
else
setState("undressShower");
end
end )
-- undress in the shower
state("undressShower")
onEnter(function(msg)
local shower = retrieveStateObject("shower");
local takeShower = getParent().startActivity("shower", shower);
-- storeData("takeShower", takeShower);
local takeShowerLength, scale = getActivityLength(takeShower);
storeData("takeShowerLength", takeShowerLength);
startAnimation("undressShowerElaine");
sendDelayedMsgThis("hideCloth", 4000);
end )
onMsg("hideCloth", function(msg)
getParent().changeOutfit(NOTHING);
--getParent().enableBlend(true);
--print("outfit NOTHING", getParent().getOutfit());
end )
onMsg("end", function(msg)
if testCancel() then
setState("exitShower")
else
setState("shower");
sendDelayedMsgThis("act", 5000);
end
end )
-- take a shower
state("shower")
onEnter(function(msg)
--local shower = retrieveStateObject("shower");
--shower = getParent().startActivity("shower", shower);
-- local takeShower = retrieveData("takeShower");
-- local length, scale = getActivityLength(takeShower);
local length = retrieveData("takeShowerLength");
startAnimation("showerElaine");
-- to make quick abort on queue
sendDelayedMsgThis("endShower", length);
--this.actionComplete();
sendDelayedMsgThis("testCancel", CANCEL_POLLING_INTERVAL);
end )
onMsg("queue", function(msg)
sendMsgThis("endShower");
end )
onMsg("endShower", function(msg)
print("endShower")
local shower = retrieveStateObject("shower");
shower.stopSound("showerLoop");
shower.playSound("showerFadeout");
getParent().stopAllActivities(shower);
setState("exitShower")
end )
onMsg("testCancel", function(msg)
if testCancel() or (not this.getParent().getCurrentActivityGain()) then
sendMsgThis("endShower");
else
sendDelayedMsgThis("testCancel", CANCEL_POLLING_INTERVAL);
end
end )
onMsg("end", function(msg)
if testCancel() then
sendMsgThis("endShower");
else
startAnimation("showerElaine");
end
end )
-- exit the shower
state("exitShower")
onEnter(function(msg)
-- show clothes
startAnimation("exitShowerElaine");
local shower = retrieveStateObject("shower");
shower.stopSound("showerLoop");
playShowerAnim(shower, "Exit");
--shower.startAnimation("showerDesignEnter", -1);
--shower.startAnimation("showerDesignExit");
sendDelayedMsgThis("playTakeTowelSound", 500);
sendDelayedMsgThis("showTowel", 3800);
sendDelayedMsgThis("playExitSound", 4440);
end )
onMsg("playTakeTowelSound", function(msg)
local shower = retrieveStateObject("shower");
shower.playSound("showerTakeTowel");
end )
onMsg("showTowel", function(msg)
getParent().changeOutfit(TOWEL);
--getParent().enableBlend(false);
end )
onMsg("playExitSound", function(msg)
local shower = retrieveStateObject("shower");
shower.playSound("showerExit");
shower.setChildEnable("damp", false);
end )
onMsg("end", function(msg)
exitStateMachine();
end )
endStateMachine()