Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TEST] add option to enable constraint manager on server #3547

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Source/ACE.Server/Managers/PropertyManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")),
Expand Down
4 changes: 2 additions & 2 deletions Source/ACE.Server/Physics/Managers/ConstraintManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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();
}
}
}
14 changes: 11 additions & 3 deletions Source/ACE.Server/Physics/PhysicsObj.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -617,9 +617,9 @@ public uint GetSetupID()
return PartArray.GetSetupID();
}

public double GetStartConstraintDistance()
public float GetStartConstraintDistance()
{
return (Position.ObjCellID & 0xFFFF) < 0x100 ? 5.0f : 10.0f;
return (Position.ObjCellID & 0xFFFF) < 0x100 ? 10.0f : 5.0f;
}

public float GetStepDownHeight()
Expand Down Expand Up @@ -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?
Expand Down