Changed folder name.
Changed folder name.
This commit is contained in:
102
_module/nss/ew_lapsit270.nss
Normal file
102
_module/nss/ew_lapsit270.nss
Normal file
@@ -0,0 +1,102 @@
|
||||
//::///////////////////////////////////////////////
|
||||
//:: Emote Wand: Lap Sit 270 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 = 0.0;
|
||||
if (GetFacing(oLap) >= 0.0 && GetFacing(oLap) <= 90.0)
|
||||
{
|
||||
fDir = 270.0 + GetFacing(oLap);
|
||||
}
|
||||
if (GetFacing(oLap) > 90.0 && GetFacing(oLap) <= 180.0)
|
||||
{
|
||||
fDir = GetFacing(oLap) - 90.0;
|
||||
}
|
||||
if (GetFacing(oLap) > 180.0 && GetFacing(oLap) <= 270.0)
|
||||
{
|
||||
fDir = GetFacing(oLap) - 90.0;
|
||||
}
|
||||
if (GetFacing(oLap) > 270.0 && GetFacing(oLap) <= 360.0)
|
||||
{
|
||||
fDir = GetFacing(oLap) - 90.0;
|
||||
}
|
||||
|
||||
//--SD's position calculation
|
||||
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) ;
|
||||
|
||||
//--siddown!
|
||||
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