Example #1
0
bool ShouldSaveEntityClass(IEntity* pEntity)
{
	typedef std::vector<string> TClassesToNotSave;
	static TClassesToNotSave classList;
	if(classList.empty())
	{
		classList.reserve(15);
		classList.push_back("AIAnchor");
		classList.push_back("AmbientVolume");
		classList.push_back("AreaBox");
		classList.push_back("DecalPlacer");
		classList.push_back("GrabableLedge");
		classList.push_back("Light");
		classList.push_back("MissionObjective");
		classList.push_back("MusicEndTheme");
		classList.push_back("MusicMoodSelector");
		classList.push_back("MusicThemeSelector");
		classList.push_back("ParticleEffect");
		classList.push_back("RigidBodyEx");
		classList.push_back("SmartObject");
		classList.push_back("TacticalEntity");
		classList.push_back("TagPoint");
	}

	if(stl::find(classList, CONST_TEMP_STRING(pEntity->GetClass()->GetName())))
		return false;

	// default to saving for now
	return true;
}
Example #2
0
		void Enter(const char* vehicle, const CTimeValue& t)
		{
			if(m_curVehicle != m_vehicles.end() && m_curVehicle->m_name == vehicle)//entered current vehicle
			{
				return;
			}
			//find it and add if needed
			TVehicles::iterator it = std::lower_bound(m_vehicles.begin(), m_vehicles.end(), CONST_TEMP_STRING(vehicle), SVehicleCompare());
			if(it == m_vehicles.end())
			{
				m_curVehicle = m_vehicles.insert(m_vehicles.end(), SVehicle(vehicle));
			}
			else
			{
				if(it->m_name == vehicle)
				{
					m_curVehicle = it;
				}
				else
				{
					m_curVehicle = m_vehicles.insert(it, SVehicle(vehicle));
				}
			}
			m_inVehicle = true;
			m_enteredVehicle = t;
		}
Example #3
0
		void SelectWeapon(const char* name, const CTimeValue& time)
		{
			if(m_curWeapon != m_weapons.end() && m_curWeapon->m_name == name)//entered current vehicle
			{
				return;
			}
			DeselectWeapon(time);//deselect old one
			//find it and add if needed
			TWeapons::iterator it = std::lower_bound(m_weapons.begin(), m_weapons.end(), CONST_TEMP_STRING(name), SWeaponCompare());
			if(it == m_weapons.end())
			{
				m_curWeapon = m_weapons.insert(m_weapons.end(), SWeapon(name));
			}
			else
			{
				if(it->m_name == name)
				{
					m_curWeapon = it;
				}
				else
				{
					m_curWeapon = m_weapons.insert(it, SWeapon(name));
				}
			}
			m_selected = time;
		}
