Ice & snow tile modernization (#19689)
* Add snow tile edges * Changes for edge tile prio * Add support for tile weightlessness * Add weightlessness to ice * snow duggy moments * fix ice thing yeah * actually why even use weightless movement * upd8 nukieplanet * i have no idea what im doing * sprite modifications
@@ -1,4 +1,5 @@
|
||||
using Content.Shared.Atmos;
|
||||
using Content.Shared.Movement.Systems;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Prototypes;
|
||||
@@ -30,6 +31,8 @@ namespace Content.Shared.Maps
|
||||
|
||||
[DataField("edgeSprites")] public Dictionary<Direction, ResPath> EdgeSprites { get; private set; } = new();
|
||||
|
||||
[DataField("edgeSpritePriority")] public int EdgeSpritePriority { get; private set; } = 0;
|
||||
|
||||
[DataField("isSubfloor")] public bool IsSubFloor { get; private set; }
|
||||
|
||||
[DataField("baseTurf")]
|
||||
@@ -72,6 +75,25 @@ namespace Content.Shared.Maps
|
||||
public string ItemDropPrototypeName { get; private set; } = "FloorTileItemSteel";
|
||||
|
||||
[DataField("isSpace")] public bool IsSpace { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Friction override for mob mover in <see cref="SharedMoverController"/>
|
||||
/// </summary>
|
||||
[DataField("mobFriction")]
|
||||
public float? MobFriction { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// No-input friction override for mob mover in <see cref="SharedMoverController"/>
|
||||
/// </summary>
|
||||
[DataField("mobFrictionNoInput")]
|
||||
public float? MobFrictionNoInput { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Accel override for mob mover in <see cref="SharedMoverController"/>
|
||||
/// </summary>
|
||||
[DataField("mobAcceleration")]
|
||||
public float? MobAcceleration { get; private set; }
|
||||
|
||||
[DataField("sturdy")] public bool Sturdy { get; private set; } = true;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -39,6 +39,7 @@ namespace Content.Shared.Movement.Systems
|
||||
[Dependency] private readonly MobStateSystem _mobState = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
[Dependency] private readonly SharedContainerSystem _container = default!;
|
||||
[Dependency] private readonly SharedMapSystem _mapSystem = default!;
|
||||
[Dependency] private readonly SharedGravitySystem _gravity = default!;
|
||||
[Dependency] protected readonly SharedPhysicsSystem Physics = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
||||
@@ -156,8 +157,20 @@ namespace Content.Shared.Movement.Systems
|
||||
return;
|
||||
}
|
||||
|
||||
// Get current tile def for things like speed/weightless mods
|
||||
ContentTileDefinition? tileDef = null;
|
||||
|
||||
if (_mapManager.TryFindGridAt(xform.MapPosition, out var grid, out var gridComp)
|
||||
&& _mapSystem.TryGetTileRef(grid, gridComp, xform.Coordinates, out var tile))
|
||||
{
|
||||
tileDef = (ContentTileDefinition) _tileDefinitionManager[tile.Tile.TypeId];
|
||||
}
|
||||
|
||||
UsedMobMovement[uid] = true;
|
||||
// Specifically don't use mover.Owner because that may be different to the actual physics body being moved.
|
||||
|
||||
// We differentiate between grav/other sources of weightless for tiles which want to use weightless accel (like ice)
|
||||
// but don't care about requiring touching etc
|
||||
var weightless = _gravity.IsWeightless(physicsUid, physicsComponent, xform);
|
||||
var (walkDir, sprintDir) = GetVelocityInput(mover);
|
||||
var touching = false;
|
||||
@@ -214,15 +227,15 @@ namespace Content.Shared.Movement.Systems
|
||||
{
|
||||
if (worldTotal != Vector2.Zero || moveSpeedComponent?.FrictionNoInput == null)
|
||||
{
|
||||
friction = moveSpeedComponent?.Friction ?? MovementSpeedModifierComponent.DefaultFriction;
|
||||
friction = tileDef?.MobFriction ?? moveSpeedComponent?.Friction ?? MovementSpeedModifierComponent.DefaultFriction;
|
||||
}
|
||||
else
|
||||
{
|
||||
friction = moveSpeedComponent.FrictionNoInput ?? MovementSpeedModifierComponent.DefaultFrictionNoInput;
|
||||
friction = tileDef?.MobFrictionNoInput ?? moveSpeedComponent.FrictionNoInput ?? MovementSpeedModifierComponent.DefaultFrictionNoInput;
|
||||
}
|
||||
|
||||
weightlessModifier = 1f;
|
||||
accel = moveSpeedComponent?.Acceleration ?? MovementSpeedModifierComponent.DefaultAcceleration;
|
||||
accel = tileDef?.MobAcceleration ?? moveSpeedComponent?.Acceleration ?? MovementSpeedModifierComponent.DefaultAcceleration;
|
||||
}
|
||||
|
||||
var minimumFrictionSpeed = moveSpeedComponent?.MinimumFrictionSpeed ?? MovementSpeedModifierComponent.DefaultMinimumFrictionSpeed;
|
||||
@@ -236,7 +249,7 @@ namespace Content.Shared.Movement.Systems
|
||||
// island solver"??. So maybe SetRotation needs an argument to avoid raising an event?
|
||||
|
||||
if (!weightless && MobMoverQuery.TryGetComponent(uid, out var mobMover) &&
|
||||
TryGetSound(weightless, uid, mover, mobMover, xform, out var sound))
|
||||
TryGetSound(weightless, uid, mover, mobMover, xform, out var sound, tileDef: tileDef))
|
||||
{
|
||||
var soundModifier = mover.Sprinting ? 3.5f : 1.5f;
|
||||
|
||||
@@ -373,7 +386,14 @@ namespace Content.Shared.Movement.Systems
|
||||
|
||||
protected abstract bool CanSound();
|
||||
|
||||
private bool TryGetSound(bool weightless, EntityUid uid, InputMoverComponent mover, MobMoverComponent mobMover, TransformComponent xform, [NotNullWhen(true)] out SoundSpecifier? sound)
|
||||
private bool TryGetSound(
|
||||
bool weightless,
|
||||
EntityUid uid,
|
||||
InputMoverComponent mover,
|
||||
MobMoverComponent mobMover,
|
||||
TransformComponent xform,
|
||||
[NotNullWhen(true)] out SoundSpecifier? sound,
|
||||
ContentTileDefinition? tileDef = null)
|
||||
{
|
||||
sound = null;
|
||||
|
||||
@@ -423,10 +443,15 @@ namespace Content.Shared.Movement.Systems
|
||||
return true;
|
||||
}
|
||||
|
||||
return TryGetFootstepSound(uid, xform, shoes != null, out sound);
|
||||
return TryGetFootstepSound(uid, xform, shoes != null, out sound, tileDef: tileDef);
|
||||
}
|
||||
|
||||
private bool TryGetFootstepSound(EntityUid uid, TransformComponent xform, bool haveShoes, [NotNullWhen(true)] out SoundSpecifier? sound)
|
||||
private bool TryGetFootstepSound(
|
||||
EntityUid uid,
|
||||
TransformComponent xform,
|
||||
bool haveShoes,
|
||||
[NotNullWhen(true)] out SoundSpecifier? sound,
|
||||
ContentTileDefinition? tileDef = null)
|
||||
{
|
||||
sound = null;
|
||||
|
||||
@@ -466,15 +491,18 @@ namespace Content.Shared.Movement.Systems
|
||||
}
|
||||
}
|
||||
|
||||
if (!grid.TryGetTileRef(position, out var tileRef))
|
||||
// Walking on a tile.
|
||||
// Tile def might have been passed in already from previous methods, so use that
|
||||
// if we have it
|
||||
if (tileDef == null && grid.TryGetTileRef(position, out var tileRef))
|
||||
{
|
||||
sound = null;
|
||||
return false;
|
||||
tileDef = (ContentTileDefinition) _tileDefinitionManager[tileRef.Tile.TypeId];
|
||||
}
|
||||
|
||||
// Walking on a tile.
|
||||
var def = (ContentTileDefinition) _tileDefinitionManager[tileRef.Tile.TypeId];
|
||||
sound = haveShoes ? def.FootstepSounds : def.BarestepSounds;
|
||||
if (tileDef == null)
|
||||
return false;
|
||||
|
||||
sound = haveShoes ? tileDef.FootstepSounds : tileDef.BarestepSounds;
|
||||
return sound != null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,6 +81,8 @@ tiles-green-circuit-floor = green circuit floor
|
||||
tiles-blue-circuit-floor = blue circuit floor
|
||||
tiles-snow = snow
|
||||
tiles-snow-plating = snowed plating
|
||||
tiles-snow-dug = dug snow
|
||||
tiles-ice = ice
|
||||
tiles-grass-floor = grass floor
|
||||
tiles-asphalt = asphalt
|
||||
tiles-planet-grass-floor = grass floor
|
||||
|
||||
@@ -441,13 +441,24 @@
|
||||
cellularReturnType: Distance2
|
||||
entities:
|
||||
- WallRockSnow
|
||||
# Ice tiles
|
||||
- !type:BiomeTileLayer
|
||||
tile: FloorIce
|
||||
threshold: -0.9
|
||||
noise:
|
||||
seed: 0
|
||||
noiseType: Cellular
|
||||
frequency: 0.03
|
||||
lacunarity: 2
|
||||
fractalType: FBm
|
||||
octaves: 5
|
||||
gain: 1
|
||||
cellularDistanceFunction: Euclidean
|
||||
cellularReturnType: Distance2
|
||||
- !type:BiomeDummyLayer
|
||||
id: Loot
|
||||
- !type:BiomeTileLayer
|
||||
threshold: -1.0
|
||||
tile: FloorSnow
|
||||
- !type:BiomeTileLayer
|
||||
threshold: -0.50
|
||||
threshold: -0.7
|
||||
tile: FloorSnow
|
||||
noise:
|
||||
seed: 0
|
||||
@@ -457,6 +468,7 @@
|
||||
- !type:BiomeEntityLayer
|
||||
allowedTiles:
|
||||
- FloorSnow
|
||||
- FloorIce
|
||||
threshold: 0.95
|
||||
noise:
|
||||
seed: 3
|
||||
|
||||
@@ -62,6 +62,7 @@
|
||||
- 1.0
|
||||
- 1.0
|
||||
- 1.0
|
||||
edgeSpritePriority: 1
|
||||
edgeSprites:
|
||||
SouthEast: /Textures/Tiles/Planet/Grass/single_edge.png
|
||||
NorthEast: /Textures/Tiles/Planet/Grass/single_edge.png
|
||||
@@ -97,7 +98,7 @@
|
||||
# Snow
|
||||
- type: tile
|
||||
id: FloorSnow
|
||||
name: tiles-snow-floor
|
||||
name: tiles-snow
|
||||
sprite: /Textures/Tiles/Planet/Snow/snow.png
|
||||
variants: 13
|
||||
placementVariants:
|
||||
@@ -114,15 +115,50 @@
|
||||
- 0.0166
|
||||
- 0.0116
|
||||
- 0.0116
|
||||
#cornerSprites:
|
||||
# - /Textures/Tiles/Planet/Snow/single_edge.png
|
||||
#cardinalSprites:
|
||||
# - /Textures/Tiles/Planet/Snow/double_edge.png
|
||||
edgeSpritePriority: 2
|
||||
edgeSprites:
|
||||
South: /Textures/Tiles/Planet/Snow/snow_double_edge_south.png
|
||||
East: /Textures/Tiles/Planet/Snow/snow_double_edge_east.png
|
||||
North: /Textures/Tiles/Planet/Snow/snow_double_edge_north.png
|
||||
West: /Textures/Tiles/Planet/Snow/snow_double_edge_west.png
|
||||
isSubfloor: true
|
||||
canCrowbar: false
|
||||
footstepSounds:
|
||||
collection: FootstepSnow
|
||||
heatCapacity: 10000
|
||||
weather: true
|
||||
indestructible: true
|
||||
|
||||
# Ice
|
||||
- type: tile
|
||||
id: FloorIce
|
||||
name: tiles-ice
|
||||
sprite: /Textures/Tiles/Planet/Snow/ice.png
|
||||
isSubfloor: true
|
||||
canCrowbar: false
|
||||
friction: 0.05
|
||||
heatCapacity: 10000
|
||||
weather: true
|
||||
mobFriction: 0.5
|
||||
mobFrictionNoInput: 0.05
|
||||
mobAcceleration: 2
|
||||
indestructible: true
|
||||
|
||||
# Dug snow
|
||||
- type: tile
|
||||
id: FloorSnowDug
|
||||
name: tiles-snow-dug
|
||||
sprite: /Textures/Tiles/Planet/Snow/snow_dug.png
|
||||
edgeSpritePriority: 1
|
||||
edgeSprites:
|
||||
South: /Textures/Tiles/Planet/Snow/snow_dug_double_edge_south.png
|
||||
East: /Textures/Tiles/Planet/Snow/snow_dug_double_edge_east.png
|
||||
North: /Textures/Tiles/Planet/Snow/snow_dug_double_edge_north.png
|
||||
West: /Textures/Tiles/Planet/Snow/snow_dug_double_edge_west.png
|
||||
isSubfloor: true
|
||||
canCrowbar: false
|
||||
footstepSounds:
|
||||
collection: FootstepSnow
|
||||
friction: 0.20
|
||||
heatCapacity: 10000
|
||||
weather: true
|
||||
indestructible: true
|
||||
|
||||
|
Before Width: | Height: | Size: 483 B |
|
Before Width: | Height: | Size: 637 B |
|
Before Width: | Height: | Size: 487 B |
|
Before Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 2.9 KiB |
@@ -9,37 +9,38 @@
|
||||
"name": "snow"
|
||||
},
|
||||
{
|
||||
"name": "snow_corner",
|
||||
"directions": 8
|
||||
"name": "snow_double_edge_south",
|
||||
},
|
||||
{
|
||||
"name": "snow_surround",
|
||||
"directions": 4
|
||||
"name": "snow_double_edge_east",
|
||||
},
|
||||
{
|
||||
"name": "gravsnow"
|
||||
"name": "snow_double_edge_north",
|
||||
},
|
||||
{
|
||||
"name": "gravsnow_corner",
|
||||
"directions": 8
|
||||
"name": "snow_double_edge_west",
|
||||
},
|
||||
{
|
||||
"name": "gravsnow_surround",
|
||||
"directions": 4
|
||||
"name": "snow_dug"
|
||||
},
|
||||
{
|
||||
"name": "snow_dug_double_edge_south",
|
||||
},
|
||||
{
|
||||
"name": "snow_dug_double_edge_east",
|
||||
},
|
||||
{
|
||||
"name": "snow_dug_double_edge_north",
|
||||
},
|
||||
{
|
||||
"name": "snow_dug_double_edge_west",
|
||||
},
|
||||
{
|
||||
"name": "plating"
|
||||
},
|
||||
{
|
||||
"name": "platingdrift",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "ice"
|
||||
},
|
||||
{
|
||||
"name": "snowwhite"
|
||||
},
|
||||
{
|
||||
"name": "snow0"
|
||||
},
|
||||
@@ -81,18 +82,6 @@
|
||||
},
|
||||
{
|
||||
"name": "permafrost"
|
||||
},
|
||||
{
|
||||
"name": "edge0",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "edge1",
|
||||
"directions": 4
|
||||
},
|
||||
{
|
||||
"name": "edge2",
|
||||
"directions": 4
|
||||
}
|
||||
]
|
||||
}
|
||||
|
Before Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 4.0 KiB |
BIN
Resources/Textures/Tiles/Planet/Snow/snow_double_edge_east.png
Normal file
|
After Width: | Height: | Size: 500 B |
BIN
Resources/Textures/Tiles/Planet/Snow/snow_double_edge_north.png
Normal file
|
After Width: | Height: | Size: 501 B |
BIN
Resources/Textures/Tiles/Planet/Snow/snow_double_edge_south.png
Normal file
|
After Width: | Height: | Size: 541 B |
BIN
Resources/Textures/Tiles/Planet/Snow/snow_double_edge_west.png
Normal file
|
After Width: | Height: | Size: 493 B |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 389 B |
|
After Width: | Height: | Size: 367 B |
|
After Width: | Height: | Size: 547 B |
|
After Width: | Height: | Size: 354 B |
|
Before Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |