public override void _PhysicsProcess(float Delta) { Mesh.RotationDegrees = new Vector3(0, Mesh.RotationDegrees.y + (360 * Delta * RPS), 0); Life += Delta; if (!Net.Work.IsNetworkServer()) { return; } if (PhysicsEnabled) { var OriginalChunkTuple = World.GetChunkTuple(Translation); Momentum = MoveAndSlide(Momentum, new Vector3(0, 1, 0), floorMaxAngle: Deg2Rad(60)); if (!CurrentChunkTuple.Equals(World.GetChunkTuple(Translation))) //We just crossed into a different chunk { World.Chunks[CurrentChunkTuple].Items.Remove(this); CurrentChunkTuple = World.GetChunkTuple(Translation); World.AddItemToChunk(this); Net.SteelRpc(World.Self, nameof(World.DropOrUpdateItem), Type, Translation, RotationDegrees.y, Momentum, Name); } if (IsOnFloor()) { //Doing friction Vector3 Horz = new Vector3(Momentum.x, 0, Momentum.z); Horz = Horz.Normalized() * Mathf.Clamp(Horz.Length() - (Friction * Delta), 0, MaxFallSpeed); Momentum.x = Horz.x; Momentum.z = Horz.z; if (Horz.Length() <= 0) { PhysicsEnabled = false; } } if (PhysicsEnabled) { Momentum.y -= Gravity * Delta; if (Momentum.y < -MaxFallSpeed) { Momentum.y = -MaxFallSpeed; } } else { Momentum = new Vector3(0, 0, 0); World.Grid.AddItem(this); } Entities.MovedTick(this, OriginalChunkTuple); } Entities.AsServerMaybePhaseOut(this); Entities.SendUpdate(Name, Translation); }
public void Equals8_not_equals_to_null() { Assert.That(_tuple8.Equals(null), Is.False); }