Example #4
0
//------------------------------------------------------------------------
bool CVehiclePartAnimated::ChangeChildState(CVehiclePartAnimatedJoint* pPart, EVehiclePartState state, int flags)
{
	// only handle range between intact and destroyed
	if (state > pPart->GetState() && (state < eVGS_Damaged1 || state >= eVGS_Destroyed))
		return false;

	if (state < pPart->GetState() && pPart->GetState() >= eVGS_Destroyed)
		return false;

	int jointId = pPart->GetJointId();

	if (pPart->GetState() == eVGS_Default)
	{
		ISkeletonPose* pSkeletonPose = m_pCharInstance ? m_pCharInstance->GetISkeletonPose() : NULL;

		if (IStatObj* pStatObjIntact = pSkeletonPose ? pSkeletonPose->GetStatObjOnJoint(jointId) : NULL)
		{
			IDefaultSkeleton &rIDefaultSkeleton = m_pCharInstance->GetIDefaultSkeleton();
			const char*       jointName         = rIDefaultSkeleton.GetJointNameByID(jointId);

			if (m_intactStatObjs.find(CONST_TEMP_STRING(jointName)) == m_intactStatObjs.end())
				m_intactStatObjs.insert(TStringStatObjMap::value_type(jointName, pStatObjIntact));
		}
	}

	if (m_jointParts.find(pPart->GetName()) == m_jointParts.end())
		m_jointParts.insert(TStringVehiclePartMap::value_type(pPart->GetName(), pPart));

	IStatObj* pStatObj = GetGeometryForState(pPart, state);

	if (pStatObj)
		SetCGASlot(jointId, pStatObj, (flags & eVPSF_Physicalize) != 0);

	return true;
}
TMFXEffectId CMaterialEffects::GetEffectId(const char *customName, int surfaceIndex2)
{
	if (!CMaterialEffectsCVars::Get().mfx_Enable)
		return InvalidEffectId;

	const TIndex idx1 = stl::find_in_map(m_customConvert, CONST_TEMP_STRING(customName), 0);
	const TIndex idx2 = SurfaceIdToMatrixEntry(surfaceIndex2);

#ifdef MATERIAL_EFFECTS_DEBUG
	TMFXEffectId effectId = InternalGetEffectId(idx1, idx2);

	if (CMaterialEffectsCVars::Get().mfx_DebugVisual)
	{
		if (effectId != InvalidEffectId)
		{
			m_pVisualDebug->AddLastSearchHint(effectId, customName, surfaceIndex2);
		}
	}

	return effectId;
#else
	return InternalGetEffectId(idx1, idx2);
#endif

}
//------------------------------------------------------------------------
bool CInventory::AreItemsInSameSlot(const char* itemClass1, const char* itemClass2) const
{
	const char* category1 = m_pGameFrameWork->GetIItemSystem()->GetItemCategory(itemClass1);
	if (!category1 || category1[0]=='\0')
		return false;

	const char* category2 = m_pGameFrameWork->GetIItemSystem()->GetItemCategory(itemClass2);
	if (!category2 || category2[0]=='\0')
		return false;

	TCategoriesToSlot::const_iterator cit1 = m_stats.categoriesToSlot.find(CONST_TEMP_STRING(category1));
	TCategoriesToSlot::const_iterator cit2 = m_stats.categoriesToSlot.find(CONST_TEMP_STRING(category2));
	TCategoriesToSlot::const_iterator end = m_stats.categoriesToSlot.end();

	return ((cit1 != end) && (cit2 != end) && (cit1->second == cit2->second));
}
Example #7
0
//------------------------------------------------------------------------
IZoomMode *CWeaponSystem::CreateZoomMode(const char *name)
{
	TZoomModeRegistry::iterator it = m_zmregistry.find(CONST_TEMP_STRING(name));
	if (it != m_zmregistry.end())
		return it->second();
	return 0;
}
Example #8
0
//-------------------------------------------------------------------------
IWeaponSharedData *CWeaponSystem::CreateFireModeData(const char *name)
{
	TWeaponSharedDataRegistry::iterator it = m_fmDataRegistry.find(CONST_TEMP_STRING(name));

	if(it != m_fmDataRegistry.end())
		return it->second();

	return 0;
}
Example #9
0
IEntityClass* CEntityClassRegistry::FindClass( const char *sClassName ) const
{
	ClassNameMap::const_iterator it = m_mapClassName.find(CONST_TEMP_STRING(sClassName));

	if(it==m_mapClassName.end())
		return 0;

	return it->second;
}
Example #10
0
EffectId CEffectSystem::GetEffectId(const char* name)
{
    TNameToId::iterator i = m_nameToId.find(CONST_TEMP_STRING(name));

    if (i == m_nameToId.end())
        return -1;

    return (*i).second;
}
//------------------------------------------------------------------------
bool CInventory::IsAvailableSlotForItemCategory(const char* itemCategory) const
{
	TCategoriesToSlot::const_iterator catToSlotCit = m_stats.categoriesToSlot.find(CONST_TEMP_STRING(itemCategory));
	if (catToSlotCit == m_stats.categoriesToSlot.end())
		return true;

	const SSlotInfo& slotInfo = m_stats.slotsInfo[catToSlotCit->second];

	return (slotInfo.maxCapacity > slotInfo.count);
}
Example #12
0
//------------------------------------------------------------------------
// get the value of an attribute. if not specified optionally lookup in default profile
bool CPlayerProfile::GetAttribute(const char* name, TFlowInputData& val, bool bUseDefaultFallback) const
{
	TAttributeMap::const_iterator iter = m_attributeMap.find(CONST_TEMP_STRING(name));
	if (iter != m_attributeMap.end())
	{
		val = iter->second;
		return true;
	}
	if (bUseDefaultFallback && !IsDefault())
	{
		const TAttributeMap& defaultMap = GetDefaultAttributeMap();
		TAttributeMap::const_iterator iter2 = defaultMap.find(CONST_TEMP_STRING(name));
		if (iter2 != defaultMap.end())
		{
			val = iter2->second;
			return true;
		}
	}
	return false;
}
Example #13
0
		void Kill(const char* name)
		{
			if(m_curWeapon!=m_weapons.end() && m_curWeapon->m_name == name)
			{
				m_curWeapon->m_kills++;
			}
			else
			{
				TWeapons::iterator it = std::lower_bound(m_weapons.begin(), m_weapons.end(), CONST_TEMP_STRING(name), SWeaponCompare());
				if(it != m_weapons.end() && it->m_name == name)
					it->m_kills++;
			}
		}
