mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2026-02-21 05:31:02 +00:00
36 lines
855 B
Haxe
36 lines
855 B
Haxe
package net;
|
|
|
|
import src.MarbleWorld;
|
|
import net.NetPacket.ExplodableUpdatePacket;
|
|
import src.TimeState;
|
|
import net.NetPacket.PowerupPickupPacket;
|
|
|
|
class ExplodablePredictionStore {
|
|
var world:MarbleWorld;
|
|
var predictions:Array<Int>;
|
|
|
|
public inline function new(world:MarbleWorld) {
|
|
predictions = [];
|
|
this.world = world;
|
|
}
|
|
|
|
public inline function alloc() {
|
|
predictions.push(-100000);
|
|
}
|
|
|
|
public inline function getState(netIndex:Int) {
|
|
return predictions[netIndex];
|
|
}
|
|
|
|
public inline function acknowledgeExplodableUpdate(packet:ExplodableUpdatePacket) {
|
|
predictions[packet.explodableId] = packet.serverTicks;
|
|
if (!world.explodablesToTick.contains(packet.explodableId))
|
|
world.explodablesToTick.push(packet.explodableId);
|
|
}
|
|
|
|
public inline function reset() {
|
|
for (i in 0...predictions.length) {
|
|
predictions[i] = -100000;
|
|
}
|
|
}
|
|
}
|