mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-06 10:44:08 +00:00
Use better API terminology for radii
- SetProximityRadius just calls AddProximityRadius so its clear what is going on. - created struct BoxDimensions for clear reading of what the floats are
This commit is contained in:
@@ -279,7 +279,7 @@ void PhantomPhysicsComponent::CreatePhysics() {
|
||||
|
||||
switch (type) {
|
||||
case 1: { //Make a new box shape
|
||||
NiPoint3 boxSize(x, y, z);
|
||||
BoxDimensions boxSize(x, y, z);
|
||||
if (x == 0.0f) {
|
||||
//LU has some weird values, so I think it's best to scale them down a bit
|
||||
if (height < 0.5f) height = 2.0f;
|
||||
@@ -289,7 +289,7 @@ void PhantomPhysicsComponent::CreatePhysics() {
|
||||
width = width * m_Scale;
|
||||
height = height * m_Scale;
|
||||
|
||||
boxSize = NiPoint3(width, height, width);
|
||||
boxSize = BoxDimensions(width, height, width);
|
||||
}
|
||||
|
||||
m_dpEntity = new dpEntity(m_ParentEntity->GetObjectID(), boxSize);
|
||||
|
@@ -36,23 +36,24 @@ void ProximityMonitorComponent::LoadTemplateData() {
|
||||
GeneralUtils::TryParse(proximitySplit.at(0), radiusSmall);
|
||||
GeneralUtils::TryParse(proximitySplit.at(1), radiusLarge);
|
||||
if (radiusSmall != -1.0f && radiusLarge != -1.0f) {
|
||||
SetProximityRadius(radiusSmall, "rocketSmall");
|
||||
SetProximityRadius(radiusLarge, "rocketLarge");
|
||||
AddProximityRadius(radiusSmall, "rocketSmall");
|
||||
AddProximityRadius(radiusLarge, "rocketLarge");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ProximityMonitorComponent::SetProximityRadius(float proxRadius, const std::string& name) {
|
||||
dpEntity* en = new dpEntity(m_ParentEntity->GetObjectID(), proxRadius);
|
||||
en->SetPosition(m_ParentEntity->GetPosition());
|
||||
void ProximityMonitorComponent::AddProximityRadius(float proxRadius, const std::string& name) {
|
||||
dpEntity* entity = new dpEntity(m_ParentEntity->GetObjectID(), proxRadius);
|
||||
entity->SetPosition(m_ParentEntity->GetPosition());
|
||||
|
||||
dpWorld::Instance().AddEntity(en);
|
||||
m_ProximitiesData.insert(std::make_pair(name, en));
|
||||
dpWorld::Instance().AddEntity(entity);
|
||||
m_ProximitiesData.insert(std::make_pair(name, entity));
|
||||
}
|
||||
|
||||
void ProximityMonitorComponent::SetProximityRadius(dpEntity* entity, const std::string& name) {
|
||||
dpWorld::Instance().AddEntity(entity);
|
||||
void ProximityMonitorComponent::AddProximityRadius(const BoxDimensions& dimensions, const std::string& name) {
|
||||
dpEntity* entity = new dpEntity(m_ParentEntity->GetObjectID(), dimensions);
|
||||
entity->SetPosition(m_ParentEntity->GetPosition());
|
||||
dpWorld::Instance().AddEntity(entity);
|
||||
m_ProximitiesData.insert(std::make_pair(name, entity));
|
||||
}
|
||||
|
||||
|
@@ -32,14 +32,14 @@ public:
|
||||
* @param proxRadius the radius to use for the physics entity we use to detect proximity
|
||||
* @param name the name of this check
|
||||
*/
|
||||
void SetProximityRadius(float proxRadius, const std::string& name);
|
||||
void AddProximityRadius(float proxRadius, const std::string& name);
|
||||
|
||||
/**
|
||||
* Creates an entry to check proximity for, given a name
|
||||
* @param entity the physics entity to add to our proximity sensors
|
||||
* @param name the name of this check
|
||||
*/
|
||||
void SetProximityRadius(dpEntity* entity, const std::string& name);
|
||||
void AddProximityRadius(const BoxDimensions& entity, const std::string& name);
|
||||
|
||||
/**
|
||||
* Returns the last of entities that are used to check proximity, given a name
|
||||
|
Reference in New Issue
Block a user