Example #14
0
//------------------------------------------------------------------------
// re-set attribute to default value (basically removes it from this profile)
bool CPlayerProfile::ResetAttribute(const char* name)
{
	if (IsDefault())
		return false;

	const TAttributeMap& defaultMap = GetDefaultAttributeMap();
	// resetting means deleting from this profile and using the default value
	// but: if no entry in default map, keep it
	if (defaultMap.find(CONST_TEMP_STRING(name)) != defaultMap.end())
	{
		TAttributeMap::size_type count = m_attributeMap.erase(name);
		return count > 0;
	}
	return false;
}
Example #15
0
//========================================================
CWeaponSharedParams *CWeaponSharedParamsList::GetSharedParams(const char *className, bool create)
{
    TSharedParamsMap::iterator it=m_params.find(CONST_TEMP_STRING(className));
    if (it!=m_params.end())
        return it->second;

    if (create)
    {
        CWeaponSharedParams *params=new CWeaponSharedParams();
        m_params.insert(TSharedParamsMap::value_type(className, params));

        return params;
    }

    return 0;
}
CInventory::EInventorySlots CInventory::GetSlotFromEntityID( EntityId entityID ) const
{
	IEntity* pEntity = gEnv->pEntitySystem->GetEntity(entityID);

	if (pEntity)
	{
		const char* category = m_pGameFrameWork->GetIItemSystem()->GetItemCategory(pEntity->GetClass()->GetName());

		if (!category || category[0]=='\0')
			return eInventorySlot_Last;

		TCategoriesToSlot::const_iterator catToSlotCit = m_stats.categoriesToSlot.find(CONST_TEMP_STRING(category));
		if (catToSlotCit == m_stats.categoriesToSlot.end())
			return eInventorySlot_Last;

		return catToSlotCit->second;
	}

	return eInventorySlot_Last;
}
Example #17
0
		void Damage( const char* name, float val )
		{
			TWeapons::iterator it = std::lower_bound(m_weapons.begin(), m_weapons.end(), CONST_TEMP_STRING(name), SWeaponCompare());
			if(it != m_weapons.end() && it->m_name == name)
				it->m_damage+= val;
		}
