Пример #1
0
//------------------------------------------------------------------------
void CGunTurret::ReadProperties(IScriptTable *pProperties)
{
	CItem::ReadProperties(pProperties);

	if(pProperties)
	{
		m_turretparams.Reset(pProperties);

		const char *model=0;

		if(GetEntityProperty("objBase", model) && model && *model)
		{
			SetGeometry(eIGS_Aux0, model);
		}

		if(GetEntityProperty("objModel", model) && model && *model)
		{
			SetGeometry(eIGS_ThirdPerson, model);
		}

		if(GetEntityProperty("objBarrel", model) && model && *model)
		{
			SetGeometry(eIGS_Aux1, model);
		}

		if(GetEntityProperty("objDestroyed", model) && model && *model)
			SetGeometry(eIGS_Destroyed, model);
	}
}
Пример #2
0
//------------------------------------------------------------------------
void CAmmoPickup::PostInit( IGameObject * pGameObject )
{
	// fix for hud displaying the wrong ammo name
	if (!m_ammoName.empty())
	{
		SetEntityProperty("AmmoName", m_ammoName.c_str());
		SetEntityProperty("Count", m_ammoCount);
	}
	else
	{
		const char *ammoName=0;
		if (GetEntityProperty("AmmoName", ammoName) && ammoName && ammoName[0])
		{
			m_ammoName=ammoName;
			GetEntityProperty("Count", m_ammoCount);
		}
	}

	if (m_modelName.empty())
	{
		const char *model=0;
		if (GetEntityProperty("objModel", model) && model && model[0])
			m_modelName=model;
	}

	if (!m_modelName.empty())
		SetGeometry(eIGS_ThirdPerson, m_modelName.c_str());

	CWeapon::PostInit(pGameObject);
}
Пример #3
0
//------------------------------------------------------------------------
void CItem::ReadProperties(IScriptTable *pProperties)
{
	if (pProperties)
	{
		GetEntityProperty("HitPoints", m_properties.hitpoints);
		GetEntityProperty("bPickable", m_properties.pickable);
		GetEntityProperty("bMounted", m_properties.mounted);
		GetEntityProperty("bUsable", m_properties.usable);

		GetEntityProperty("Respawn", "bRespawn", m_respawnprops.respawn);
		GetEntityProperty("Respawn", "nTimer", m_respawnprops.timer);
		GetEntityProperty("Respawn", "bUnique", m_respawnprops.unique);

		int physicsTemp;
		GetEntityProperty("eiPhysicsType", physicsTemp);
		m_properties.physics = (ePhysicalization)physicsTemp;

		if(!gEnv->bMultiplayer)
		{
			GetEntityProperty("bSpecialSelect", m_properties.specialSelect);

			ReadMountedProperties(pProperties);
		}
	}
}
Пример #4
0
//------------------------------------------------------------------------
bool CGunTurret::IsTargetHostile(IActor *pTarget) const
{
	int species=0;
	bool sameSpecies = (GetEntityProperty(pTarget->GetEntity(), "species", species) && species == m_turretparams.species);
	int team = g_pGame->GetGameRules()->GetTeam(pTarget->GetEntityId());
	bool sameTeam = (m_turretparams.team == 0) || (team == 0) || (m_turretparams.team == team);

	return !sameSpecies || !sameTeam;

	/*	IVehicle *pVehicle=g_pGame->GetIGameFramework()->GetIVehicleSystem()->GetVehicle(pTarget->GetId());
	if (pVehicle)
	{
	int seatCount=pVehicle->GetSeatCount();
	for (int i=0; i<seatCount; i++)
	{
	IVehicleSeat *pVehicleSeat=pVehicle->GetSeatById(i);
	if (pVehicleSeat && pVehicleSeat->GetPassenger())
	{
	IEntity *pPassenger=gEnv->pEntitySystem->GetEntity(pVehicleSeat->GetPassenger());
	if (pPassenger && IsTargetHostile(pPassenger))
	return true;
	}
	}
	}
	return false;
	*/
}
Пример #5
0
//--------------------------------------------
bool CAmmoPickup::CheckAmmoRestrictions(EntityId pickerId)
{
	if(g_pGameCVars->i_unlimitedammo != 0)
		return true;

	if(gEnv->pSystem->IsEditor())
		return true;

	IActor* pPicker = g_pGame->GetIGameFramework()->GetIActorSystem()->GetActor(pickerId);
	if(pPicker)
	{
		IInventory *pInventory = pPicker->GetInventory();
		if(pInventory)
		{
			for (TAmmoMap::const_iterator it=m_ammo.begin(); it!=m_ammo.end(); ++it)
			{
				int invAmmo  = pInventory->GetAmmoCount(it->first);
				int invLimit = pInventory->GetAmmoCapacity(it->first);

				if(invAmmo>=invLimit && (!gEnv->pSystem->IsEditor()))
					return false;
			}

			const char *ammoName=0;
			if (GetEntityProperty("AmmoName", ammoName) && ammoName && ammoName[0])
			{
				int count=0;
				GetEntityProperty("Count", count);
				if (count)
				{
					IEntityClass* pClass = gEnv->pEntitySystem->GetClassRegistry()->FindClass(ammoName);
					if(pClass)
					{
						int invAmmo  = pInventory->GetAmmoCount(pClass);
						int invLimit = pInventory->GetAmmoCapacity(pClass);
						if(invAmmo>=invLimit)
							return false;
					}
				}
			}
		}
	}

	return true;
}
Пример #6
0
//------------------------------------------------------------------------
void CAmmoPickup::Reset()
{
	const char *ammoName=0;
	if (GetEntityProperty("AmmoName", ammoName) && ammoName && ammoName[0])
	{
		m_ammoName=ammoName;
		GetEntityProperty("Count", m_ammoCount);
	}

	const char *model=0;
	if (GetEntityProperty("objModel", model) && model && model[0])
		m_modelName=model;

	CWeapon::Reset();

	if (!m_modelName.empty())
		SetGeometry(eIGS_ThirdPerson, m_modelName.c_str());
}
Пример #7
0
//------------------------------------------------------------------------
void CItem::ReadProperties(IScriptTable *pProperties)
{
	if(pProperties)
	{
		GetEntityProperty("HitPoints", m_properties.hitpoints);
		GetEntityProperty("bPickable", m_properties.pickable);
		GetEntityProperty("bMounted", m_properties.mounted);
		GetEntityProperty("bPhysics", m_properties.physics);
		GetEntityProperty("bUsable", m_properties.usable);
		GetEntityProperty("bAutoPickup", m_properties.autopickup);

		GetEntityProperty("Respawn", "bRespawn", m_respawnprops.respawn);
		GetEntityProperty("Respawn", "nTimer", m_respawnprops.timer);
		GetEntityProperty("Respawn", "bUnique", m_respawnprops.unique);
	}
}
Пример #8
0
//------------------------------------------------------------------------
void CGunTurret::UpdateEntityProperties()
{
	bool enabled = m_turretparams.enabled;
	GetEntityProperty("GunTurret","bEnabled",m_turretparams.enabled);

	if(enabled!=m_turretparams.enabled)
	{
		Activate(m_turretparams.enabled);
		GetGameObject()->ChangedNetworkState(ASPECT_STATEBITS);
	}

	GetEntityProperty("GunTurret", "bSearching", m_turretparams.searching);
	GetEntityProperty("GunTurret", "bSurveillance", m_turretparams.surveillance);

	const char *teamName=0;
	GetEntityProperty("teamName", teamName);

	if(teamName && teamName[0])
		m_turretparams.team = g_pGame->GetGameRules()->GetTeamId(teamName);
}
Пример #9
0
//------------------------------------------------------------------------
void CItem::ReadMountedProperties(IScriptTable* pScriptTable)
{
	float minPitch = 0.f;
	float maxPitch = 0.f;

	GetEntityProperty("MountedLimits", "pitchMin", minPitch);
	GetEntityProperty("MountedLimits", "pitchMax", maxPitch);
	GetEntityProperty("MountedLimits", "yaw", m_properties.mounted_yaw_range);

	m_properties.mounted_min_pitch = min(minPitch,maxPitch);
	m_properties.mounted_max_pitch = max(minPitch,maxPitch);

	GetEntityProperty("Respawn", "bRespawn", m_respawnprops.respawn);
	GetEntityProperty("Respawn", "nTimer", m_respawnprops.timer);
	GetEntityProperty("Respawn", "bUnique", m_respawnprops.unique);
}