mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-14 02:27:40 -04:00
Initial Commit of CyanWorlds.com Engine Open Source Client/Plugin
This commit is contained in:
@ -0,0 +1,107 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#include "hsTypes.h"
|
||||
#include "plANDConditionalObject.h"
|
||||
#include "../plPhysical/plDetectorModifier.h"
|
||||
#include "hsResMgr.h"
|
||||
#include "../../NucleusLib/pnModifier/plConditionalObject.h"
|
||||
#include "../../NucleusLib/pnModifier/plLogicModBase.h"
|
||||
#include "../plMessage/plCondRefMsg.h"
|
||||
|
||||
plANDConditionalObject::plANDConditionalObject()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
plANDConditionalObject::~plANDConditionalObject()
|
||||
{
|
||||
for (int i = 0; i < fChildren.Count(); i++)
|
||||
delete (fChildren[i]);
|
||||
}
|
||||
|
||||
hsBool plANDConditionalObject::MsgReceive(plMessage* msg)
|
||||
{
|
||||
plCondRefMsg* pCondMsg = plCondRefMsg::ConvertNoRef(msg);
|
||||
if (pCondMsg)
|
||||
{
|
||||
fChildren[pCondMsg->fWhich] = plConditionalObject::ConvertNoRef( pCondMsg->GetRef() );
|
||||
return true;
|
||||
}
|
||||
return plConditionalObject::MsgReceive(msg);
|
||||
}
|
||||
|
||||
void plANDConditionalObject::Evaluate()
|
||||
{
|
||||
if (!Satisfied())
|
||||
{
|
||||
for (int i = 0; i < fChildren.Count(); i++)
|
||||
{
|
||||
if (!fChildren[i]->Satisfied())
|
||||
return;
|
||||
}
|
||||
SetSatisfied(true);
|
||||
fLogicMod->RequestTrigger();
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < fChildren.Count(); i++)
|
||||
{
|
||||
if (fChildren[i]->Satisfied())
|
||||
return;
|
||||
}
|
||||
SetSatisfied(false);
|
||||
}
|
||||
}
|
||||
|
||||
void plANDConditionalObject::Reset()
|
||||
{
|
||||
for (int i = 0; i < fChildren.Count(); i++)
|
||||
fChildren[i]->Reset();
|
||||
}
|
||||
|
||||
void plANDConditionalObject::Read(hsStream* stream, hsResMgr* mgr)
|
||||
{
|
||||
plConditionalObject::Read(stream, mgr);
|
||||
|
||||
plCondRefMsg* refMsg;
|
||||
int n = stream->ReadSwap32();
|
||||
fChildren.SetCountAndZero(n);
|
||||
for(int i = 0; i < n; i++ )
|
||||
{
|
||||
refMsg = TRACKED_NEW plCondRefMsg(GetKey(), i);
|
||||
mgr->ReadKeyNotifyMe(stream,refMsg, plRefFlags::kActiveRef);
|
||||
}
|
||||
}
|
||||
|
||||
void plANDConditionalObject::Write(hsStream* stream, hsResMgr* mgr)
|
||||
{
|
||||
plConditionalObject::Write(stream, mgr);
|
||||
|
||||
stream->WriteSwap32(fChildren.GetCount());
|
||||
for( int i = 0; i < fChildren.GetCount(); i++ )
|
||||
fChildren[i]->Write(stream, mgr);
|
||||
}
|
||||
|
@ -0,0 +1,55 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#ifndef plANDConditionalObject_inc
|
||||
#define plANDConditionalObject_inc
|
||||
|
||||
#include "../../NucleusLib/pnModifier/plConditionalObject.h"
|
||||
#include "hsTemplates.h"
|
||||
|
||||
class plANDConditionalObject : public plConditionalObject
|
||||
{
|
||||
protected:
|
||||
hsTArray<plConditionalObject*> fChildren;
|
||||
|
||||
public:
|
||||
|
||||
plANDConditionalObject();
|
||||
~plANDConditionalObject();
|
||||
|
||||
CLASSNAME_REGISTER( plANDConditionalObject );
|
||||
GETINTERFACE_ANY( plANDConditionalObject, plConditionalObject );
|
||||
|
||||
virtual void Read(hsStream* stream, hsResMgr* mgr);
|
||||
virtual void Write(hsStream* stream, hsResMgr* mgr);
|
||||
|
||||
hsBool MsgReceive(plMessage* msg);
|
||||
void Evaluate();
|
||||
void Reset();
|
||||
|
||||
};
|
||||
|
||||
#endif // plANDConditionalObject_inc
|
@ -0,0 +1,205 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#include "hsTypes.h"
|
||||
#include "plActivatorConditionalObject.h"
|
||||
#include "../plPhysical/plDetectorModifier.h"
|
||||
#include "../../NucleusLib/pnModifier/plLogicModBase.h"
|
||||
#include "../plMessage/plActivatorMsg.h"
|
||||
#include "../pnMessage/plNotifyMsg.h"
|
||||
|
||||
|
||||
plActivatorConditionalObject::plActivatorConditionalObject()
|
||||
{
|
||||
SetFlag(kLocalElement); // since it relies on user input
|
||||
}
|
||||
|
||||
hsBool plActivatorConditionalObject::MsgReceive(plMessage* msg)
|
||||
{
|
||||
plActivatorMsg* pDetectorMsg = plActivatorMsg::ConvertNoRef(msg);
|
||||
if (pDetectorMsg)
|
||||
{
|
||||
if (pDetectorMsg->fTriggerType == plActivatorMsg::kVolumeEnter || pDetectorMsg->fTriggerType == plActivatorMsg::kVolumeExit)
|
||||
return plConditionalObject::MsgReceive(msg);
|
||||
|
||||
for (int i = 0; i < fActivators.Count(); i++)
|
||||
{
|
||||
if (pDetectorMsg && pDetectorMsg->GetSender() == fActivators[i])
|
||||
{
|
||||
if (pDetectorMsg->fTriggerType == plActivatorMsg::kUnPickedTrigger ||
|
||||
pDetectorMsg->fTriggerType == plActivatorMsg::kExitUnTrigger ||
|
||||
pDetectorMsg->fTriggerType == plActivatorMsg::kEnterUnTrigger ||
|
||||
pDetectorMsg->fTriggerType == plActivatorMsg::kCollideUnTrigger )
|
||||
|
||||
{
|
||||
// is this a toggle activator?
|
||||
if (IsToggle())
|
||||
return true;
|
||||
|
||||
// are we in a triggered state?
|
||||
if (fLogicMod->HasFlag(plLogicModBase::kTriggered))
|
||||
{
|
||||
if (pDetectorMsg->fTriggerType == plActivatorMsg::kUnPickedTrigger)
|
||||
fLogicMod->GetNotify()->AddPickEvent(pDetectorMsg->fHitterObj, pDetectorMsg->fPickedObj, false, pDetectorMsg->fHitPoint);
|
||||
|
||||
if ((pDetectorMsg->fTriggerType == plActivatorMsg::kCollideExit) ||
|
||||
(pDetectorMsg->fTriggerType == plActivatorMsg::kVolumeExit) )
|
||||
fLogicMod->GetNotify()->AddCollisionEvent(true, pDetectorMsg->fHitterObj, pDetectorMsg->fHiteeObj);
|
||||
|
||||
if ((pDetectorMsg->fTriggerType == plActivatorMsg::kCollideEnter) ||
|
||||
(pDetectorMsg->fTriggerType == plActivatorMsg::kVolumeEnter) )
|
||||
fLogicMod->GetNotify()->AddCollisionEvent(false, pDetectorMsg->fHitterObj, pDetectorMsg->fHiteeObj);
|
||||
|
||||
fLogicMod->RequestUnTrigger();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// are we a toggle that has been triggered?
|
||||
// are we in a triggered state?
|
||||
if (fLogicMod->HasFlag(plLogicModBase::kTriggered) && IsToggle())
|
||||
{
|
||||
if (pDetectorMsg->fTriggerType == plActivatorMsg::kUnPickedTrigger)
|
||||
fLogicMod->GetNotify()->AddPickEvent(pDetectorMsg->fHitterObj, pDetectorMsg->fPickedObj, false, pDetectorMsg->fHitPoint);
|
||||
|
||||
if ((pDetectorMsg->fTriggerType == plActivatorMsg::kCollideExit) ||
|
||||
(pDetectorMsg->fTriggerType == plActivatorMsg::kVolumeExit) )
|
||||
fLogicMod->GetNotify()->AddCollisionEvent(true, pDetectorMsg->fHitterObj, pDetectorMsg->fHiteeObj);
|
||||
|
||||
if ((pDetectorMsg->fTriggerType == plActivatorMsg::kCollideEnter) ||
|
||||
(pDetectorMsg->fTriggerType == plActivatorMsg::kVolumeEnter) )
|
||||
fLogicMod->GetNotify()->AddCollisionEvent(false, pDetectorMsg->fHitterObj, pDetectorMsg->fHiteeObj);
|
||||
|
||||
fLogicMod->RequestUnTrigger();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if (!fLogicMod->VerifyConditions( pDetectorMsg ))
|
||||
return false;
|
||||
// this is used as part of a picked detector sometimes...
|
||||
if (pDetectorMsg->fTriggerType == plActivatorMsg::kPickedTrigger)
|
||||
fLogicMod->GetNotify()->AddPickEvent(pDetectorMsg->fHitterObj, pDetectorMsg->fPickedObj, true, pDetectorMsg->fHitPoint);
|
||||
|
||||
if ((pDetectorMsg->fTriggerType == plActivatorMsg::kCollideExit) ||
|
||||
(pDetectorMsg->fTriggerType == plActivatorMsg::kVolumeExit) )
|
||||
{
|
||||
fLogicMod->GetNotify()->AddCollisionEvent(false, pDetectorMsg->fHitterObj, pDetectorMsg->fHiteeObj);
|
||||
}
|
||||
if ((pDetectorMsg->fTriggerType == plActivatorMsg::kCollideEnter) ||
|
||||
(pDetectorMsg->fTriggerType == plActivatorMsg::kVolumeEnter) )
|
||||
{
|
||||
fLogicMod->GetNotify()->AddCollisionEvent(true, pDetectorMsg->fHitterObj, pDetectorMsg->fHiteeObj);
|
||||
}
|
||||
SetSatisfied(true);
|
||||
//hsBool netRequest = msg->HasBCastFlag(plMessage::kNetNonLocal);
|
||||
//fLogicMod->RequestTrigger(netRequest);
|
||||
fLogicMod->RequestTrigger(false);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return plConditionalObject::MsgReceive(msg);
|
||||
}
|
||||
|
||||
void plActivatorConditionalObject::Read(hsStream* stream, hsResMgr* mgr)
|
||||
{
|
||||
plConditionalObject::Read(stream, mgr);
|
||||
fActivators.Reset();
|
||||
int n = stream->ReadSwap32();
|
||||
for (int i = 0; i < n; i++)
|
||||
fActivators.Append(mgr->ReadKey(stream));
|
||||
}
|
||||
void plActivatorConditionalObject::Write(hsStream* stream, hsResMgr* mgr)
|
||||
{
|
||||
plConditionalObject::Write(stream, mgr);
|
||||
stream->WriteSwap32(fActivators.Count());
|
||||
for (int i = 0; i < fActivators.Count(); i++)
|
||||
mgr->WriteKey(stream, fActivators[i]);
|
||||
}
|
||||
|
||||
void plActivatorConditionalObject::SetActivatorKey(plKey k)
|
||||
{
|
||||
fActivators.Append(k);
|
||||
}
|
||||
|
||||
//
|
||||
// plActivatorActivatorConditional
|
||||
//
|
||||
|
||||
hsBool plActivatorActivatorConditionalObject::MsgReceive(plMessage* msg)
|
||||
{
|
||||
plNotifyMsg* pDetectorMsg = plNotifyMsg::ConvertNoRef(msg);
|
||||
if (pDetectorMsg)
|
||||
{
|
||||
if (!pDetectorMsg->fState && fLogicMod->HasFlag(plLogicModBase::kTriggered))
|
||||
{
|
||||
fLogicMod->RequestUnTrigger();
|
||||
}
|
||||
else
|
||||
if (pDetectorMsg->fState && !fLogicMod->HasFlag(plLogicModBase::kTriggered))
|
||||
{
|
||||
if (!fLogicMod->VerifyConditions( pDetectorMsg ))
|
||||
return false;
|
||||
|
||||
SetSatisfied(true);
|
||||
fLogicMod->RequestTrigger(false);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return plConditionalObject::MsgReceive(msg);
|
||||
}
|
||||
|
||||
|
||||
hsBool plVolActivatorConditionalObject::MsgReceive(plMessage* msg)
|
||||
{
|
||||
plActivatorMsg* pDetectorMsg = plActivatorMsg::ConvertNoRef(msg);
|
||||
if (pDetectorMsg)
|
||||
{
|
||||
for (int i = 0; i < fActivators.Count(); i++)
|
||||
{
|
||||
if (!fLogicMod->VerifyConditions( pDetectorMsg ))
|
||||
return false;
|
||||
|
||||
if ((pDetectorMsg->fTriggerType == plActivatorMsg::kCollideExit) ||
|
||||
(pDetectorMsg->fTriggerType == plActivatorMsg::kVolumeExit) )
|
||||
{
|
||||
fLogicMod->GetNotify()->AddCollisionEvent(false, pDetectorMsg->fHitterObj, pDetectorMsg->fHiteeObj);
|
||||
}
|
||||
if ((pDetectorMsg->fTriggerType == plActivatorMsg::kCollideEnter) ||
|
||||
(pDetectorMsg->fTriggerType == plActivatorMsg::kVolumeEnter) )
|
||||
{
|
||||
fLogicMod->GetNotify()->AddCollisionEvent(true, pDetectorMsg->fHitterObj, pDetectorMsg->fHiteeObj);
|
||||
}
|
||||
SetSatisfied(true);
|
||||
fLogicMod->RequestTrigger(false);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return plConditionalObject::MsgReceive(msg);
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,90 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#ifndef plActivatorConditionalObject_inc
|
||||
#define plActivatorConditionalObject_inc
|
||||
|
||||
#include "../../NucleusLib/pnModifier/plConditionalObject.h"
|
||||
#include "hsTemplates.h"
|
||||
|
||||
class plKey;
|
||||
|
||||
class plActivatorConditionalObject : public plConditionalObject
|
||||
{
|
||||
protected:
|
||||
|
||||
hsTArray<plKey> fActivators;
|
||||
|
||||
public:
|
||||
|
||||
plActivatorConditionalObject();
|
||||
~plActivatorConditionalObject(){;}
|
||||
|
||||
CLASSNAME_REGISTER( plActivatorConditionalObject );
|
||||
GETINTERFACE_ANY( plActivatorConditionalObject, plConditionalObject );
|
||||
|
||||
virtual hsBool MsgReceive(plMessage* msg);
|
||||
|
||||
void Evaluate(){;}
|
||||
void SetActivatorKey(plKey k);
|
||||
void Reset() { SetSatisfied(false); }
|
||||
|
||||
virtual void Read(hsStream* stream, hsResMgr* mgr);
|
||||
virtual void Write(hsStream* stream, hsResMgr* mgr);
|
||||
|
||||
};
|
||||
|
||||
class plActivatorActivatorConditionalObject : public plActivatorConditionalObject
|
||||
{
|
||||
public:
|
||||
|
||||
plActivatorActivatorConditionalObject(){;}
|
||||
~plActivatorActivatorConditionalObject(){;}
|
||||
|
||||
CLASSNAME_REGISTER( plActivatorActivatorConditionalObject );
|
||||
GETINTERFACE_ANY( plActivatorActivatorConditionalObject, plActivatorConditionalObject );
|
||||
|
||||
virtual hsBool MsgReceive(plMessage* msg);
|
||||
|
||||
|
||||
};
|
||||
|
||||
class plVolActivatorConditionalObject : public plActivatorConditionalObject
|
||||
{
|
||||
public:
|
||||
|
||||
plVolActivatorConditionalObject(){;}
|
||||
~plVolActivatorConditionalObject(){;}
|
||||
|
||||
CLASSNAME_REGISTER( plVolActivatorConditionalObject );
|
||||
GETINTERFACE_ANY( plVolActivatorConditionalObject, plActivatorConditionalObject );
|
||||
|
||||
virtual hsBool MsgReceive(plMessage* msg);
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // plActivatorConditionalObject_inc
|
@ -0,0 +1,82 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#include "hsTypes.h"
|
||||
#include "plAnimationEventConditionalObject.h"
|
||||
#include "../pnInputCore/plKeyDef.h"
|
||||
#include "../plModifier/plSimpleModifier.h"
|
||||
#include "../../NucleusLib/pnModifier/plLogicModBase.h"
|
||||
#include "plgDispatch.h"
|
||||
#include "hsResMgr.h"
|
||||
#include "../plMessage/plAnimCmdMsg.h"
|
||||
|
||||
plAnimationEventConditionalObject::plAnimationEventConditionalObject(plKey pTargetModifier) :
|
||||
fTarget(pTargetModifier),
|
||||
fAction(kEventEnd)
|
||||
{
|
||||
}
|
||||
|
||||
hsBool plAnimationEventConditionalObject::MsgReceive(plMessage* msg)
|
||||
{
|
||||
plEventCallbackMsg* pMsg = plEventCallbackMsg::ConvertNoRef(msg);
|
||||
if (pMsg)
|
||||
{
|
||||
SetSatisfied(true);
|
||||
// fLogicMod->RequestTrigger();
|
||||
return true;
|
||||
}
|
||||
return plConditionalObject::MsgReceive(msg);
|
||||
}
|
||||
|
||||
|
||||
void plAnimationEventConditionalObject::SetEvent(const CallbackEvent b, hsScalar time)
|
||||
{
|
||||
plAnimCmdMsg* pMsg = TRACKED_NEW plAnimCmdMsg;
|
||||
pMsg->AddReceiver(fTarget);
|
||||
pMsg->SetSender( GetKey() );
|
||||
|
||||
plEventCallbackMsg* cb = TRACKED_NEW plEventCallbackMsg(GetKey(), b, 0, time);
|
||||
|
||||
pMsg->AddCallback( cb );
|
||||
hsRefCnt_SafeUnRef(cb);
|
||||
pMsg->SetCmd( plAnimCmdMsg::kAddCallbacks );
|
||||
|
||||
plgDispatch::MsgSend( pMsg );
|
||||
}
|
||||
|
||||
void plAnimationEventConditionalObject::Read(hsStream* stream, hsResMgr* mgr)
|
||||
{
|
||||
plConditionalObject::Read(stream, mgr);
|
||||
fTarget = mgr->ReadKey(stream);
|
||||
fAction = (CallbackEvent)stream->ReadSwap32();
|
||||
}
|
||||
|
||||
void plAnimationEventConditionalObject::Write(hsStream* stream, hsResMgr* mgr)
|
||||
{
|
||||
plConditionalObject::Write(stream, mgr);
|
||||
mgr->WriteKey(stream, fTarget);
|
||||
stream->WriteSwap32(fAction);
|
||||
}
|
||||
|
@ -0,0 +1,65 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#ifndef plAnimationEventConditionalObject_inc
|
||||
#define plAnimationEventConditionalObject_inc
|
||||
|
||||
#include "../pnModifier/plConditionalObject.h"
|
||||
#include "../pnInputCore/plKeyDef.h"
|
||||
#include "../pnMessage/plEventCallbackMsg.h" // AnimationEvent's defined here
|
||||
|
||||
|
||||
class plAnimationEventConditionalObject : public plConditionalObject
|
||||
{
|
||||
protected:
|
||||
CallbackEvent fAction;
|
||||
plKey fTarget;
|
||||
public:
|
||||
|
||||
|
||||
plAnimationEventConditionalObject(){;}
|
||||
plAnimationEventConditionalObject(plKey pTargetModifier);
|
||||
~plAnimationEventConditionalObject(){;}
|
||||
|
||||
CLASSNAME_REGISTER( plAnimationEventConditionalObject );
|
||||
GETINTERFACE_ANY( plAnimationEventConditionalObject, plConditionalObject );
|
||||
|
||||
virtual void Read(hsStream* stream, hsResMgr* mgr);
|
||||
virtual void Write(hsStream* stream, hsResMgr* mgr);
|
||||
|
||||
hsBool MsgReceive(plMessage* msg);
|
||||
|
||||
void Evaluate(){;}
|
||||
void Reset() { SetSatisfied(false); }
|
||||
|
||||
void SetEvent(const CallbackEvent b, hsScalar time = 0.0f);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // plAnimationEventConditionalObject_inc
|
@ -0,0 +1,84 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#ifndef plConditionalObjectCreatable_inc
|
||||
#define plConditionalObjectCreatable_inc
|
||||
|
||||
#include "../pnFactory/plCreator.h"
|
||||
|
||||
#include "plANDConditionalObject.h"
|
||||
|
||||
REGISTER_CREATABLE( plANDConditionalObject );
|
||||
|
||||
#include "plORConditionalObject.h"
|
||||
|
||||
REGISTER_CREATABLE( plORConditionalObject );
|
||||
|
||||
#include "plPickedConditionalObject.h"
|
||||
|
||||
REGISTER_CREATABLE( plPickedConditionalObject );
|
||||
|
||||
#include "plActivatorConditionalObject.h"
|
||||
|
||||
REGISTER_CREATABLE( plActivatorConditionalObject );
|
||||
REGISTER_CREATABLE( plActivatorActivatorConditionalObject );
|
||||
REGISTER_CREATABLE( plVolActivatorConditionalObject );
|
||||
|
||||
#include "plKeyPressConditionalObject.h"
|
||||
|
||||
REGISTER_CREATABLE( plKeyPressConditionalObject );
|
||||
|
||||
#include "plAnimationEventConditionalObject.h"
|
||||
|
||||
REGISTER_CREATABLE( plAnimationEventConditionalObject );
|
||||
|
||||
#include "plControlEventConditionalObject.h"
|
||||
|
||||
REGISTER_CREATABLE( plControlEventConditionalObject );
|
||||
|
||||
#include "plObjectInBoxConditionalObject.h"
|
||||
|
||||
REGISTER_CREATABLE( plObjectInBoxConditionalObject );
|
||||
REGISTER_CREATABLE( plVolumeSensorConditionalObject );
|
||||
REGISTER_CREATABLE( plVolumeSensorConditionalObjectNoArbitration );
|
||||
|
||||
#include "plLocalPlayerInBoxConditionalObject.h"
|
||||
|
||||
REGISTER_CREATABLE( plLocalPlayerInBoxConditionalObject );
|
||||
|
||||
#include "plObjectIntersectPlaneConditionalObject.h"
|
||||
|
||||
REGISTER_CREATABLE( plObjectIntersectPlaneConditionalObject );
|
||||
|
||||
#include "plLocalPlayerIntersectPlaneConditionalObject.h"
|
||||
|
||||
REGISTER_CREATABLE( plLocalPlayerIntersectPlaneConditionalObject );
|
||||
|
||||
#include "plFacingConditionalObject.h"
|
||||
|
||||
REGISTER_CREATABLE( plFacingConditionalObject );
|
||||
|
||||
#endif // plConditionalObjectCreatable_inc
|
@ -0,0 +1,70 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#include "hsTypes.h"
|
||||
#include "plControlEventConditionalObject.h"
|
||||
#include "../plPhysical/plDetectorModifier.h"
|
||||
#include "../../NucleusLib/pnModifier/plLogicModBase.h"
|
||||
#include "../plMessage/plInputEventMsg.h"
|
||||
|
||||
plControlEventConditionalObject::plControlEventConditionalObject()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
hsBool plControlEventConditionalObject::MsgReceive(plMessage* msg)
|
||||
{
|
||||
plControlEventMsg* pControlMsg = plControlEventMsg::ConvertNoRef(msg);
|
||||
if( pControlMsg )
|
||||
{
|
||||
if (pControlMsg->GetControlCode() == fControlEvent && pControlMsg->ControlActivated() && !Satisfied() )
|
||||
{
|
||||
SetSatisfied(true);
|
||||
// fLogicMod->RequestTrigger();
|
||||
}
|
||||
else
|
||||
if (pControlMsg->GetControlCode() == fControlEvent && !pControlMsg->ControlActivated() && Satisfied() )
|
||||
{
|
||||
SetSatisfied(false);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return plConditionalObject::MsgReceive(msg);
|
||||
}
|
||||
|
||||
void plControlEventConditionalObject::Read(hsStream* stream, hsResMgr* mgr)
|
||||
{
|
||||
plConditionalObject::Read(stream, mgr);
|
||||
fControlEvent = (ControlEventCode)stream->ReadSwap32();
|
||||
}
|
||||
void plControlEventConditionalObject::Write(hsStream* stream, hsResMgr* mgr)
|
||||
{
|
||||
plConditionalObject::Write(stream, mgr);
|
||||
stream->WriteSwap32((UInt32)fControlEvent);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,60 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#ifndef plControlEventConditionalObject_inc
|
||||
#define plControlEventConditionalObject_inc
|
||||
|
||||
#include "../../NucleusLib/pnModifier/plConditionalObject.h"
|
||||
#include "../../NucleusLib/pnInputCore/plControlEventCodes.h"
|
||||
|
||||
|
||||
class plControlEventConditionalObject : public plConditionalObject
|
||||
{
|
||||
protected:
|
||||
|
||||
|
||||
public:
|
||||
|
||||
plControlEventConditionalObject();
|
||||
~plControlEventConditionalObject(){;}
|
||||
|
||||
CLASSNAME_REGISTER( plControlEventConditionalObject );
|
||||
GETINTERFACE_ANY( plControlEventConditionalObject, plConditionalObject );
|
||||
|
||||
virtual void Read(hsStream* stream, hsResMgr* mgr);
|
||||
virtual void Write(hsStream* stream, hsResMgr* mgr);
|
||||
|
||||
|
||||
hsBool MsgReceive(plMessage* msg);
|
||||
|
||||
void Evaluate(){;}
|
||||
void Reset() { SetSatisfied(false); }
|
||||
|
||||
ControlEventCode fControlEvent;
|
||||
|
||||
};
|
||||
|
||||
#endif // plControlEventConditionalObject_inc
|
@ -0,0 +1,133 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#include "hsTypes.h"
|
||||
#include "plFacingConditionalObject.h"
|
||||
#include "plgDispatch.h"
|
||||
#include "../../NucleusLib/pnModifier/plLogicModBase.h"
|
||||
#include "../plMessage/plActivatorMsg.h"
|
||||
#include "../pnSceneObject/plSceneObject.h"
|
||||
#include "../pnSceneObject/plCoordinateInterface.h"
|
||||
#include "../pnKeyedObject/plKey.h"
|
||||
#include "../pnMessage/plNotifyMsg.h"
|
||||
#include "../pnMessage/plFakeOutMsg.h"
|
||||
#include "../pnNetCommon/plNetApp.h"
|
||||
|
||||
plFacingConditionalObject::plFacingConditionalObject() :
|
||||
fTolerance(-1.0f),
|
||||
fDirectional(false)
|
||||
{
|
||||
SetSatisfied(true);
|
||||
}
|
||||
|
||||
hsBool plFacingConditionalObject::MsgReceive(plMessage* msg)
|
||||
{
|
||||
return plConditionalObject::MsgReceive(msg);
|
||||
}
|
||||
|
||||
|
||||
void plFacingConditionalObject::Write(hsStream* stream, hsResMgr* mgr)
|
||||
{
|
||||
plConditionalObject::Write(stream, mgr);
|
||||
stream->WriteSwap(fTolerance);
|
||||
stream->WriteBool(fDirectional);
|
||||
}
|
||||
|
||||
void plFacingConditionalObject::Read(hsStream* stream, hsResMgr* mgr)
|
||||
{
|
||||
plConditionalObject::Read(stream, mgr);
|
||||
stream->ReadSwap(&fTolerance);
|
||||
fDirectional = stream->ReadBool();
|
||||
}
|
||||
|
||||
hsBool plFacingConditionalObject::Verify(plMessage* msg)
|
||||
{
|
||||
plActivatorMsg* pActivateMsg = plActivatorMsg::ConvertNoRef(msg);
|
||||
if (pActivateMsg && pActivateMsg->fHitterObj)
|
||||
{
|
||||
plSceneObject* pPlayer = plSceneObject::ConvertNoRef(pActivateMsg->fHitterObj->ObjectIsLoaded());
|
||||
if (pPlayer)
|
||||
{
|
||||
hsVector3 playerView = pPlayer->GetCoordinateInterface()->GetLocalToWorld().GetAxis(hsMatrix44::kView);
|
||||
hsVector3 ourView;
|
||||
if (fDirectional)
|
||||
ourView = fLogicMod->GetTarget()->GetCoordinateInterface()->GetLocalToWorld().GetAxis(hsMatrix44::kView);
|
||||
else
|
||||
{
|
||||
hsVector3 v(fLogicMod->GetTarget()->GetCoordinateInterface()->GetLocalToWorld().GetTranslate() - pPlayer->GetCoordinateInterface()->GetLocalToWorld().GetTranslate());
|
||||
ourView = v;
|
||||
ourView.Normalize();
|
||||
}
|
||||
hsScalar dot = playerView * ourView;
|
||||
if (dot >= fTolerance)
|
||||
{
|
||||
fLogicMod->GetNotify()->AddFacingEvent( pActivateMsg->fHitterObj, fLogicMod->GetTarget()->GetKey(), dot, true);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
plFakeOutMsg* pFakeMsg = plFakeOutMsg::ConvertNoRef(msg);
|
||||
if (pFakeMsg && plNetClientApp::GetInstance()->GetLocalPlayerKey())
|
||||
{
|
||||
// sanity check
|
||||
if (!fLogicMod->GetTarget()->GetCoordinateInterface())
|
||||
return false;
|
||||
|
||||
plSceneObject* pPlayer = plSceneObject::ConvertNoRef(plNetClientApp::GetInstance()->GetLocalPlayerKey()->ObjectIsLoaded());
|
||||
if (pPlayer)
|
||||
{
|
||||
hsVector3 playerView = pPlayer->GetCoordinateInterface()->GetLocalToWorld().GetAxis(hsMatrix44::kView);
|
||||
hsVector3 ourView;
|
||||
if (fDirectional)
|
||||
ourView = fLogicMod->GetTarget()->GetCoordinateInterface()->GetLocalToWorld().GetAxis(hsMatrix44::kView);
|
||||
else
|
||||
{
|
||||
hsVector3 v(fLogicMod->GetTarget()->GetCoordinateInterface()->GetLocalToWorld().GetTranslate() - pPlayer->GetCoordinateInterface()->GetLocalToWorld().GetTranslate());
|
||||
ourView = v;
|
||||
ourView.fZ = playerView.fZ;
|
||||
ourView.Normalize();
|
||||
}
|
||||
hsScalar dot = playerView * ourView;
|
||||
if (dot >= fTolerance)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!IsToggle())
|
||||
{
|
||||
fLogicMod->GetNotify()->AddFacingEvent( pPlayer->GetKey(), fLogicMod->GetTarget()->GetKey(), dot, false);
|
||||
fLogicMod->RequestUnTrigger();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#ifndef plFacingConditionalObject_inc
|
||||
#define plFacingConditionalObject_inc
|
||||
|
||||
#include "../../NucleusLib/pnModifier/plConditionalObject.h"
|
||||
|
||||
class plSceneObject;
|
||||
|
||||
class plFacingConditionalObject : public plConditionalObject
|
||||
{
|
||||
protected:
|
||||
hsScalar fTolerance;
|
||||
hsBool fDirectional;
|
||||
|
||||
public:
|
||||
|
||||
plFacingConditionalObject();
|
||||
~plFacingConditionalObject(){;}
|
||||
|
||||
CLASSNAME_REGISTER( plFacingConditionalObject );
|
||||
GETINTERFACE_ANY( plFacingConditionalObject, plConditionalObject );
|
||||
|
||||
hsBool MsgReceive(plMessage* msg);
|
||||
|
||||
void SetTolerance(hsScalar d) { fTolerance = d; }
|
||||
void SetDirectional(hsBool d) { fDirectional = d; }
|
||||
|
||||
virtual hsBool Verify(plMessage* msg);
|
||||
|
||||
void Evaluate(){;}
|
||||
void Reset() { SetSatisfied(true); }
|
||||
|
||||
virtual void Read(hsStream* stream, hsResMgr* mgr);
|
||||
virtual void Write(hsStream* stream, hsResMgr* mgr);
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // plFacingConditionalObject_inc
|
@ -0,0 +1,70 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#include "hsTypes.h"
|
||||
#include "plKeyPressConditionalObject.h"
|
||||
#include "../plPhysical/plDetectorModifier.h"
|
||||
#include "../../NucleusLib/pnModifier/plLogicModBase.h"
|
||||
#include "../plMessage/plInputEventMsg.h"
|
||||
|
||||
plKeyPressConditionalObject::plKeyPressConditionalObject()
|
||||
{
|
||||
SetFlag(kLocalElement); // since it relies on user input
|
||||
}
|
||||
|
||||
hsBool plKeyPressConditionalObject::MsgReceive(plMessage* msg)
|
||||
{
|
||||
plKeyEventMsg* pKeyMsg = plKeyEventMsg::ConvertNoRef(msg);
|
||||
if( pKeyMsg )
|
||||
{
|
||||
if (pKeyMsg && pKeyMsg->GetKeyCode() == fKeyEvent && pKeyMsg->GetKeyDown() && !Satisfied() )
|
||||
{
|
||||
SetSatisfied(true);
|
||||
// fLogicMod->RequestTrigger();
|
||||
}
|
||||
else
|
||||
if (pKeyMsg && pKeyMsg->GetKeyCode() == fKeyEvent && !pKeyMsg->GetKeyDown() && Satisfied() )
|
||||
{
|
||||
SetSatisfied(false);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return plConditionalObject::MsgReceive(msg);
|
||||
}
|
||||
|
||||
void plKeyPressConditionalObject::Read(hsStream* stream, hsResMgr* mgr)
|
||||
{
|
||||
plConditionalObject::Read(stream, mgr);
|
||||
fKeyEvent = (plKeyDef)stream->ReadSwap32();
|
||||
}
|
||||
void plKeyPressConditionalObject::Write(hsStream* stream, hsResMgr* mgr)
|
||||
{
|
||||
plConditionalObject::Write(stream, mgr);
|
||||
stream->WriteSwap32((UInt32)fKeyEvent);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,59 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#ifndef plKeyPressConditionalObject_inc
|
||||
#define plKeyPressConditionalObject_inc
|
||||
|
||||
#include "../../NucleusLib/pnModifier/plConditionalObject.h"
|
||||
#include "../../NucleusLib/pnInputCore/plKeyDef.h"
|
||||
|
||||
|
||||
class plKeyPressConditionalObject : public plConditionalObject
|
||||
{
|
||||
protected:
|
||||
|
||||
plKeyDef fKeyEvent;
|
||||
|
||||
public:
|
||||
|
||||
plKeyPressConditionalObject();
|
||||
~plKeyPressConditionalObject(){;}
|
||||
|
||||
CLASSNAME_REGISTER( plKeyPressConditionalObject );
|
||||
GETINTERFACE_ANY( plKeyPressConditionalObject, plConditionalObject );
|
||||
|
||||
virtual void Read(hsStream* stream, hsResMgr* mgr);
|
||||
virtual void Write(hsStream* stream, hsResMgr* mgr);
|
||||
|
||||
hsBool MsgReceive(plMessage* msg);
|
||||
|
||||
void Evaluate(){;}
|
||||
void Reset() { SetSatisfied(false); }
|
||||
void SetKeyEvent(const plKeyDef k ) { fKeyEvent = k; }
|
||||
|
||||
};
|
||||
|
||||
#endif // plKeyPressConditionalObject_inc
|
@ -0,0 +1,53 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#include "hsTypes.h"
|
||||
#include "plLocalPlayerInBoxConditionalObject.h"
|
||||
#include "../../PubUtilLib/plPhysical/plDetectorModifier.h"
|
||||
#include "../../NucleusLib/pnModifier/plLogicModBase.h"
|
||||
|
||||
plLocalPlayerInBoxConditionalObject::plLocalPlayerInBoxConditionalObject()
|
||||
{
|
||||
// find the player's key here...
|
||||
SetFlag(kLocalElement); // since it relies on the local player
|
||||
}
|
||||
|
||||
hsBool plLocalPlayerInBoxConditionalObject::MsgReceive(plMessage* msg)
|
||||
{
|
||||
/*
|
||||
|
||||
if our target is within the bounds of the object our logic modifier is attached to...
|
||||
|
||||
{
|
||||
SetSatisfied(true);
|
||||
fLogicMod->RequestTrigger();
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
return plConditionalObject::MsgReceive(msg);
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,57 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#ifndef plLocalPlayerInBoxConditionalObject_inc
|
||||
#define plLocalPlayerInBoxConditionalObject_inc
|
||||
|
||||
#include "../../NucleusLib/pnModifier/plConditionalObject.h"
|
||||
|
||||
class plKey;
|
||||
|
||||
class plLocalPlayerInBoxConditionalObject : public plConditionalObject
|
||||
{
|
||||
protected:
|
||||
plKey fPlayer;
|
||||
plKey fBox;
|
||||
|
||||
public:
|
||||
|
||||
plLocalPlayerInBoxConditionalObject();
|
||||
~plLocalPlayerInBoxConditionalObject(){;}
|
||||
|
||||
CLASSNAME_REGISTER( plLocalPlayerInBoxConditionalObject );
|
||||
GETINTERFACE_ANY( plLocalPlayerInBoxConditionalObject, plConditionalObject );
|
||||
|
||||
hsBool MsgReceive(plMessage* msg);
|
||||
|
||||
void SetBox(plKey pKey) { fBox = pKey; }
|
||||
|
||||
void Evaluate(){;}
|
||||
void Reset() { SetSatisfied(false); }
|
||||
|
||||
};
|
||||
|
||||
#endif // plLocalPlayerInBoxConditionalObject_inc
|
@ -0,0 +1,52 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#include "hsTypes.h"
|
||||
#include "plLocalPlayerIntersectPlaneConditionalObject.h"
|
||||
#include "../../PubUtilLib/plPhysical/plDetectorModifier.h"
|
||||
#include "../../NucleusLib/pnModifier/plLogicModBase.h"
|
||||
|
||||
plLocalPlayerIntersectPlaneConditionalObject::plLocalPlayerIntersectPlaneConditionalObject()
|
||||
{
|
||||
SetFlag(kLocalElement); // since it relies on the local player
|
||||
}
|
||||
|
||||
hsBool plLocalPlayerIntersectPlaneConditionalObject::MsgReceive(plMessage* msg)
|
||||
{
|
||||
/*
|
||||
|
||||
if our target is within the bounds of the object our logic modifier is attached to...
|
||||
|
||||
{
|
||||
SetSatisfied(true);
|
||||
fLogicMod->RequestTrigger();
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
return plConditionalObject::MsgReceive(msg);
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,58 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#ifndef plLocalPlayerIntersectPlaneConditionalObject_inc
|
||||
#define plLocalPlayerIntersectPlaneConditionalObject_inc
|
||||
|
||||
#include "../../NucleusLib/pnModifier/plConditionalObject.h"
|
||||
|
||||
class plKey;
|
||||
|
||||
class plLocalPlayerIntersectPlaneConditionalObject : public plConditionalObject
|
||||
{
|
||||
protected:
|
||||
plKey fTarget;
|
||||
plKey fPlane;
|
||||
|
||||
public:
|
||||
|
||||
plLocalPlayerIntersectPlaneConditionalObject();
|
||||
~plLocalPlayerIntersectPlaneConditionalObject(){;}
|
||||
|
||||
CLASSNAME_REGISTER( plLocalPlayerIntersectPlaneConditionalObject );
|
||||
GETINTERFACE_ANY( plLocalPlayerIntersectPlaneConditionalObject, plConditionalObject );
|
||||
|
||||
hsBool MsgReceive(plMessage* msg);
|
||||
|
||||
void SetTarget(plKey pKey) { fTarget = pKey; }
|
||||
void SetPlane(plKey pKey) { fPlane = pKey; }
|
||||
|
||||
void Evaluate(){;}
|
||||
void Reset() { SetSatisfied(false); }
|
||||
|
||||
};
|
||||
|
||||
#endif // plLocalPlayerIntersectPlaneConditionalObject_inc
|
@ -0,0 +1,112 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#include "hsTypes.h"
|
||||
#include "plORConditionalObject.h"
|
||||
#include "../plPhysical/plDetectorModifier.h"
|
||||
#include "hsResMgr.h"
|
||||
#include "../../NucleusLib/pnModifier/plLogicModBase.h"
|
||||
|
||||
#include "../plMessage/plCondRefMsg.h"
|
||||
|
||||
|
||||
plORConditionalObject::plORConditionalObject()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
plORConditionalObject::~plORConditionalObject()
|
||||
{
|
||||
fChildren.SetCountAndZero(0);
|
||||
}
|
||||
|
||||
hsBool plORConditionalObject::MsgReceive(plMessage* msg)
|
||||
{
|
||||
plCondRefMsg* pCondMsg = plCondRefMsg::ConvertNoRef(msg);
|
||||
if (pCondMsg)
|
||||
{
|
||||
fChildren[pCondMsg->fWhich] = plConditionalObject::ConvertNoRef( pCondMsg->GetRef() );
|
||||
fChildren[pCondMsg->fWhich]->SetLogicMod(fLogicMod);
|
||||
return true;
|
||||
}
|
||||
|
||||
return plConditionalObject::MsgReceive(msg);
|
||||
}
|
||||
|
||||
void plORConditionalObject::SetLogicMod(plLogicModBase* pMod)
|
||||
{
|
||||
fLogicMod = pMod;
|
||||
for (int i = 0; i < fChildren.Count(); i++)
|
||||
{
|
||||
if( fChildren[i] )
|
||||
fChildren[i]->SetLogicMod(pMod);
|
||||
}
|
||||
}
|
||||
|
||||
hsBool plORConditionalObject::Satisfied()
|
||||
{
|
||||
for (int i = 0; i < fChildren.Count(); i++)
|
||||
{
|
||||
if (fChildren[i]->Satisfied())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void plORConditionalObject::AddChild(plConditionalObject* pObj)
|
||||
{
|
||||
fChildren.Append(pObj);
|
||||
pObj->SetLogicMod(fLogicMod);
|
||||
}
|
||||
|
||||
void plORConditionalObject::Reset()
|
||||
{
|
||||
for (int i = 0; i < fChildren.Count(); i++)
|
||||
fChildren[i]->Reset();
|
||||
}
|
||||
|
||||
void plORConditionalObject::Read(hsStream* stream, hsResMgr* mgr)
|
||||
{
|
||||
plConditionalObject::Read(stream, mgr);
|
||||
|
||||
plCondRefMsg* refMsg;
|
||||
int n = stream->ReadSwap32();
|
||||
fChildren.SetCountAndZero(n);
|
||||
for(int i = 0; i < n; i++ )
|
||||
{
|
||||
refMsg = TRACKED_NEW plCondRefMsg(GetKey(), i);
|
||||
mgr->ReadKeyNotifyMe(stream,refMsg, plRefFlags::kActiveRef);
|
||||
}
|
||||
}
|
||||
|
||||
void plORConditionalObject::Write(hsStream* stream, hsResMgr* mgr)
|
||||
{
|
||||
plConditionalObject::Write(stream, mgr);
|
||||
|
||||
stream->WriteSwap32(fChildren.GetCount());
|
||||
for( int i = 0; i < fChildren.GetCount(); i++ )
|
||||
mgr->WriteKey(stream, fChildren[i]);
|
||||
}
|
||||
|
@ -0,0 +1,60 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#ifndef plORConditionalObject_inc
|
||||
#define plORConditionalObject_inc
|
||||
|
||||
#include "../../NucleusLib/pnModifier/plConditionalObject.h"
|
||||
#include "hsTemplates.h"
|
||||
|
||||
class plORConditionalObject : public plConditionalObject
|
||||
{
|
||||
protected:
|
||||
hsTArray<plConditionalObject*> fChildren;
|
||||
|
||||
public:
|
||||
|
||||
plORConditionalObject();
|
||||
~plORConditionalObject();
|
||||
|
||||
CLASSNAME_REGISTER( plORConditionalObject );
|
||||
GETINTERFACE_ANY( plORConditionalObject, plConditionalObject );
|
||||
|
||||
virtual void Read(hsStream* stream, hsResMgr* mgr);
|
||||
virtual void Write(hsStream* stream, hsResMgr* mgr);
|
||||
|
||||
virtual hsBool Satisfied();
|
||||
|
||||
virtual hsBool MsgReceive(plMessage* msg);
|
||||
void Evaluate(){;}
|
||||
void Reset();
|
||||
|
||||
virtual void SetLogicMod(plLogicModBase* pMod);
|
||||
void AddChild(plConditionalObject* pObj);
|
||||
|
||||
};
|
||||
|
||||
#endif // plORConditionalObject_inc
|
@ -0,0 +1,432 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#include "hsTypes.h"
|
||||
#include "plObjectInBoxConditionalObject.h"
|
||||
#include "../../PubUtilLib/plPhysical/plDetectorModifier.h"
|
||||
#include "../../NucleusLib/pnModifier/plLogicModBase.h"
|
||||
#include "../../PubUtilLib/plMessage/plActivatorMsg.h"
|
||||
#include "../pnMessage/plNotifyMsg.h"
|
||||
#include "../pnMessage/plFakeOutMsg.h"
|
||||
#include "../pnNetCommon/plNetApp.h"
|
||||
#include "../plAvatar/plArmatureMod.h"
|
||||
#include "../pnSceneObject/plSceneObject.h"
|
||||
|
||||
bool plVolumeSensorConditionalObject::makeBriceHappyVar = true;
|
||||
|
||||
plObjectInBoxConditionalObject::plObjectInBoxConditionalObject() :
|
||||
fCurrentTrigger(nil)
|
||||
{
|
||||
SetSatisfied(true);
|
||||
}
|
||||
|
||||
hsBool plObjectInBoxConditionalObject::MsgReceive(plMessage* msg)
|
||||
{
|
||||
plActivatorMsg* pActivateMsg = plActivatorMsg::ConvertNoRef(msg);
|
||||
if (pActivateMsg)
|
||||
{
|
||||
if (pActivateMsg->fTriggerType == plActivatorMsg::kVolumeEnter)
|
||||
{
|
||||
fInside.Append(pActivateMsg->fHitterObj);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
if (pActivateMsg->fTriggerType == plActivatorMsg::kVolumeExit)
|
||||
{
|
||||
for (int i = 0; i < fInside.Count(); i++)
|
||||
{
|
||||
if (fInside[i] == pActivateMsg->fHitterObj)
|
||||
{
|
||||
fInside.Remove(i);
|
||||
if (pActivateMsg->fHitterObj == fCurrentTrigger && fCurrentTrigger && fLogicMod->HasFlag(plLogicModBase::kTriggered) && !IsToggle())
|
||||
{
|
||||
fCurrentTrigger = nil;
|
||||
fLogicMod->GetNotify()->AddContainerEvent( pActivateMsg->fHiteeObj, pActivateMsg->fHitterObj, false );
|
||||
fLogicMod->RequestUnTrigger();
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
return plConditionalObject::MsgReceive(msg);
|
||||
}
|
||||
|
||||
hsBool plObjectInBoxConditionalObject::Verify(plMessage* msg)
|
||||
{
|
||||
plActivatorMsg* pActivateMsg = plActivatorMsg::ConvertNoRef(msg);
|
||||
if (pActivateMsg)
|
||||
{
|
||||
for (int i = 0; i < fInside.Count(); i++)
|
||||
{
|
||||
if (pActivateMsg->fHitterObj == fInside[i])
|
||||
{
|
||||
fLogicMod->GetNotify()->AddContainerEvent( pActivateMsg->fHiteeObj, pActivateMsg->fHitterObj, true );
|
||||
fCurrentTrigger = pActivateMsg->fHiteeObj;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
plFakeOutMsg* pFakeMsg = plFakeOutMsg::ConvertNoRef(msg);
|
||||
if (pFakeMsg && plNetClientApp::GetInstance()->GetLocalPlayerKey())
|
||||
{
|
||||
for (int i = 0; i < fInside.Count(); i++)
|
||||
{
|
||||
if (plNetClientApp::GetInstance()->GetLocalPlayerKey() == fInside[i])
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// volume sensor conditional
|
||||
//
|
||||
plVolumeSensorConditionalObject::plVolumeSensorConditionalObject() :
|
||||
fTrigNum(-1),
|
||||
fType(0),
|
||||
fFirst(false),
|
||||
fTriggered(false),
|
||||
fIgnoreExtraEnters(true)
|
||||
{
|
||||
SetSatisfied(true);
|
||||
}
|
||||
|
||||
|
||||
hsBool plVolumeSensorConditionalObject::MsgReceive(plMessage* msg)
|
||||
{
|
||||
plActivatorMsg* pActivateMsg = plActivatorMsg::ConvertNoRef(msg);
|
||||
if (pActivateMsg)
|
||||
{
|
||||
// single player hack
|
||||
if (!fLogicMod->HasFlag(plLogicModBase::kRequestingTrigger))
|
||||
fLogicMod->GetNotify()->ClearEvents();
|
||||
|
||||
if (pActivateMsg->fTriggerType == plActivatorMsg::kVolumeEnter)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < fInside.Count(); i++)
|
||||
{
|
||||
if (fInside[i] == pActivateMsg->fHitterObj)
|
||||
{
|
||||
if (fIgnoreExtraEnters)
|
||||
return false; // this is the "correct" way to handle this situation
|
||||
break; // this is for those special situations where, due to some physics oddity, we need to allow the avatar to enter without exiting
|
||||
}
|
||||
}
|
||||
if (i == fInside.Count())
|
||||
fInside.Append(pActivateMsg->fHitterObj);
|
||||
if (makeBriceHappyVar)
|
||||
{
|
||||
plSceneObject *pObj = plSceneObject::ConvertNoRef( pActivateMsg->fHitterObj->ObjectIsLoaded() );
|
||||
if( pObj )
|
||||
{
|
||||
//need to check for human vs quabish type things in here
|
||||
int i;
|
||||
for( i = 0; i < pObj->GetNumModifiers(); i++ )
|
||||
{
|
||||
if (plArmatureMod::ConvertNoRef( pObj->GetModifier(i)))
|
||||
{
|
||||
if (plNetClientApp::GetInstance()->GetLocalPlayerKey() != pActivateMsg->fHitterObj)
|
||||
{
|
||||
plArmatureMod *am=const_cast<plArmatureMod*>( plArmatureMod::ConvertNoRef(pObj->GetModifier(i)));
|
||||
if((am->IsLocalAI())==nil)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
plSynchedObject* syncObj = (plSynchedObject*)pObj;
|
||||
if (syncObj->IsLocallyOwned() != plSynchedObject::kYes)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (fType == kTypeEnter)
|
||||
{
|
||||
fLogicMod->GetNotify()->AddCollisionEvent(true, pActivateMsg->fHitterObj, pActivateMsg->fHiteeObj, false);
|
||||
fLogicMod->RequestTrigger(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
fLogicMod->GetNotify()->AddCollisionEvent(false, pActivateMsg->fHitterObj, pActivateMsg->fHiteeObj, false);
|
||||
fLogicMod->RequestUnTrigger();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else
|
||||
if (pActivateMsg->fTriggerType == plActivatorMsg::kVolumeExit)
|
||||
{
|
||||
for (int i = 0; i < fInside.Count(); i++)
|
||||
{
|
||||
if (fInside[i] == pActivateMsg->fHitterObj)
|
||||
{
|
||||
fInside.Remove(i);
|
||||
if (makeBriceHappyVar)
|
||||
{
|
||||
//need to check for human vs quabish type things in here
|
||||
plSceneObject *pObj = plSceneObject::ConvertNoRef( pActivateMsg->fHitterObj->ObjectIsLoaded() );
|
||||
if( pObj )
|
||||
{
|
||||
int i;
|
||||
for( i = 0; i < pObj->GetNumModifiers(); i++ )
|
||||
{
|
||||
if (plArmatureMod::ConvertNoRef( pObj->GetModifier(i)))
|
||||
{
|
||||
if (plNetClientApp::GetInstance()->GetLocalPlayerKey() != pActivateMsg->fHitterObj)
|
||||
{
|
||||
plArmatureMod *am=const_cast<plArmatureMod*>( plArmatureMod::ConvertNoRef(pObj->GetModifier(i)));
|
||||
if((am->IsLocalAI())==nil)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
plSynchedObject* syncObj = (plSynchedObject*)pObj;
|
||||
if (syncObj->IsLocallyOwned() != plSynchedObject::kYes)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (fType == kTypeExit)
|
||||
{
|
||||
fLogicMod->GetNotify()->AddCollisionEvent(false, pActivateMsg->fHitterObj, pActivateMsg->fHiteeObj, false);
|
||||
fLogicMod->RequestTrigger(false);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
fLogicMod->GetNotify()->AddCollisionEvent(true, pActivateMsg->fHitterObj, pActivateMsg->fHiteeObj, false);
|
||||
fLogicMod->RequestUnTrigger();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
return plConditionalObject::MsgReceive(msg);
|
||||
}
|
||||
|
||||
hsBool plVolumeSensorConditionalObject::Satisfied()
|
||||
{
|
||||
if (fType == kTypeExit && fFirst && !fTriggered)
|
||||
{
|
||||
if (fInside.Count())
|
||||
fTriggered = true;
|
||||
return true;
|
||||
}
|
||||
if (fTriggered)
|
||||
{
|
||||
if (fInside.Count() == 0)
|
||||
fTriggered = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (fTrigNum == -1)
|
||||
return true;
|
||||
if (fInside.Count() == fTrigNum)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
void plVolumeSensorConditionalObject::Read(hsStream* stream, hsResMgr* mgr)
|
||||
{
|
||||
plConditionalObject::Read(stream, mgr);
|
||||
fTrigNum = stream->ReadSwap32();
|
||||
fType = stream->ReadSwap32();
|
||||
fFirst = stream->ReadBool();
|
||||
}
|
||||
void plVolumeSensorConditionalObject::Write(hsStream* stream, hsResMgr* mgr)
|
||||
{
|
||||
plConditionalObject::Write(stream, mgr);
|
||||
stream->WriteSwap32(fTrigNum);
|
||||
stream->WriteSwap32(fType);
|
||||
stream->WriteBool(fFirst);
|
||||
}
|
||||
#include "../pnMessage/plPlayerPageMsg.h"
|
||||
#include "../../NucleusLib/inc/plgDispatch.h"
|
||||
hsBool plVolumeSensorConditionalObjectNoArbitration::MsgReceive(plMessage* msg)
|
||||
{
|
||||
plActivatorMsg* pActivateMsg = plActivatorMsg::ConvertNoRef(msg);
|
||||
if (pActivateMsg)
|
||||
{
|
||||
// single player hack
|
||||
if (!fLogicMod->HasFlag(plLogicModBase::kRequestingTrigger))
|
||||
fLogicMod->GetNotify()->ClearEvents();
|
||||
fHittee= pActivateMsg->fHiteeObj;
|
||||
if (pActivateMsg->fTriggerType == plActivatorMsg::kVolumeEnter)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < fInside.Count(); i++)
|
||||
{
|
||||
if (fInside[i] == pActivateMsg->fHitterObj)
|
||||
{
|
||||
if (fIgnoreExtraEnters)
|
||||
return false; // this is the "correct" way to handle this situation
|
||||
break; // this is for those special situations where, due to some physics oddity, we need to allow the avatar to enter without exiting
|
||||
}
|
||||
}
|
||||
if (i == fInside.Count())
|
||||
fInside.Append(pActivateMsg->fHitterObj);
|
||||
if (makeBriceHappyVar)
|
||||
{
|
||||
plSceneObject *pObj = plSceneObject::ConvertNoRef( pActivateMsg->fHitterObj->ObjectIsLoaded() );
|
||||
if( pObj )
|
||||
{
|
||||
//need to check for human vs quabish type things in here
|
||||
int i;
|
||||
for( i = 0; i < pObj->GetNumModifiers(); i++ )
|
||||
{
|
||||
if (plArmatureMod::ConvertNoRef( pObj->GetModifier(i)))
|
||||
{
|
||||
if (plNetClientApp::GetInstance()->GetLocalPlayerKey() != pActivateMsg->fHitterObj)
|
||||
{
|
||||
plArmatureMod *am=const_cast<plArmatureMod*>( plArmatureMod::ConvertNoRef(pObj->GetModifier(i)));
|
||||
if((am->IsLocalAI())==nil)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
plSynchedObject* syncObj = (plSynchedObject*)pObj;
|
||||
if (syncObj->IsLocallyOwned() != plSynchedObject::kYes)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (fType == kTypeEnter)
|
||||
{
|
||||
fLogicMod->GetNotify()->AddCollisionEvent(true, pActivateMsg->fHitterObj, pActivateMsg->fHiteeObj, false);
|
||||
//fLogicMod->RequestTrigger(false);
|
||||
|
||||
if (!Satisfied())
|
||||
return false;
|
||||
|
||||
fLogicMod->Trigger(false);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
else
|
||||
if (pActivateMsg->fTriggerType == plActivatorMsg::kVolumeExit)
|
||||
{
|
||||
for (int i = 0; i < fInside.Count(); i++)
|
||||
{
|
||||
if (fInside[i] == pActivateMsg->fHitterObj)
|
||||
{
|
||||
fInside.Remove(i);
|
||||
if (makeBriceHappyVar)
|
||||
{
|
||||
//need to check for human vs quabish type things in here
|
||||
plSceneObject *pObj = plSceneObject::ConvertNoRef( pActivateMsg->fHitterObj->ObjectIsLoaded() );
|
||||
if( pObj )
|
||||
{
|
||||
int i;
|
||||
for( i = 0; i < pObj->GetNumModifiers(); i++ )
|
||||
{
|
||||
if (plArmatureMod::ConvertNoRef( pObj->GetModifier(i)))
|
||||
{
|
||||
if (plNetClientApp::GetInstance()->GetLocalPlayerKey() != pActivateMsg->fHitterObj)
|
||||
{
|
||||
plArmatureMod *am=const_cast<plArmatureMod*>( plArmatureMod::ConvertNoRef(pObj->GetModifier(i)));
|
||||
if((am->IsLocalAI())==nil)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
plSynchedObject* syncObj = (plSynchedObject*)pObj;
|
||||
if (syncObj->IsLocallyOwned() != plSynchedObject::kYes)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (fType == kTypeExit)
|
||||
{
|
||||
fLogicMod->GetNotify()->AddCollisionEvent(false, pActivateMsg->fHitterObj, pActivateMsg->fHiteeObj, false);
|
||||
//fLogicMod->RequestTrigger(false);
|
||||
if (!Satisfied())
|
||||
return false;
|
||||
|
||||
fLogicMod->Trigger(false);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
plPlayerPageMsg* page = plPlayerPageMsg::ConvertNoRef(msg);
|
||||
if(page && page->fUnload)
|
||||
{
|
||||
for(int j= 0; j< fInside.Count(); j++)
|
||||
{
|
||||
if(fInside[j] == page->fPlayer)
|
||||
{//this is the one inside
|
||||
if(fHittee)
|
||||
{
|
||||
plSceneObject *so = plSceneObject::ConvertNoRef(fHittee->ObjectIsLoaded());
|
||||
if(so && so->IsLocallyOwned())
|
||||
{
|
||||
if (fType == kTypeExit)
|
||||
{
|
||||
fLogicMod->GetNotify()->AddCollisionEvent(false, page->fPlayer, fHittee, false);
|
||||
//fLogicMod->RequestTrigger(false);
|
||||
if (!Satisfied())
|
||||
return false;
|
||||
fLogicMod->Trigger(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
fInside.Remove(j);
|
||||
}
|
||||
}
|
||||
}
|
||||
return plConditionalObject::MsgReceive(msg);
|
||||
}
|
||||
void plVolumeSensorConditionalObjectNoArbitration::Read(hsStream* stream, hsResMgr* mgr)
|
||||
{
|
||||
plVolumeSensorConditionalObject::Read(stream, mgr);
|
||||
plgDispatch::Dispatch()->RegisterForExactType(plPlayerPageMsg::Index(), GetKey());
|
||||
}
|
@ -0,0 +1,116 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#ifndef plObjectInBoxConditionalObject_inc
|
||||
#define plObjectInBoxConditionalObject_inc
|
||||
|
||||
#include "../../NucleusLib/pnModifier/plConditionalObject.h"
|
||||
#include "hsTemplates.h"
|
||||
|
||||
class plKey;
|
||||
|
||||
class plObjectInBoxConditionalObject : public plConditionalObject
|
||||
{
|
||||
protected:
|
||||
|
||||
hsTArray<plKey> fInside;
|
||||
plKey fCurrentTrigger;
|
||||
|
||||
public:
|
||||
|
||||
plObjectInBoxConditionalObject();
|
||||
~plObjectInBoxConditionalObject(){;}
|
||||
|
||||
CLASSNAME_REGISTER( plObjectInBoxConditionalObject );
|
||||
GETINTERFACE_ANY( plObjectInBoxConditionalObject, plConditionalObject );
|
||||
|
||||
hsBool MsgReceive(plMessage* msg);
|
||||
|
||||
void Evaluate(){;}
|
||||
void Reset() { SetSatisfied(false); }
|
||||
virtual hsBool Satisfied() { return true; }
|
||||
virtual hsBool Verify(plMessage* msg);
|
||||
|
||||
};
|
||||
|
||||
class plVolumeSensorConditionalObject : public plConditionalObject
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
hsTArray<plKey> fInside;
|
||||
int fTrigNum;
|
||||
int fType;
|
||||
hsBool fFirst;
|
||||
hsBool fTriggered;
|
||||
hsBool fIgnoreExtraEnters;
|
||||
public:
|
||||
|
||||
static bool makeBriceHappyVar;
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
kTypeEnter = 1,
|
||||
kTypeExit,
|
||||
};
|
||||
plVolumeSensorConditionalObject();
|
||||
~plVolumeSensorConditionalObject(){;}
|
||||
|
||||
CLASSNAME_REGISTER( plVolumeSensorConditionalObject );
|
||||
GETINTERFACE_ANY( plVolumeSensorConditionalObject, plConditionalObject );
|
||||
|
||||
virtual hsBool MsgReceive(plMessage* msg);
|
||||
|
||||
void Evaluate(){;}
|
||||
void Reset() { SetSatisfied(false); }
|
||||
virtual hsBool Satisfied();
|
||||
void SetType(int i) { fType = i; }
|
||||
|
||||
void SetTrigNum(int i) { fTrigNum = i; }
|
||||
void SetFirst(hsBool b) { fFirst = b; }
|
||||
|
||||
void IgnoreExtraEnters(hsBool ignore = true) {fIgnoreExtraEnters = ignore;}
|
||||
|
||||
virtual void Read(hsStream* stream, hsResMgr* mgr);
|
||||
virtual void Write(hsStream* stream, hsResMgr* mgr);
|
||||
|
||||
};
|
||||
class plVolumeSensorConditionalObjectNoArbitration : public plVolumeSensorConditionalObject
|
||||
{
|
||||
public:
|
||||
plVolumeSensorConditionalObjectNoArbitration ():plVolumeSensorConditionalObject(){;}
|
||||
~plVolumeSensorConditionalObjectNoArbitration (){;}
|
||||
CLASSNAME_REGISTER( plVolumeSensorConditionalObjectNoArbitration );
|
||||
GETINTERFACE_ANY( plVolumeSensorConditionalObjectNoArbitration, plConditionalObject );
|
||||
virtual hsBool MsgReceive(plMessage* msg);
|
||||
virtual void Read(hsStream* stream, hsResMgr* mgr);
|
||||
protected:
|
||||
plKey fHittee;
|
||||
};
|
||||
|
||||
|
||||
#endif // plObjectInBoxConditionalObject_inc
|
@ -0,0 +1,52 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#include "hsTypes.h"
|
||||
#include "plObjectIntersectPlaneConditionalObject.h"
|
||||
#include "../../PubUtilLib/plPhysical/plDetectorModifier.h"
|
||||
#include "../../NucleusLib/pnModifier/plLogicModBase.h"
|
||||
|
||||
plObjectIntersectPlaneConditionalObject::plObjectIntersectPlaneConditionalObject()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
hsBool plObjectIntersectPlaneConditionalObject::MsgReceive(plMessage* msg)
|
||||
{
|
||||
/*
|
||||
|
||||
if our target is within the bounds of the object our logic modifier is attached to...
|
||||
|
||||
{
|
||||
bSatisfied = true;
|
||||
fLogicMod->RequestTrigger();
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
return plConditionalObject::MsgReceive(msg);
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,58 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#ifndef plObjectIntersectPlaneConditionalObject_inc
|
||||
#define plObjectIntersectPlaneConditionalObject_inc
|
||||
|
||||
#include "../../NucleusLib/pnModifier/plConditionalObject.h"
|
||||
|
||||
class plKey;
|
||||
|
||||
class plObjectIntersectPlaneConditionalObject : public plConditionalObject
|
||||
{
|
||||
protected:
|
||||
plKey fTarget;
|
||||
plKey fPlane;
|
||||
|
||||
public:
|
||||
|
||||
plObjectIntersectPlaneConditionalObject();
|
||||
~plObjectIntersectPlaneConditionalObject(){;}
|
||||
|
||||
CLASSNAME_REGISTER( plObjectIntersectPlaneConditionalObject );
|
||||
GETINTERFACE_ANY( plObjectIntersectPlaneConditionalObject, plConditionalObject );
|
||||
|
||||
hsBool MsgReceive(plMessage* msg);
|
||||
|
||||
void SetTarget(plKey pKey) { fTarget = pKey; }
|
||||
void SetPlane(plKey pKey) { fPlane = pKey; }
|
||||
|
||||
void Evaluate(){;}
|
||||
void Reset() { SetSatisfied(false); }
|
||||
|
||||
};
|
||||
|
||||
#endif // plObjectIntersectPlaneConditionalObject_inc
|
@ -0,0 +1,51 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#include "hsTypes.h"
|
||||
#include "plPickedConditionalObject.h"
|
||||
#include "../../PubUtilLib/plPhysical/plDetectorModifier.h"
|
||||
#include "../../NucleusLib/pnModifier/plLogicModBase.h"
|
||||
|
||||
#include "../plMessage/plActivatorMsg.h"
|
||||
|
||||
plPickedConditionalObject::plPickedConditionalObject()
|
||||
{
|
||||
SetFlag(kLocalElement); // since it relies on user input
|
||||
}
|
||||
|
||||
hsBool plPickedConditionalObject::MsgReceive(plMessage* msg)
|
||||
{
|
||||
plActivatorMsg* pDetectorMsg = plActivatorMsg::ConvertNoRef(msg);
|
||||
if (pDetectorMsg && pDetectorMsg->TriggerType() == plActivatorMsg::kPickedTrigger )
|
||||
{
|
||||
SetSatisfied(true);
|
||||
// fLogicMod->RequestTrigger();
|
||||
return true;
|
||||
}
|
||||
return plConditionalObject::MsgReceive(msg);
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,54 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
|
||||
#ifndef plPickedConditionalObject_inc
|
||||
#define plPickedConditionalObject_inc
|
||||
|
||||
#include "../../NucleusLib/pnModifier/plConditionalObject.h"
|
||||
|
||||
class plKey;
|
||||
|
||||
class plPickedConditionalObject : public plConditionalObject
|
||||
{
|
||||
protected:
|
||||
|
||||
|
||||
public:
|
||||
|
||||
plPickedConditionalObject();
|
||||
~plPickedConditionalObject(){;}
|
||||
|
||||
CLASSNAME_REGISTER( plPickedConditionalObject );
|
||||
GETINTERFACE_ANY( plPickedConditionalObject, plConditionalObject );
|
||||
|
||||
hsBool MsgReceive(plMessage* msg);
|
||||
|
||||
void Evaluate(){;}
|
||||
void Reset() { SetSatisfied(false); }
|
||||
|
||||
};
|
||||
|
||||
#endif // plPickedConditionalObject_inc
|
Reference in New Issue
Block a user