Skip to content

Commit

Permalink
fix tabs vs space, fix net strikepoints
Browse files Browse the repository at this point in the history
  • Loading branch information
Johxz committed Feb 4, 2017
1 parent 3cd82d9 commit 84f610f
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions Engine/source/T3D/fx/lightning.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -870,25 +870,30 @@ void Lightning::strikeObject(ShapeBase* targetObj)
Point3F strikePoint = targetObj->getPosition();
Point3F objectCenter;

targetObj->getObjBox().getCenter(&objectCenter);
objectCenter.convolve(targetObj->getScale());
targetObj->getTransform().mulP(objectCenter);
Box3F wb = getWorldBox();
if (!wb.isContained(strikePoint))
return;

Point3F targetRel = strikePoint - getPosition();
Point3F length(wb.len_x() / 2.0f, wb.len_y() / 2.0f, wb.len_z() / 2.0f);

Point3F strikePos = targetRel / length;

bool playerInWarmup = false;
Player *playerObj = dynamic_cast< Player * >(targetObj);
if (playerObj)
{
if (!playerObj->getControllingClient())
{
playerInWarmup = true;
}
if (!playerObj->getControllingClient())
{
playerInWarmup = true;
}
}

if (!playerInWarmup)
{
applyDamage_callback(objectCenter, VectorF(0.0, 0.0, 1.0), targetObj);
applyDamage_callback(targetObj->getWorldSphere().center, VectorF(0.0, 0.0, 1.0), targetObj);
}

SimGroup* pClientGroup = Sim::getClientGroup();
for (SimGroup::iterator itr = pClientGroup->begin(); itr != pClientGroup->end(); itr++) {
NetConnection* nc = static_cast<NetConnection*>(*itr);
Expand All @@ -897,16 +902,15 @@ void Lightning::strikeObject(ShapeBase* targetObj)
LightningStrikeEvent* pEvent = new LightningStrikeEvent;
pEvent->mLightning = this;

pEvent->mStart.x = strikePoint.x;
pEvent->mStart.y = strikePoint.y;
pEvent->mTarget = targetObj;
pEvent->mStart.x = strikePoint.x;
pEvent->mStart.y = strikePoint.y;
pEvent->mTarget = targetObj;

nc->postNetEvent(pEvent);
}
}
}


//--------------------------------------------------------------------------
U32 Lightning::packUpdate(NetConnection* con, U32 mask, BitStream* stream)
{
Expand Down

0 comments on commit 84f610f

Please sign in to comment.