Per-map parallax support (#9786)
* Per-map parallax support * Comments for future sloth * c * bet * Fix exception * VV support * Fix parallax * mem * weightless sounds * Gravity stuff * placeholder coz im too lazy to stash don't @ me son * decent clouds * sky * Fast parallax * Imagine spelling * Loicense * perish * Fix weightless status Co-authored-by: metalgearsloth <metalgearsloth@gmail.com>
This commit is contained in:
@@ -25,6 +25,7 @@ namespace Content.Shared.Friction
|
||||
|
||||
private float _stopSpeed;
|
||||
private float _frictionModifier;
|
||||
private const float DefaultFriction = 0.3f;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -168,15 +169,19 @@ namespace Content.Shared.Friction
|
||||
private float GetTileFriction(PhysicsComponent body, TransformComponent xform)
|
||||
{
|
||||
// TODO: Make IsWeightless event-based; we already have grid traversals tracked so just raise events
|
||||
if (_gravity.IsWeightless(body.Owner, body, xform) ||
|
||||
!_mapManager.TryGetGrid(xform.GridUid, out var grid))
|
||||
if (_gravity.IsWeightless(body.Owner, body, xform))
|
||||
return 0.0f;
|
||||
|
||||
if (!xform.Coordinates.IsValid(EntityManager)) return 0.0f;
|
||||
|
||||
var tile = grid.GetTileRef(xform.Coordinates);
|
||||
var tileDef = _tileDefinitionManager[tile.Tile.TypeId];
|
||||
return tileDef.Friction;
|
||||
if (_mapManager.TryGetGrid(xform.GridUid, out var grid))
|
||||
{
|
||||
var tile = grid.GetTileRef(xform.Coordinates);
|
||||
var tileDef = _tileDefinitionManager[tile.Tile.TypeId];
|
||||
return tileDef.Friction;
|
||||
}
|
||||
|
||||
return TryComp<TileFrictionModifierComponent>(xform.MapUid, out var friction) ? friction.Modifier : DefaultFriction;
|
||||
}
|
||||
|
||||
[NetSerializable, Serializable]
|
||||
|
||||
Reference in New Issue
Block a user