mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-12 19:31:41 +00:00
fix tabs vs space, fix net strikepoints
This commit is contained in:
parent
3cd82d9229
commit
84f610f2f2
1 changed files with 17 additions and 13 deletions
|
|
@ -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);
|
||||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue