Changed folder name.
Changed folder name.
This commit is contained in:
87
_module/nss/ew_lapsit0.nss
Normal file
87
_module/nss/ew_lapsit0.nss
Normal file
@@ -0,0 +1,87 @@
|
||||
//::///////////////////////////////////////////////
|
||||
//:: Emote Wand: Lap Sit 0 degrees
|
||||
//:: onConv emotewand
|
||||
//:://////////////////////////////////////////////
|
||||
/*
|
||||
1: find nearest chair/seat in use.
|
||||
2: create lap and sit on it
|
||||
|
||||
*/
|
||||
//:://////////////////////////////////////////////
|
||||
//-- ripped from:
|
||||
// chair sitting script by Jhenne
|
||||
// script modified to allow sitting on laps
|
||||
// with Sittable Objects v2.0 by Ranot
|
||||
//
|
||||
//-- by bloodsong
|
||||
//:://////////////////////////////////////////////
|
||||
|
||||
void DestroyLap(object oLap)
|
||||
{
|
||||
object oSitter = GetSittingCreature(oLap);
|
||||
|
||||
if(!GetIsObjectValid(oSitter))
|
||||
{ //-- no sitter, blow it up
|
||||
DestroyObject(oLap);
|
||||
return;
|
||||
}
|
||||
//-- else someone is still sitting on it, wait
|
||||
|
||||
DelayCommand(300.0, DestroyLap(oLap));
|
||||
}
|
||||
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
//-- Step One: find the nearest chair/seat and a lap in it
|
||||
|
||||
object oPC = GetPCSpeaker();
|
||||
object oChair = GetNearestObjectByTag("Chair");
|
||||
object oSeat = GetNearestObjectByTag("Seat");
|
||||
float fDistanceChair = GetDistanceToObject(oChair);
|
||||
float fDistanceSeat = GetDistanceToObject(oSeat);
|
||||
|
||||
//-- if non existant (-1) change to vast distance
|
||||
if(fDistanceChair == -1.0) { fDistanceChair = 1000.0; }
|
||||
if(fDistanceSeat == -1.0) { fDistanceSeat = 1000.0; }
|
||||
|
||||
object oLap;
|
||||
|
||||
if(fDistanceChair > fDistanceSeat)
|
||||
{ //-- chair is further, use seat
|
||||
oLap = oSeat;
|
||||
}
|
||||
else
|
||||
{ //-- note, chair selected over seat when same dist
|
||||
oLap = oChair;
|
||||
}
|
||||
|
||||
object oLapper = GetSittingCreature(oLap);
|
||||
|
||||
if(!GetIsObjectValid(oLapper))
|
||||
{ //-- nobody sitting in that chair/seat
|
||||
SendMessageToPC(oPC, "No nearby laps found.");
|
||||
return;
|
||||
}
|
||||
|
||||
//-- Step Two: Create the Lap and Sit In It
|
||||
|
||||
vector vSit = GetPosition(oLap);
|
||||
float fDir=GetFacing(oLap);
|
||||
|
||||
float fLapLength = -0.3 ;
|
||||
float fSitterFacing = GetFacing(oLap);
|
||||
vector vPosition = GetPositionFromLocation(GetLocation(oLap)) ;
|
||||
float fPosX = vPosition.x + cos(fSitterFacing)*fLapLength;
|
||||
float fPosY = vPosition.y + sin(fSitterFacing)*fLapLength;
|
||||
vector vLapPosition = Vector(fPosX, fPosY, 0.0) ;
|
||||
|
||||
|
||||
location lSit = Location(GetArea(oLap),vLapPosition,fDir);
|
||||
object oSit = CreateObject(OBJECT_TYPE_PLACEABLE, "invisiblelap", lSit,FALSE);
|
||||
|
||||
DelayCommand(16.0, DestroyLap(oSit));
|
||||
ActionSit(oSit);
|
||||
|
||||
}
|
Reference in New Issue
Block a user