mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-24 05:03:34 -04:00
gun should always revert blockchanges made by player
This commit is contained in:
parent
4bf0b21023
commit
5c1a9654d5
@ -31,15 +31,11 @@ namespace MCGalaxy.Commands.Fun {
|
|||||||
p.Message("Guns cannot be used on this map!"); return;
|
p.Message("Guns cannot be used on this map!"); return;
|
||||||
}
|
}
|
||||||
if (p.weapon != null && message.Length == 0) {
|
if (p.weapon != null && message.Length == 0) {
|
||||||
p.weapon.Disable();
|
p.weapon.Disable(); return;
|
||||||
p.weapon = null;
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Gun gun = GetGun(p, message);
|
Gun gun = GetGun(p, message);
|
||||||
if (gun == null) { Help(p); return; }
|
if (gun == null) { Help(p); return; }
|
||||||
|
|
||||||
p.weapon = gun;
|
|
||||||
gun.Enable(p);
|
gun.Enable(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,11 +42,12 @@ namespace MCGalaxy.Games {
|
|||||||
}
|
}
|
||||||
this.p = p;
|
this.p = p;
|
||||||
p.ClearBlockchange();
|
p.ClearBlockchange();
|
||||||
|
p.weapon = this;
|
||||||
|
p.Blockchange += BlockClickCallback;
|
||||||
|
|
||||||
if (p.Supports(CpeExt.PlayerClick)) {
|
if (p.Supports(CpeExt.PlayerClick)) {
|
||||||
p.Message(Name + " engaged, click to fire at will");
|
p.Message(Name + " engaged, click to fire at will");
|
||||||
} else {
|
} else {
|
||||||
p.Blockchange += BlockClickCallback;
|
|
||||||
p.Message(Name + " engaged, fire at will");
|
p.Message(Name + " engaged, fire at will");
|
||||||
aimer = new AimBox();
|
aimer = new AimBox();
|
||||||
aimer.Hook(p);
|
aimer.Hook(p);
|
||||||
@ -67,8 +68,9 @@ namespace MCGalaxy.Games {
|
|||||||
Weapon weapon = p.weapon;
|
Weapon weapon = p.weapon;
|
||||||
if (weapon == null) return;
|
if (weapon == null) return;
|
||||||
|
|
||||||
|
// always revert block back, client assumes changes always succeed
|
||||||
p.RevertBlock(x, y, z);
|
p.RevertBlock(x, y, z);
|
||||||
// defer to player click handler
|
// defer to player click handler if used
|
||||||
if (weapon.aimer == null) return;
|
if (weapon.aimer == null) return;
|
||||||
|
|
||||||
if (!p.level.Config.Guns) { weapon.Disable(); return; }
|
if (!p.level.Config.Guns) { weapon.Disable(); return; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user