mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-16 11:06:06 -04:00
If Op user type and not using block permissions, the player should be able to place grass, water, lava, and admincrete.
This commit is contained in:
parent
fb566ac505
commit
3d9d2a0e76
@ -149,7 +149,7 @@ namespace ClassicalSharp {
|
|||||||
Move( xMoving, zMoving, 0.02f * 1.7f, ropeDrag, ropeGrav, 1 );
|
Move( xMoving, zMoving, 0.02f * 1.7f, ropeDrag, ropeGrav, 1 );
|
||||||
} else {
|
} else {
|
||||||
float factor = !flying && onGround ? 0.1f : 0.02f;
|
float factor = !flying && onGround ? 0.1f : 0.02f;
|
||||||
float yMul = Math.Max( 1, multiply / 5f );
|
float yMul = Math.Max( 1, multiply / 5f );
|
||||||
Move( xMoving, zMoving, factor * multiply, normalDrag, normalGrav, yMul );
|
Move( xMoving, zMoving, factor * multiply, normalDrag, normalGrav, yMul );
|
||||||
|
|
||||||
if( BlockUnderFeet == Block.Ice ) {
|
if( BlockUnderFeet == Block.Ice ) {
|
||||||
@ -173,7 +173,7 @@ namespace ClassicalSharp {
|
|||||||
void Move( float xMoving, float zMoving, float factor, Vector3 drag, float gravity, float yMul ) {
|
void Move( float xMoving, float zMoving, float factor, Vector3 drag, float gravity, float yMul ) {
|
||||||
AdjHeadingVelocity( zMoving, xMoving, factor );
|
AdjHeadingVelocity( zMoving, xMoving, factor );
|
||||||
Velocity.Y *= yMul;
|
Velocity.Y *= yMul;
|
||||||
if( !noClip )
|
if( !noClip )
|
||||||
MoveAndWallSlide();
|
MoveAndWallSlide();
|
||||||
Position += Velocity;
|
Position += Velocity;
|
||||||
|
|
||||||
@ -212,6 +212,20 @@ namespace ClassicalSharp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetUserType( byte value, bool useBlockPermissions ) {
|
||||||
|
UserType = value;
|
||||||
|
if( !useBlockPermissions ) {
|
||||||
|
game.CanPlace[(int)Block.Bedrock] = value == 0x64;
|
||||||
|
game.CanDelete[(int)Block.Bedrock] = value == 0x64;
|
||||||
|
game.CanPlace[(int)Block.Grass] = value == 0x64;
|
||||||
|
|
||||||
|
game.CanPlace[(int)Block.Water] = value == 0x64;
|
||||||
|
game.CanPlace[(int)Block.StillWater] = value == 0x64;
|
||||||
|
game.CanPlace[(int)Block.Lava] = value == 0x64;
|
||||||
|
game.CanPlace[(int)Block.StillLava] = value == 0x64;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
internal Vector3 lastPos, nextPos;
|
internal Vector3 lastPos, nextPos;
|
||||||
internal float lastYaw, nextYaw, lastPitch, nextPitch;
|
internal float lastYaw, nextYaw, lastPitch, nextPitch;
|
||||||
public void SetInterpPosition( float t ) {
|
public void SetInterpPosition( float t ) {
|
||||||
|
@ -186,7 +186,7 @@ namespace ClassicalSharp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal bool CanPick( byte block ) {
|
internal bool CanPick( byte block ) {
|
||||||
return !( block == 0 || ( BlockInfo.IsLiquid( block ) && !CanPlace[block] && !CanDelete[block] ) );
|
return !(block == 0 || (BlockInfo.IsLiquid( block ) && !(CanPlace[block] && CanDelete[block])));
|
||||||
}
|
}
|
||||||
|
|
||||||
public KeyMap Keys = new KeyMap();
|
public KeyMap Keys = new KeyMap();
|
||||||
|
@ -261,11 +261,7 @@ namespace ClassicalSharp {
|
|||||||
byte protocolVer = reader.ReadUInt8();
|
byte protocolVer = reader.ReadUInt8();
|
||||||
ServerName = reader.ReadAsciiString();
|
ServerName = reader.ReadAsciiString();
|
||||||
ServerMotd = reader.ReadAsciiString();
|
ServerMotd = reader.ReadAsciiString();
|
||||||
byte userType = reader.ReadUInt8();
|
game.LocalPlayer.SetUserType( reader.ReadUInt8(), useBlockPermissions );
|
||||||
if( !useBlockPermissions ) {
|
|
||||||
game.CanDelete[(int)Block.Bedrock] = userType == 0x64;
|
|
||||||
}
|
|
||||||
game.LocalPlayer.UserType = userType;
|
|
||||||
receivedFirstPosition = false;
|
receivedFirstPosition = false;
|
||||||
game.LocalPlayer.ParseHackFlags( ServerName, ServerMotd );
|
game.LocalPlayer.ParseHackFlags( ServerName, ServerMotd );
|
||||||
} break;
|
} break;
|
||||||
@ -409,11 +405,7 @@ namespace ClassicalSharp {
|
|||||||
|
|
||||||
case PacketId.SetPermission:
|
case PacketId.SetPermission:
|
||||||
{
|
{
|
||||||
byte userType = reader.ReadUInt8();
|
game.LocalPlayer.SetUserType( reader.ReadUInt8(), useBlockPermissions );
|
||||||
if( !useBlockPermissions ) {
|
|
||||||
game.CanDelete[(int)Block.Bedrock] = userType == 0x64;
|
|
||||||
}
|
|
||||||
game.LocalPlayer.UserType = userType;
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case PacketId.CpeExtInfo:
|
case PacketId.CpeExtInfo:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user