fixed expire time on projectiles

This commit is contained in:
Cheese 2015-10-31 19:01:49 +11:00
parent c463b80fe0
commit b8b260bca1

View File

@ -37,6 +37,8 @@ public class ProjectileUser
private IThrown _callback;
private long _expireTime;
private long _startTime;
private boolean _hitPlayer = false;
private boolean _hitNonPlayerEntity = false;
private boolean _hitBlock = false;
@ -75,10 +77,8 @@ public class ProjectileUser
_thrower = thrower;
_callback = callback;
if (expireTime > 0)
_expireTime = System.currentTimeMillis() + expireTime;
else
_expireTime = -1;
_expireTime = expireTime;
_startTime = System.currentTimeMillis();
_hitPlayer = hitPlayer;
_hitNonPlayerEntity = hitNonPlayerEntity;
@ -116,10 +116,8 @@ public class ProjectileUser
_thrower = thrower;
_callback = callback;
if (expireTime > 0)
_expireTime = System.currentTimeMillis() + expireTime;
else
_expireTime = -1;
_expireTime = expireTime;
_startTime = System.currentTimeMillis();
_hitPlayer = hitPlayer;
_hitNonPlayerEntity = hitNonPlayerEntity;
@ -163,7 +161,7 @@ public class ProjectileUser
public boolean Collision()
{
if (_expireTime != -1 && System.currentTimeMillis() > _expireTime)
if (_expireTime != -1 && System.currentTimeMillis() > (_startTime + _expireTime))
{
_callback.Expire(this);
return true;