mirror of
https://github.com/RandomityGuy/MBHaxe.git
synced 2025-10-30 08:11:25 +00:00
fix spectator display bug and add collision invulnerability
This commit is contained in:
parent
18d0e7154f
commit
19cc14679e
4 changed files with 28 additions and 7 deletions
|
|
@ -1245,7 +1245,7 @@ class Marble extends GameObject {
|
|||
// Marble-Marble
|
||||
var nextPos = position.add(velocity.multiply(deltaT));
|
||||
for (marble in this.collisionWorld.marbleEntities) {
|
||||
if (marble == this.collider)
|
||||
if (marble == this.collider || marble.ignore)
|
||||
continue;
|
||||
var otherPosition = marble.transform.getPosition();
|
||||
var isec = Collision.capsuleSphereNearestOverlap(position, nextPos, _radius, otherPosition, marble.radius);
|
||||
|
|
@ -1669,6 +1669,13 @@ class Marble extends GameObject {
|
|||
}
|
||||
return;
|
||||
}
|
||||
|
||||
var ticks = Net.isClient ? serverTicks : timeState.ticks;
|
||||
|
||||
if ((ticks - this.level.serverStartTicks) < (10000 >> 5)) // 10 seconds marble collision invulnerability - competitive mode needs this
|
||||
this.collider.ignore = true;
|
||||
else
|
||||
this.collider.ignore = false;
|
||||
}
|
||||
|
||||
// if (this.controllable) {
|
||||
|
|
|
|||
|
|
@ -369,12 +369,12 @@ class MarbleWorld extends Scheduler {
|
|||
if (this.isMultiplayer) {
|
||||
// Add us
|
||||
if (Net.isHost) {
|
||||
this.playGui.addPlayer(0, (Net.hostSpectate ? "[S] " : "") + Settings.highscoreName.substr(0, 15), true);
|
||||
this.playGui.addPlayer(0, Settings.highscoreName.substr(0, 15), true);
|
||||
} else {
|
||||
this.playGui.addPlayer(Net.clientId, (Net.clientSpectate ? "[S] " : "") + Settings.highscoreName.substr(0, 15), true);
|
||||
this.playGui.addPlayer(Net.clientId, Settings.highscoreName.substr(0, 15), true);
|
||||
}
|
||||
for (client in Net.clientIdMap) {
|
||||
this.playGui.addPlayer(client.id, (client.spectator ? "[S] " : "") + client.name.substr(0, 15), false);
|
||||
this.playGui.addPlayer(client.id, client.name.substr(0, 15), false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -612,7 +612,7 @@ class MarbleWorld extends Scheduler {
|
|||
this.initMarble(cc, () -> {
|
||||
var addedMarble = clientMarbles.get(cc);
|
||||
this.restart(addedMarble); // spawn it
|
||||
this.playGui.addPlayer(cc.id, (cc.spectator ? "[S] " : "") + cc.getName(), false);
|
||||
this.playGui.addPlayer(cc.id, cc.getName(), false);
|
||||
this.playGui.redrawPlayerList();
|
||||
|
||||
// Sort all the marbles so that they are updated in a deterministic order
|
||||
|
|
@ -629,7 +629,7 @@ class MarbleWorld extends Scheduler {
|
|||
this.initMarble(cc, () -> {
|
||||
var addedMarble = clientMarbles.get(cc);
|
||||
this.restart(addedMarble); // spawn it
|
||||
this.playGui.addPlayer(cc.id, (cc.spectator ? "[S] " : "") + cc.getName(), false);
|
||||
this.playGui.addPlayer(cc.id, cc.getName(), false);
|
||||
this.playGui.redrawPlayerList();
|
||||
|
||||
// Sort all the marbles so that they are updated in a deterministic order
|
||||
|
|
@ -912,6 +912,8 @@ class MarbleWorld extends Scheduler {
|
|||
for (client => marble in this.clientMarbles)
|
||||
marble.setMode(Play);
|
||||
|
||||
this.playGui.redrawPlayerList(); // Update spectators display
|
||||
|
||||
this.playGui.setCenterText('go');
|
||||
|
||||
var huntMode = cast(this.gameMode, HuntMode);
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import src.Debug;
|
|||
class SphereCollisionEntity extends CollisionEntity {
|
||||
public var radius:Float;
|
||||
public var marble:Marble;
|
||||
public var ignore:Bool = false;
|
||||
|
||||
var _dbgEntity2:h3d.scene.Mesh;
|
||||
|
||||
|
|
@ -75,6 +76,8 @@ class SphereCollisionEntity extends CollisionEntity {
|
|||
}
|
||||
|
||||
public override function sphereIntersection(collisionEntity:SphereCollisionEntity, timeState:TimeState) {
|
||||
if (ignore)
|
||||
return [];
|
||||
var contacts = [];
|
||||
var thispos = transform.getPosition();
|
||||
var position = collisionEntity.transform.getPosition();
|
||||
|
|
|
|||
|
|
@ -688,7 +688,16 @@ class PlayGui {
|
|||
default:
|
||||
col3;
|
||||
};
|
||||
pl.push('<font color="${color}">${i + 1}. ${Util.rightPad(item.name, 25, 3)}</font>');
|
||||
var isSpectating = false;
|
||||
if (item.us) {
|
||||
if (Net.isHost)
|
||||
isSpectating = Net.hostSpectate;
|
||||
if (Net.isClient)
|
||||
isSpectating = Net.clientSpectate;
|
||||
} else {
|
||||
isSpectating = Net.clientIdMap[item.id].spectator;
|
||||
}
|
||||
pl.push('<font color="${color}">${i + 1}. ${isSpectating ? "[S] " : ""}${Util.rightPad(item.name, 25, 3)}</font>');
|
||||
var connPing = item.us ? (Net.isHost ? 0 : Net.clientConnection.pingTicks) : (item.id == 0 ? 0 : Net.clientIdMap[item.id].pingTicks);
|
||||
var pingStatus = "unknown";
|
||||
if (connPing <= 5)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue