mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-22 20:16:36 -04:00
fix some issues with /gun
This commit is contained in:
parent
70593dde6c
commit
4bf0b21023
@ -58,10 +58,7 @@ namespace MCGalaxy.Core {
|
||||
foreach (Zone zn in zones) { zn.Show(p); }
|
||||
}
|
||||
|
||||
if (p.aiming && !level.Config.Guns) {
|
||||
p.aiming = false;
|
||||
p.ClearBlockchange();
|
||||
}
|
||||
if (p.weapon != null && !level.Config.Guns) p.weapon.Disable();
|
||||
if (!level.Config.UseBlockDB) {
|
||||
p.Message("BlockDB is disabled here, %Wyou will not be able to /undo or /redo");
|
||||
}
|
||||
|
@ -175,10 +175,10 @@ namespace MCGalaxy.Drawing.Ops {
|
||||
if (old == b.Block || !p.group.Blocks[old] || !p.group.Blocks[b.Block]) return;
|
||||
|
||||
// Check if player can affect block at coords in world
|
||||
AccessController denied = lvl.CanAffect(p, b.X, b.Y, b.Z);
|
||||
if (denied != null) {
|
||||
AccessController denier = lvl.CanAffect(p, b.X, b.Y, b.Z);
|
||||
if (denier != null) {
|
||||
if (p.lastAccessStatus < DateTime.UtcNow) {
|
||||
denied.CheckDetailed(p);
|
||||
denier.CheckDetailed(p);
|
||||
p.lastAccessStatus = DateTime.UtcNow.AddSeconds(2);
|
||||
}
|
||||
return;
|
||||
|
@ -75,12 +75,9 @@ namespace MCGalaxy.Games {
|
||||
void ResetPlayerFlag(Player p, CtfData data) {
|
||||
Vec3S32 last = data.LastHeadPos;
|
||||
ushort x = (ushort)last.X, y = (ushort)last.Y, z = (ushort)last.Z;
|
||||
data.LastHeadPos = default(Vec3S32);
|
||||
|
||||
BlockID origBlock = Map.GetBlock(x, y, z);
|
||||
if (origBlock != Block.Invalid) {
|
||||
Map.BroadcastChange(x, y, z, origBlock);
|
||||
}
|
||||
data.LastHeadPos = default(Vec3S32);
|
||||
Map.BroadcastRevert(x, y, z);
|
||||
}
|
||||
|
||||
void DrawPlayerFlag(Player p, CtfData data) {
|
||||
|
@ -52,7 +52,7 @@ namespace MCGalaxy.Games {
|
||||
if (args.iterations > 12) {
|
||||
Vec3U16 pos = args.visible[0];
|
||||
args.visible.RemoveAt(0);
|
||||
p.level.Blockchange(pos.X, pos.Y, pos.Z, Block.Air, true);
|
||||
p.level.BroadcastRevert(pos.X, pos.Y, pos.Z);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -63,7 +63,7 @@ namespace MCGalaxy.Games {
|
||||
if (args.visible.Count > 0) {
|
||||
Vec3U16 pos = args.visible[0];
|
||||
args.visible.RemoveAt(0);
|
||||
p.level.Blockchange(pos.X, pos.Y, pos.Z, Block.Air, true);
|
||||
p.level.BroadcastRevert(pos.X, pos.Y, pos.Z);
|
||||
}
|
||||
return args.visible.Count > 0;
|
||||
}
|
||||
@ -88,7 +88,7 @@ namespace MCGalaxy.Games {
|
||||
if (cur != Block.Air && !args.all.Contains(pos) && OnHitBlock(args, pos, cur))
|
||||
return false;
|
||||
|
||||
p.level.Blockchange(pos.X, pos.Y, pos.Z, args.block);
|
||||
p.level.BroadcastChange(pos.X, pos.Y, pos.Z, args.block);
|
||||
args.visible.Add(pos);
|
||||
args.all.Add(pos);
|
||||
|
||||
@ -145,7 +145,7 @@ namespace MCGalaxy.Games {
|
||||
args.all.Clear();
|
||||
} else {
|
||||
foreach (Vec3U16 pos in args.visible) {
|
||||
p.level.Blockchange(pos.X, pos.Y, pos.Z, Block.Air, true);
|
||||
p.level.BroadcastRevert(pos.X, pos.Y, pos.Z);
|
||||
}
|
||||
args.visible.Clear();
|
||||
}
|
||||
|
@ -57,6 +57,7 @@ namespace MCGalaxy.Games {
|
||||
p.aiming = false;
|
||||
p.ClearBlockchange();
|
||||
p.Message(Name + " disabled");
|
||||
p.weapon = null;
|
||||
}
|
||||
|
||||
protected abstract void OnActivated(byte yaw, byte pitch, BlockID block);
|
||||
|
@ -35,7 +35,7 @@ namespace MCGalaxy.Generator.Foliage {
|
||||
public virtual int MinSize { get { return 3; } }
|
||||
|
||||
/// <summary> Maximum allowed size (usually means height) for this tree. </summary>
|
||||
public virtual int MaxSize { get { return 100; } }
|
||||
public virtual int MaxSize { get { return 4096; } }
|
||||
|
||||
/// <summary> Estimated the maximum number of blocks affected by this tree. </summary>
|
||||
public abstract int EstimateBlocksAffected();
|
||||
|
@ -180,6 +180,8 @@ namespace MCGalaxy {
|
||||
return block >= Block.Water && block <= Block.StillLava;
|
||||
}
|
||||
|
||||
/// <summary> Returns the AccessController denying the player from changing blocks at the given coordinates. </summary>
|
||||
/// <remarks> If no AccessController denies the player, returns null. </remarks>
|
||||
public AccessController CanAffect(Player p, ushort x, ushort y, ushort z) {
|
||||
Zone[] zones = Zones.Items;
|
||||
if (zones.Length == 0) goto checkRank; // TODO: avoid this
|
||||
@ -216,11 +218,11 @@ namespace MCGalaxy {
|
||||
|
||||
public bool CheckAffect(Player p, ushort x, ushort y, ushort z, BlockID old, BlockID block) {
|
||||
if (!p.group.Blocks[old] || !p.group.Blocks[block]) return false;
|
||||
AccessController denied = CanAffect(p, x, y, z);
|
||||
if (denied == null) return true;
|
||||
AccessController denier = CanAffect(p, x, y, z);
|
||||
if (denier == null) return true;
|
||||
|
||||
if (p.lastAccessStatus < DateTime.UtcNow) {
|
||||
denied.CheckDetailed(p);
|
||||
denier.CheckDetailed(p);
|
||||
p.lastAccessStatus = DateTime.UtcNow.AddSeconds(2);
|
||||
}
|
||||
return false;
|
||||
@ -234,6 +236,13 @@ namespace MCGalaxy {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Sends a block update packet to all players in this level. </summary>
|
||||
/// <remarks> The block sent is the current block at the given coordinates. </remarks>
|
||||
public void BroadcastRevert(ushort x, ushort y, ushort z) {
|
||||
BlockID block = GetBlock(x, y, z);
|
||||
if (block != Block.Invalid) BroadcastChange(x, y, z, block);
|
||||
}
|
||||
|
||||
|
||||
public void Blockchange(Player p, ushort x, ushort y, ushort z, BlockID block) {
|
||||
if (DoBlockchange(p, x, y, z, block) == 2) BroadcastChange(x, y, z, block);
|
||||
|
Loading…
x
Reference in New Issue
Block a user