本文整理汇总了C++中SmartScriptTable::GetValue方法的典型用法代码示例。如果您正苦于以下问题:C++ SmartScriptTable::GetValue方法的具体用法?C++ SmartScriptTable::GetValue怎么用?C++ SmartScriptTable::GetValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SmartScriptTable
的用法示例。
在下文中一共展示了SmartScriptTable::GetValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DelegateServerHit
//------------------------------------------------------------------------
void CGameRulesMPDamageHandling::DelegateServerHit(IScriptTable* victimScript, const HitInfo& hit, CActor* pVictimActor)
{
SmartScriptTable victimServerScript;
if (victimScript->GetValue("Server", victimServerScript))
{
HSCRIPTFUNCTION pfnOnHit = 0;
if (victimServerScript->GetValue("OnHit", pfnOnHit))
{
bool diedAfterHit = false;
m_pGameRules->CreateScriptHitInfo(m_scriptHitInfo, hit);
if (Script::CallReturn(gEnv->pScriptSystem, pfnOnHit, victimScript, m_scriptHitInfo, diedAfterHit))
{
if (diedAfterHit)
{
// Hit was deadly
if (pVictimActor)
{
ProcessDeath(hit, *pVictimActor);
}
else
{
m_pGameRules->OnEntityKilled(hit);
}
}
if (g_pGameCVars->g_debugHits > 0)
{
LogHit(hit, (g_pGameCVars->g_debugHits > 1), diedAfterHit);
}
}
gEnv->pScriptSystem->ReleaseFunc(pfnOnHit);
}
}
}
示例2: SerializeScript
bool CScriptRMI::SerializeScript( TSerialize ser, IEntity * pEntity )
{
SSerializeFunctionParams p( ser, pEntity );
ScriptHandle hdl( &p );
IScriptTable * pTable = pEntity->GetScriptTable();
if (pTable)
{
SmartScriptTable serTable;
SmartScriptTable synchedTable;
pTable->GetValue( "synched", synchedTable );
if (synchedTable.GetPtr())
{
synchedTable->GetValue( HIDDEN_FIELD, serTable );
if (serTable.GetPtr())
{
IScriptSystem * pScriptSystem = pTable->GetScriptSystem();
pScriptSystem->BeginCall( serTable.GetPtr(), SERIALIZE_FUNCTION );
pScriptSystem->PushFuncParam( serTable );
pScriptSystem->PushFuncParam( hdl );
return pScriptSystem->EndCall();
}
}
}
return true;
}
示例3: ExecuteEffect
//------------------------------------------------------------------------
int CScriptBind_MaterialEffects::ExecuteEffect(IFunctionHandler* pH, int effectId, SmartScriptTable paramsTable)
{
if (effectId == InvalidEffectId)
return pH->EndFunction(false);
// minimalistic implementation.. extend if you need it
SMFXRunTimeEffectParams params;
paramsTable->GetValue("pos", params.pos);
paramsTable->GetValue("normal", params.normal);
paramsTable->GetValue("scale", params.scale);
paramsTable->GetValue("angle", params.angle);
bool res = m_pMFX->ExecuteEffect(effectId, params);
return pH->EndFunction(res);
}
示例4: SetGrab
bool CMultipleGrabHandler::SetGrab(SmartScriptTable &rParams)
{
// NOTE Mrz 20, 2007: <pvl> if we don't find 'params' param in the table,
// we assume that this is an old-style grab param table that's not aware of
// the possibility of multiple objects grabbed simultaneously.
SmartScriptTable grabParamsTable;
if(rParams->GetValue("params",grabParamsTable))
{
bool result = true;
IScriptTable::Iterator iter = grabParamsTable->BeginIteration();
while(grabParamsTable->MoveNext(iter))
{
CAnimatedGrabHandler *handler = new CAnimatedGrabHandler(m_pActor);
SmartScriptTable params;
iter.value.CopyTo(params);
result = handler->SetGrab(params) & result;
m_handlers.push_back(handler);
}
grabParamsTable->EndIteration(iter);
return result;
}
else
{
CAnimatedGrabHandler *handler = new CAnimatedGrabHandler(m_pActor);
m_handlers.push_back(handler);
return handler->SetGrab(rParams);
}
}
示例5: PatchInitialSetup
//-----------------------------------------------------------------------
void CItem::PatchInitialSetup()
{
const char *temp = NULL;
// check if the initial setup accessories has been overridden in the level
SmartScriptTable props;
if(GetEntity()->GetScriptTable() && GetEntity()->GetScriptTable()->GetValue("Properties", props))
{
if(props->GetValue("initialSetup",temp) && temp !=NULL && temp[0]!=0)
{
m_properties.initialSetup = temp;
}
}
//Replace initial setup from weapon xml, with initial setup defined for the entity (if neccesary)
if(!m_properties.initialSetup.empty())
{
m_initialSetup["default"].resize(0);
//Different accessory names are separated by ","
string::size_type lastPos = m_properties.initialSetup.find_first_not_of(",", 0);
string::size_type pos = m_properties.initialSetup.find_first_of(",", lastPos);
while(string::npos != pos || string::npos != lastPos)
{
//Add to initial setup
const char *name = m_properties.initialSetup.substr(lastPos, pos - lastPos).c_str();
m_initialSetup["default"].push_back(name);
lastPos = m_properties.initialSetup.find_first_not_of(",", pos);
pos = m_properties.initialSetup.find_first_of(",", lastPos);
}
}
}
示例6: SetDrop
// NOTE Mrz 21, 2007: <pvl> might need to handle the params the way SetGrab()
// does (separate param table for each of the grabbed objects).
// UPDATE Mrz 26, 2007: <pvl> done
bool CMultipleGrabHandler::SetDrop(SmartScriptTable &rParams)
{
SmartScriptTable dropParamsTable;
if(rParams->GetValue("params",dropParamsTable))
{
bool result = true;
IScriptTable::Iterator iter = dropParamsTable->BeginIteration();
int numGrabHandlers = m_handlers.size();
for(int i=0; dropParamsTable->MoveNext(iter) && i < numGrabHandlers; ++i)
{
SmartScriptTable params;
iter.value.CopyTo(params);
result = m_handlers[i]->SetDrop(params) & result;
}
dropParamsTable->EndIteration(iter);
return result;
}
else
{
bool result = true;
std::vector <CAnimatedGrabHandler *>::iterator it = m_handlers.begin();
std::vector <CAnimatedGrabHandler *>::iterator end = m_handlers.end();
for(; it != end; ++it)
result = (*it)->SetDrop(rParams) & result;
return result;
}
}
示例7: EndAction
//------------------------------------------------------------------------
int CScriptBind_UIAction::EndAction( IFunctionHandler *pH, SmartScriptTable pTable, bool disable, SmartScriptTable arguments )
{
if (!pTable)
{
UIACTION_WARNING( "LUA: EndAction received non-valid script table!");
return pH->EndFunction( false );
}
const char* actionName;
if (pTable->GetValue("__ui_action_name", actionName))
{
IUIAction* pAction = GetAction( actionName );
if ( pAction )
{
SUIArguments args;
if (SUIToLuaConversationHelper::LuaTableToUIArgs(arguments, args))
{
gEnv->pFlashUI->GetUIActionManager()->EndAction( pAction, args );
if (disable)
gEnv->pFlashUI->GetUIActionManager()->EnableAction( pAction, false );
return pH->EndFunction( true );
}
UIACTION_WARNING( "LUA: Failed to end UIAction %s: Invalid arguments", actionName );
return pH->EndFunction( false );
}
}
UIACTION_WARNING( "LUA: Failed to end UIAction: Called from different script than UIAction lua script!" );
return pH->EndFunction( false );
}
示例8: GetEntity
const char *CAnimatedCharacterSample::GetCharacterModelNameFromScriptTable() const
{
IEntity *pEntity = GetEntity();
IScriptTable *pScriptTable = pEntity->GetScriptTable();
if(pScriptTable == NULL)
{
return NULL;
}
SmartScriptTable propertiesTable;
const bool hasPropertiesTable = pScriptTable->GetValue("Properties", propertiesTable);
if(! hasPropertiesTable)
{
return NULL;
}
const char *modelName = NULL;
const bool hasModelName = propertiesTable->GetValue("objModel", modelName);
if(! hasModelName)
{
return NULL;
}
return modelName;
}
示例9: GetTeamRadioTable
static bool GetTeamRadioTable(CGameRules *gr, const string &team_name, SmartScriptTable &out_table)
{
if(!gr)
{
return false;
}
IScriptTable *pTable = gr->GetEntity()->GetScriptTable();
if(!pTable)
{
return false;
}
SmartScriptTable pTeamRadio;
if(!pTable->GetValue("teamRadio", pTeamRadio))
{
return false;
}
if(!pTeamRadio->GetValue(team_name, out_table))
{
return false;
}
return true;
}
示例10: OnHit
//------------------------------------------------------------------------
int CScriptBind_Item::OnHit(IFunctionHandler *pH, SmartScriptTable hitTable)
{
CItem *pItem = GetItem(pH);
if (!pItem)
return pH->EndFunction();
float damage = 0.f;
hitTable->GetValue("damage", damage);
char* damageTypeName = 0;
hitTable->GetValue("type", damageTypeName);
const int hitType = g_pGame->GetGameRules()->GetHitTypeId(damageTypeName);
pItem->OnHit(damage, hitType);
return pH->EndFunction();
}
示例11: Reset
void CDangerousRigidBody::Reset()
{
IScriptTable* pTable = GetEntity()->GetScriptTable();
if (pTable != NULL)
{
SmartScriptTable propertiesTable;
if (pTable->GetValue("Properties", propertiesTable))
{
propertiesTable->GetValue("bCurrentlyDealingDamage", m_dangerous);
propertiesTable->GetValue("bDoesFriendlyFireDamage", m_friendlyFireEnabled);
propertiesTable->GetValue("fDamageToDeal", m_damageDealt);
propertiesTable->GetValue("fTimeBetweenHits", m_timeBetweenHits);
}
}
m_activatorTeam = 0;
m_lastHitTime = 0;
}
示例12: Init
//------------------------------------------------------------------------
bool CVehicleDamageBehaviorBurn::Init(IVehicle* pVehicle, const SmartScriptTable &table)
{
m_pVehicle = pVehicle;
m_isActive = false;
m_damageRatioMin = 1.f;
m_timerId = -1;
m_shooterId = 0;
table->GetValue("damageRatioMin", m_damageRatioMin);
SmartScriptTable burnParams;
if (table->GetValue("Burn", burnParams))
{
burnParams->GetValue("damage", m_damage);
burnParams->GetValue("selfDamage", m_selfDamage);
burnParams->GetValue("interval", m_interval);
burnParams->GetValue("radius", m_radius);
m_pHelper = NULL;
char* pHelperName = NULL;
if (burnParams->GetValue("helper", pHelperName))
m_pHelper = m_pVehicle->GetHelper(pHelperName);
return true;
}
return false;
}
示例13: SetupEntity
void CVicinityDependentObjectMover::SetupEntity()
{
const char* szModelName = VICINITYDEPENDENTOBJECTMOVER_MODEL_NORMAL;
float fMoveToDistance = 10.0f;
float fAreaTriggerRange = 10.0f;
float fBackAreaTriggerRange = 10.0f;
float fForceMoveCompleteDistance = 1.0f;
IEntity* pEntity = GetEntity();
CRY_ASSERT( pEntity != NULL );
IScriptTable* pScriptTable = pEntity->GetScriptTable();
if ( pScriptTable != NULL )
{
SmartScriptTable propertiesTable;
if ( pScriptTable->GetValue( "Properties", propertiesTable) )
{
propertiesTable->GetValue( "objModel", szModelName );
propertiesTable->GetValue( "fMoveToDistance", fMoveToDistance );
propertiesTable->GetValue( "fMoveToSpeed", m_fMoveToSpeed );
propertiesTable->GetValue( "fMoveBackSpeed", m_fMoveBackSpeed );
propertiesTable->GetValue( "fAreaTriggerRange", fAreaTriggerRange );
propertiesTable->GetValue( "fBackAreaTriggerRange", fBackAreaTriggerRange );
propertiesTable->GetValue( "fForceMoveCompleteDistance", fForceMoveCompleteDistance );
propertiesTable->GetValue( "bUseAreaTrigger", m_bUseAreaTrigger );
propertiesTable->GetValue( "bDisableAreaTriggerOnMoveComplete", m_bDisableAreaTriggerOnMoveComplete );
}
}
m_fMoveToDistance = fMoveToDistance;
m_fMoveToDistanceSq = fMoveToDistance*fMoveToDistance;
m_fAreaTriggerRange = fAreaTriggerRange;
m_fAreaTriggerRangeSq = fAreaTriggerRange*fAreaTriggerRange;
m_fBackAreaTriggerRange = fBackAreaTriggerRange;
m_fBackAreaTriggerRangeSq = fBackAreaTriggerRange*fBackAreaTriggerRange;
m_fForceMoveCompleteDistanceSq = fForceMoveCompleteDistance*fForceMoveCompleteDistance;
// Load model
pEntity->LoadGeometry( VICINITYDEPENDENTOBJECTMOVER_MODEL_NORMAL_SLOT, szModelName );
// Draw slot and physicalize it
DrawSlot( VICINITYDEPENDENTOBJECTMOVER_MODEL_NORMAL_SLOT, true );
SEntityPhysicalizeParams physicalizeParams;
physicalizeParams.nSlot = VICINITYDEPENDENTOBJECTMOVER_MODEL_NORMAL_SLOT;
physicalizeParams.type = PE_RIGID;
physicalizeParams.mass = 0;
GetEntity()->Physicalize( physicalizeParams );
}
示例14: Init
//------------------------------------------------------------------------
bool CShake::Init(IGameObject *pGameObject)
{
SetGameObject(pGameObject);
//Initialize default values before (in case ScriptTable fails)
m_radius = 30.0f;
m_shake = 0.05f;
SmartScriptTable props;
IScriptTable* pScriptTable = GetEntity()->GetScriptTable();
if(!pScriptTable || !pScriptTable->GetValue("Properties", props))
return false;
props->GetValue("Radius", m_radius);
props->GetValue("Shake", m_shake);
return true;
}
示例15: RegisterCharacterTargetInfo
void CAutoAimManager::RegisterCharacterTargetInfo(const CActor& targetActor, const SAutoaimTargetRegisterParams& registerParams)
{
SAutoaimTarget aimTarget;
aimTarget.entityId = targetActor.GetEntityId();
aimTarget.pActorWeak = targetActor.GetWeakPtr();
aimTarget.fallbackOffset = registerParams.fallbackOffset;
aimTarget.primaryBoneId = registerParams.primaryBoneId;
aimTarget.physicsBoneId = registerParams.physicsBoneId;
aimTarget.secondaryBoneId = registerParams.secondaryBoneId;
aimTarget.innerRadius = registerParams.innerRadius;
aimTarget.outerRadius = registerParams.outerRadius;
aimTarget.snapRadius = registerParams.snapRadius;
aimTarget.snapRadiusTagged = registerParams.snapRadiusTagged;
if (!gEnv->bMultiplayer)
{
IEntity* pTargetEntity = targetActor.GetEntity();
aimTarget.aiFaction = IFactionMap::InvalidFactionID;
//Instance properties, other stuff could be added here easily (grab enemy, sliding hit, etc)
SmartScriptTable props;
SmartScriptTable propsPlayerInteractions;
IScriptTable* pScriptTable = pTargetEntity->GetScriptTable();
if (pScriptTable && pScriptTable->GetValue("Properties", props))
{
if (props->GetValue("PlayerInteractions", propsPlayerInteractions))
{
int stealhKill = 0;
if (propsPlayerInteractions->GetValue("bStealthKill", stealhKill) && (stealhKill != 0))
{
aimTarget.SetFlag(eAATF_StealthKillable);
}
int canBeGrabbed = 0;
if (propsPlayerInteractions->GetValue("bCanBeGrabbed", canBeGrabbed) && (canBeGrabbed != 0))
{
aimTarget.SetFlag(eAATF_CanBeGrabbed);
}
}
}
}
m_autoaimTargets.push_back(aimTarget);
}