1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-06-16 23:27:15 +02:00

Revise the entity creation/destruction system.

This commit is contained in:
Sandu Liviu Catalin
2015-10-31 21:28:23 +02:00
parent 1f985c5ebc
commit 0aafb46af2
7 changed files with 1068 additions and 383 deletions

View File

@ -223,27 +223,27 @@ void CAutomobile::SetName(const SQChar * name) noexcept
Reference< CVehicle > CAutomobile::Create(SQInt32 world, const Vector3 & pos, SQFloat angle,
SQInt32 header, SqObj & payload) const noexcept
{
return _Core->CreateVehicle(*this, world, pos, angle, SQMOD_UNKNOWN, SQMOD_UNKNOWN, header, payload);
return _Core->NewVehicle(m_ID, world, pos.x, pos.z, pos.y, angle, SQMOD_UNKNOWN, SQMOD_UNKNOWN, header, payload);
}
Reference< CVehicle > CAutomobile::Create(SQInt32 world, const Vector3 & pos, SQFloat angle,
SQInt32 primary, SQInt32 secondary, SQInt32 header,
SqObj & payload) const noexcept
{
return _Core->CreateVehicle(*this, world, pos, angle, primary, secondary, header, payload);
return _Core->NewVehicle(*this, world, pos.x, pos.z, pos.y, angle, primary, secondary, header, payload);
}
Reference< CVehicle > CAutomobile::Create(SQInt32 world, SQFloat x, SQFloat y, SQFloat z, SQFloat angle,
SQInt32 header, SqObj & payload) const noexcept
{
return _Core->CreateVehicle(*this, world, Vector3(x, y, z), angle, SQMOD_UNKNOWN, SQMOD_UNKNOWN, header, payload);
return _Core->NewVehicle(*this, world, x, y, z, angle, SQMOD_UNKNOWN, SQMOD_UNKNOWN, header, payload);
}
Reference< CVehicle > CAutomobile::Create(SQInt32 world, SQFloat x, SQFloat y, SQFloat z, SQFloat angle,
SQInt32 primary, SQInt32 secondary, SQInt32 header,
SqObj & payload) const noexcept
{
return _Core->CreateVehicle(*this, world, Vector3(x, y, z), angle, primary, secondary, header, payload);
return _Core->NewVehicle(*this, world, x, y, z, angle, primary, secondary, header, payload);
}
// ================================================================================================

View File

@ -232,26 +232,26 @@ bool CModel::IsActuallyWeapon() const noexcept
Reference< CObject > CModel::Object(SQInt32 world, const Vector3 & pos, SQInt32 alpha, SQInt32 header, \
SqObj & payload) const noexcept
{
return _Core->CreateObject(*this, world, pos, alpha, header, payload);
return _Core->NewObject(m_ID, world, pos.x, pos.y, pos.z, alpha, header, payload);
}
Reference< CObject > CModel::Object(SQInt32 world, SQFloat x, SQFloat y, SQFloat z, SQInt32 alpha, \
SQInt32 header, SqObj & payload) const noexcept
{
return _Core->CreateObject(*this, world, Vector3(x, y, z), alpha, header, payload);
return _Core->NewObject(m_ID, world, x, y, z, alpha, header, payload);
}
// ------------------------------------------------------------------------------------------------
Reference< CPickup > CModel::Pickup(SQInt32 world, SQInt32 quantity, const Vector3 & pos, SQInt32 alpha, \
bool automatic, SQInt32 header, SqObj & payload) const noexcept
{
return _Core->CreatePickup(*this, world, quantity, pos, alpha, automatic, header, payload);
return _Core->NewPickup(m_ID, world, quantity, pos.x, pos.y, pos.z, alpha, automatic, header, payload);
}
Reference< CPickup > CModel::Pickup(SQInt32 world, SQInt32 quantity, SQFloat x, SQFloat y, SQFloat z, \
SQInt32 alpha, bool automatic, SQInt32 header, SqObj & payload) const noexcept
{
return _Core->CreatePickup(*this, world, quantity, Vector3(x, y, z), alpha, automatic, header, payload);
return _Core->NewPickup(m_ID, world, quantity, x, y, z, alpha, automatic, header, payload);
}
// ================================================================================================

View File

@ -166,6 +166,16 @@ protected:
LogErr("Attempting to set global data for invalid automobile id: %d", id);
}
}
public:
/* --------------------------------------------------------------------------------------------
* See if the specified identifier is valid and in bounds.
*/
static bool Valid(SQInt32 id) noexcept
{
return VALID_ENTITYGETEX(id, Max);
}
};
// ------------------------------------------------------------------------------------------------