Prevent throwing duplacite events for GameObject

Store last gameObject as static variable in tile mixin and in case new
event is exactly same as last one in game object spawned, do not
proceed.

Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
This commit is contained in:
Tomas Slusny
2018-02-22 09:38:42 +01:00
parent 481829bfac
commit 9313747479

View File

@@ -58,6 +58,9 @@ public abstract class RSTileMixin implements RSTile
@Shadow("clientInstance")
private static RSClient client;
@Inject
private static GameObject lastGameObject;
@Inject
private WallObject previousWallObject;
@@ -208,12 +211,25 @@ public abstract class RSTileMixin implements RSTile
// Previous game object
GameObject previous = previousGameObjects[idx];
// GameObject that was changed.
RSGameObject current = (RSGameObject) getGameObjects()[idx];
// Last game object
GameObject last = lastGameObject;
// Update last game object
lastGameObject = current;
// Update previous object to current
previousGameObjects[idx] = current;
// Duplicate event, return
if (current != null && current.equals(last))
{
return;
}
// Characters seem to generate a constant stream of new GameObjects
if (current == null || !(current.getRenderable() instanceof Actor))
{