Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add option to enable constraint manager on server
Browse files Browse the repository at this point in the history
gmriggs committed May 19, 2021
1 parent 0ba331a commit dd3f8f5
Showing 3 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions Source/ACE.Server/Managers/PropertyManager.cs
Original file line number Diff line number Diff line change
@@ -593,6 +593,7 @@ public static void LoadDefaultProperties()
("trajectory_alt_solver", new Property<bool>(false, "use the alternate trajectory solver for missiles and spell projectiles")),
("universal_masteries", new Property<bool>(true, "if TRUE, matches end of retail masteries - players wielding almost any weapon get +5 DR, except if the weapon \"seems tough to master\". " +
"if FALSE, players start with mastery of 1 melee and 1 ranged weapon type based on heritage, and can later re-select these 2 masteries")),
("use_constraint_manager", new Property<bool>(false, "enables the constraint manager on the server, which can mitigate some of the desyncs between the client and server movement methods")),
("use_generator_rotation_offset", new Property<bool>(true, "enables or disables using the generator's current rotation when offseting relative positions")),
("use_turbine_chat", new Property<bool>(true, "enables or disables global chat channels (General, LFG, Roleplay, Trade, Olthoi, Society, Allegience)")),
("use_wield_requirements", new Property<bool>(true, "disable this to bypass wield requirements. mostly for dev debugging")),
4 changes: 2 additions & 2 deletions Source/ACE.Server/Physics/Managers/ConstraintManager.cs
Original file line number Diff line number Diff line change
@@ -36,7 +36,7 @@ public void ConstrainTo(Position position, float startDistance, float maxDistanc

public bool IsFullyConstrained()
{
return ConstraintDistanceMax * 0.9f < ConstraintPosOffset;
return ConstraintPosOffset > ConstraintDistanceMax * 0.9f;
}

public void SetPhysicsObject(PhysicsObj obj)
@@ -73,7 +73,7 @@ public void adjust_offset(AFrame offset, double quantum)
else
offset.Origin = Vector3.Zero;
}
ConstraintPosOffset = offset.Origin.Length();
ConstraintPosOffset += offset.Origin.Length();
}
}
}
12 changes: 10 additions & 2 deletions Source/ACE.Server/Physics/PhysicsObj.cs
Original file line number Diff line number Diff line change
@@ -567,7 +567,7 @@ public float GetHeight()
return PartArray.GetHeight();
}

public double GetMaxConstraintDistance()
public float GetMaxConstraintDistance()
{
return (Position.ObjCellID & 0xFFFF) < 0x100 ? 50.0f : 20.0f;
}
@@ -617,7 +617,7 @@ public uint GetSetupID()
return PartArray.GetSetupID();
}

public double GetStartConstraintDistance()
public float GetStartConstraintDistance()
{
return (Position.ObjCellID & 0xFFFF) < 0x100 ? 5.0f : 10.0f;
}
@@ -4345,6 +4345,14 @@ public bool update_object_server_new(bool forcePos = true)
}

set_current_pos(RequestPos);

if (PropertyManager.GetBool("use_constraint_manager").Item)
{
var startDist = GetStartConstraintDistance();
var maxDist = GetMaxConstraintDistance();

ConstrainTo(RequestPos, startDist, maxDist);
}
}

// for teleport, use SetPosition?

0 comments on commit dd3f8f5

Please sign in to comment.