Example #18
0
TMFXContainerPtr CMFXLibrary::FindEffectContainer( const char* effectName ) const
{
	TEffectContainersMap::const_iterator it = m_effectContainers.find(CONST_TEMP_STRING(effectName));

	return (it != m_effectContainers.end()) ? it->second : TMFXContainerPtr(NULL);
}
Example #19
0
//------------------------------------------------------------------------
bool CWeaponSystem::ScanXML(XmlNodeRef &root, const char *xmlFile)
{
	MEMSTAT_CONTEXT_FMT(EMemStatContextTypes::MSC_Other, 0, "Weapon xml (%s)", xmlFile);

	if(strcmpi(root->getTag(), "ammo"))
		return false;

	const char *name = root->getAttr("name");

	if(!name)
	{
		GameWarning("Missing ammo name in XML '%s'! Skipping...", xmlFile);
		return false;
	}

	const char *className = root->getAttr("class");

	if(!className)
	{
		GameWarning("Missing ammo class in XML '%s'! Skipping...", xmlFile);
		return false;
	}

	TProjectileRegistry::iterator it = m_projectileregistry.find(CONST_TEMP_STRING(className));

	if(it == m_projectileregistry.end())
	{
		GameWarning("Unknown ammo class '%s' specified in XML '%s'! Skipping...", className, xmlFile);
		return false;
	}

	const char *scriptName = root->getAttr("script");
	IEntityClassRegistry::SEntityClassDesc classDesc;
	classDesc.sName = name;
	classDesc.sScriptFile = scriptName?scriptName:"";
	//classDesc.pUserProxyData = (void *)it->second;
	//classDesc.pUserProxyCreateFunc = &CreateProxy<CProjectile>;
	classDesc.flags |= ECLF_INVISIBLE;

	IEntityClass *pClass = gEnv->pEntitySystem->GetClassRegistry()->FindClass(name);

	if(!m_reloading && !pClass)
	{
		m_pGame->GetIGameFramework()->GetIGameObjectSystem()->RegisterExtension(name, it->second, &classDesc);
		pClass = gEnv->pEntitySystem->GetClassRegistry()->FindClass(name);
		assert(pClass);
	}


	TAmmoTypeParams::iterator ait=m_ammoparams.find(pClass);

	if(ait==m_ammoparams.end())
	{
		std::pair<TAmmoTypeParams::iterator, bool> result = m_ammoparams.insert(TAmmoTypeParams::value_type(pClass, SAmmoTypeDesc()));
		ait=result.first;
	}

	const char *configName = root->getAttr("configuration");

	IItemParamsNode *params = m_pItemSystem->CreateParams();
	params->ConvertFromXML(root);

	SAmmoParams *pAmmoParams=new SAmmoParams(params, pClass);

	SAmmoTypeDesc &desc=ait->second;

	if(!configName || !configName[0])
	{
		if(desc.params)
			delete desc.params;

		desc.params=pAmmoParams;
	}
	else
		desc.configurations.insert(std::make_pair<string, const SAmmoParams *>(configName, pAmmoParams));

	return true;
}
Example #20
0
void COptionsManager::CCVarSink::OnElementFound(ICVar *pCVar)
{
	if (pCVar == 0)
		return;

	CryFixedStringT<128> szLine = pCVar->GetName();
	CryFixedStringT<128> szValue = pCVar->GetString();

	// only save if we have an option to it
	std::map<string, SOptionEntry>::const_iterator iter = m_pOptionsManager->m_profileOptions.find(CONST_TEMP_STRING(pCVar->GetName()));
	if (iter == m_pOptionsManager->m_profileOptions.end())
		return;
	const SOptionEntry& entry = iter->second;
	if (entry.bWriteToConfig == false)
		return;

	size_t pos;

	// replace \ with \\ 
	pos = 1;
	for(;;)
	{
		pos = szValue.find_first_of("\\", pos);

		if (pos == CryFixedStringT<128>::npos)
		{
			break;
		}

		szValue.replace(pos, 1, "\\\\", 2);
		pos+=2;
	}

	// replace " with \" 
	pos = 1;
	for(;;)
	{
		pos = szValue.find_first_of("\"", pos);

		if (pos == CryFixedStringT<128>::npos)
		{
			break;
		}

		szValue.replace(pos, 1, "\\\"", 2);
		pos+=2;
	}

	if(pCVar->GetType()==CVAR_STRING)
		szLine += " = \"" + szValue + "\"\r\n";
	else
		szLine += " = " + szValue + "\r\n";

	fputs(szLine.c_str(), m_pFile);
}
//----------------------------------------------------------------------
IInventory::EInventorySlots CInventory::GetSlotForItemCategory(const char* itemCategory) const
{
	TCategoriesToSlot::const_iterator cit1 = m_stats.categoriesToSlot.find(CONST_TEMP_STRING(itemCategory));

	return (cit1 != m_stats.categoriesToSlot.end()) ? cit1->second : IInventory::eInventorySlot_Last;
}
Example #22
0
//------------------------------------------------------------------------
bool CVehiclePartAnimated::ChangeState(EVehiclePartState state, int flags)
{
	if ((state == eVGS_Default) && m_initialiseOnChangeState)
	{
		// Initialise!
		// Having to do this because of the way the glass code
		// swaps a cstatobj. The way the vehicle code stores its
		// statobj in m_intactStatObjs is going to need reviewing
		if (m_pCharInstance)
		{
			ISkeletonPose*    pSkeletonPose                     = m_pCharInstance->GetISkeletonPose();
			IDefaultSkeleton &rIDefaultSkeleton                 = m_pCharInstance->GetIDefaultSkeleton();
			ISkeletonPose*    pSkeletonPoseDestroyed            = m_pCharInstanceDestroyed ? m_pCharInstanceDestroyed->GetISkeletonPose() : NULL;
			IDefaultSkeleton* pICharacterModelSkeletonDestroyed = m_pCharInstanceDestroyed ? &m_pCharInstanceDestroyed->GetIDefaultSkeleton() : NULL;
			if (pSkeletonPose)
			{
				const bool bDestroyedSkelExists = pSkeletonPoseDestroyed && pICharacterModelSkeletonDestroyed;
				for (uint32 i = 0; i < rIDefaultSkeleton.GetJointCount(); i++)
				{
					if (IStatObj* pStatObjIntact = pSkeletonPose->GetStatObjOnJoint(i))
					{
						const char* jointName = rIDefaultSkeleton.GetJointNameByID(i);

						if (m_intactStatObjs.find(CONST_TEMP_STRING(jointName)) == m_intactStatObjs.end())
						{
							m_intactStatObjs.insert(TStringStatObjMap::value_type(jointName, pStatObjIntact));
						}

						// tell the streaming engine to stream destroyed version together with non destroyed
						if (bDestroyedSkelExists && i < pICharacterModelSkeletonDestroyed->GetJointCount())
						{
							if (IStatObj* pStatObjIntactDestroyed = pSkeletonPoseDestroyed->GetStatObjOnJoint(i))
							{
								pStatObjIntact->SetStreamingDependencyFilePath(pStatObjIntactDestroyed->GetFilePath());
							}
						}
					}
				}
			}
		}
		m_initialiseOnChangeState = false;
	}

	bool change = CVehiclePartBase::ChangeState(state, flags);

	if (state == eVGS_Default && !change)
	{
		// need to restore state if one of the children is in higher state
		EVehiclePartState maxState = GetMaxState();

		if (maxState > m_state)
			change = true;
	}

	if (!change)
	{
		return false;
	}

	if (state == eVGS_Destroyed)
	{
		if (m_ignoreDestroyedState)
			return false;

		if (m_pCharInstance && m_pCharInstanceDestroyed)
		{
			ISkeletonPose*    pSkeletonPose     = m_pCharInstance->GetISkeletonPose();
			IDefaultSkeleton &rIDefaultSkeleton = m_pCharInstance->GetIDefaultSkeleton();
			if (pSkeletonPose)
			{
				IMaterial* pDestroyedMaterial = m_pVehicle->GetDestroyedMaterial();

				for (uint32 i = 0; i < rIDefaultSkeleton.GetJointCount(); i++)
				{
					if (IStatObj* pStatObjIntact = pSkeletonPose->GetStatObjOnJoint(i))
					{
						const char* jointName = rIDefaultSkeleton.GetJointNameByID(i);
						IStatObj*   pStatObj  = GetDestroyedGeometry(jointName);

						// sets new StatObj to joint, if null, removes it.
						// object whose name includes "proxy" are not removed.
						if (pStatObj || !strstr(jointName, "proxy"))
						{
							SetCGASlot(i, pStatObj);

							if (pStatObj && !pDestroyedMaterial)
							{
								if (IMaterial* pMaterial = pStatObj->GetMaterial())
									SetMaterial(pMaterial);
							}

#if ENABLE_VEHICLE_DEBUG
							if (IsDebugParts())
							{
								CryLog("swapping StatObj on joint %u (%s) -> %s", i, jointName, pStatObj ? pStatObj->GetGeoName() : "<NULL>");
							}
#endif
						}
					}
				}

				FlagSkeleton(pSkeletonPose, rIDefaultSkeleton);

				for (TStringVehiclePartMap::iterator ite = m_jointParts.begin(); ite != m_jointParts.end(); ++ite)
				{
					IVehiclePart* pPart = ite->second;
					pPart->ChangeState(state, flags | eVPSF_Physicalize);
				}

				CryCharAnimationParams animParams;
				animParams.m_nFlags |= CA_LOOP_ANIMATION;
				// pSkeleton->SetRedirectToLayer0(1);
				// pSkeleton->StartAnimation("Default",0,  0,0, animParams);  // [MR: commented out on Ivos request]

				if (pDestroyedMaterial)
				{
					SetMaterial(pDestroyedMaterial);
				}
			}
		}
	}
	else if (state == eVGS_Default)
	{
		if (m_pCharInstance && m_pCharInstanceDestroyed)
		{
			// reset material (in case we replaced it with the destroyed material)
			IMaterial* pMaterial = m_pVehicle->GetPaintMaterial();
			if (!pMaterial)
			{
				// no paint, so revert to the material already set on the character
				pMaterial = m_pCharInstance->GetIMaterial();
			}
			if (pMaterial)
			{
				SetMaterial(pMaterial);
			}

			IDefaultSkeleton &rIDefaultSkeleton = m_pCharInstance->GetIDefaultSkeleton();
			{
				for (TStringStatObjMap::iterator ite = m_intactStatObjs.begin(); ite != m_intactStatObjs.end(); ++ite)
				{
					const string &jointName = ite->first;
					IStatObj*     pStatObj  = ite->second;

					int16 jointId = rIDefaultSkeleton.GetJointIDByName(jointName.c_str());
					if (jointId > -1)
					{
						// if compound StatObj (from deformation), use first SubObj for restoring
						if (pStatObj != NULL)
						{
							if (!pStatObj->GetRenderMesh() && pStatObj->GetSubObjectCount() > 0)
							{
								pStatObj = pStatObj->GetSubObject(0)->pStatObj;
							}

							SetCGASlot(jointId, pStatObj);

#if ENABLE_VEHICLE_DEBUG
							if (IsDebugParts())
								CryLog("restoring StatObj on joint %i (%s) -> %s", jointId, jointName.c_str(), pStatObj ? pStatObj->GetGeoName() : "<NULL>");
#endif
						}

						TStringVehiclePartMap::iterator it = m_jointParts.find(jointName);
						if (it != m_jointParts.end())
						{
							it->second->ChangeState(state, flags & ~eVPSF_Physicalize | eVPSF_Force);
						}
					}
				}
				flags |= eVPSF_Physicalize;
			}
		}
	}

	m_state = state;

	// physicalize after all parts have been restored
	if (flags & eVPSF_Physicalize && GetEntity()->GetPhysics())
	{
		Physicalize();
		for (TStringVehiclePartMap::iterator it = m_jointParts.begin(); it != m_jointParts.end(); ++it)
		{
			it->second->Physicalize();
		}
	}

	return true;
}
Example #23
0
// initialize an entity for networked methods
void CScriptRMI::SetupEntity( EntityId eid, IEntity * pEntity, bool client, bool server )
{
	if (!m_pParent)
	{
		GameWarning( "Trying to setup an entity for network with no game started... failing" );
		return;
	}

	IEntityClass * pClass = pEntity->GetClass();
	stack_string className = pClass->GetName();

	IScriptTable * pEntityTable = pEntity->GetScriptTable();
	IScriptSystem * pSS = pEntityTable->GetScriptSystem();

	SmartScriptTable clientDispatchTable, serverDispatchTable, serverSynchedTable;
	pEntityTable->GetValue( CLIENT_DISPATCH_FIELD, clientDispatchTable );
	pEntityTable->GetValue( SERVER_DISPATCH_FIELD, serverDispatchTable );
	pEntityTable->GetValue( SERVER_SYNCHED_FIELD, serverSynchedTable );

	bool validated;
	if (clientDispatchTable.GetPtr())
	{
		if (!clientDispatchTable->GetValue(VALIDATED_FIELD, validated))
			return;
		if (!validated)
		{
			SmartScriptTable methods;
			if (!pEntityTable->GetValue( "Client", methods ))
			{
				GameWarning( "No Client table, but has a client dispatch on class %s",
					pEntity->GetClass()->GetName() );
				return;
			}
			if (!ValidateDispatchTable( pEntity->GetClass()->GetName(), clientDispatchTable, methods, false ))
				return;
		}
	}
	if (serverDispatchTable.GetPtr())
	{
		if (!serverDispatchTable->GetValue(VALIDATED_FIELD, validated))
			return;
		if (!validated)
		{
			SmartScriptTable methods;
			if (!pEntityTable->GetValue( "Server", methods ))
			{
				GameWarning( "No Server table, but has a server dispatch on class %s",
					pEntity->GetClass()->GetName() );
				return;
			}
			if (!ValidateDispatchTable( pEntity->GetClass()->GetName(), serverDispatchTable, methods, true ))
				return;
		}
	}

	ScriptHandle id;
	id.n = eid;

	ScriptHandle flags;

	if (client && serverDispatchTable.GetPtr())
	{
		flags.n = eDF_ToServer;
		AddProxyTable( pEntityTable, id, flags, "server", serverDispatchTable );
	}

	if (server && clientDispatchTable.GetPtr())
	{
		// only expose ownClient, otherClients for actors with a channelId
		flags.n = eDF_ToClientOnChannel;
		AddProxyTable( pEntityTable, id, flags, "onClient", clientDispatchTable );
		flags.n = eDF_ToClientOnOtherChannels;
		AddProxyTable( pEntityTable, id, flags, "otherClients", clientDispatchTable );
		flags.n = eDF_ToClientOnChannel | eDF_ToClientOnOtherChannels;
		AddProxyTable( pEntityTable, id, flags, "allClients", clientDispatchTable );
	}

	if (serverSynchedTable.GetPtr())
	{
		AddSynchedTable( pEntityTable, id, "synched", serverSynchedTable );
	}

	CryAutoCriticalSection lkDispatch(m_dispatchMutex);
	std::map<string, size_t>::iterator iter = m_entityClassToEntityTypeID.find(CONST_TEMP_STRING(pEntity->GetClass()->GetName()));
	if (iter == m_entityClassToEntityTypeID.end())
	{
		//[Timur] commented out as spam.
		//GameWarning("[scriptrmi] unable to find class %s", pEntity->GetClass()->GetName());
	}
	else
		m_entities[eid] = iter->second;
}
Example #24
0
		void Hit(const char* name)
		{
			TWeapons::iterator it = std::lower_bound(m_weapons.begin(), m_weapons.end(), CONST_TEMP_STRING(name), SWeaponCompare());
			if(it != m_weapons.end() && it->m_name == name)
				it->m_hits++;			
		}