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.Atmos;
|
||||||
|
using Content.Shared.Movement.Systems;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
@@ -30,6 +31,8 @@ namespace Content.Shared.Maps
|
|||||||
|
|
||||||
[DataField("edgeSprites")] public Dictionary<Direction, ResPath> EdgeSprites { get; private set; } = new();
|
[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("isSubfloor")] public bool IsSubFloor { get; private set; }
|
||||||
|
|
||||||
[DataField("baseTurf")]
|
[DataField("baseTurf")]
|
||||||
@@ -72,6 +75,25 @@ namespace Content.Shared.Maps
|
|||||||
public string ItemDropPrototypeName { get; private set; } = "FloorTileItemSteel";
|
public string ItemDropPrototypeName { get; private set; } = "FloorTileItemSteel";
|
||||||
|
|
||||||
[DataField("isSpace")] public bool IsSpace { get; private set; }
|
[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;
|
[DataField("sturdy")] public bool Sturdy { get; private set; } = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ namespace Content.Shared.Movement.Systems
|
|||||||
[Dependency] private readonly MobStateSystem _mobState = default!;
|
[Dependency] private readonly MobStateSystem _mobState = default!;
|
||||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||||
[Dependency] private readonly SharedContainerSystem _container = default!;
|
[Dependency] private readonly SharedContainerSystem _container = default!;
|
||||||
|
[Dependency] private readonly SharedMapSystem _mapSystem = default!;
|
||||||
[Dependency] private readonly SharedGravitySystem _gravity = default!;
|
[Dependency] private readonly SharedGravitySystem _gravity = default!;
|
||||||
[Dependency] protected readonly SharedPhysicsSystem Physics = default!;
|
[Dependency] protected readonly SharedPhysicsSystem Physics = default!;
|
||||||
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
||||||
@@ -156,8 +157,20 @@ namespace Content.Shared.Movement.Systems
|
|||||||
return;
|
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;
|
UsedMobMovement[uid] = true;
|
||||||
// Specifically don't use mover.Owner because that may be different to the actual physics body being moved.
|
// 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 weightless = _gravity.IsWeightless(physicsUid, physicsComponent, xform);
|
||||||
var (walkDir, sprintDir) = GetVelocityInput(mover);
|
var (walkDir, sprintDir) = GetVelocityInput(mover);
|
||||||
var touching = false;
|
var touching = false;
|
||||||
@@ -214,15 +227,15 @@ namespace Content.Shared.Movement.Systems
|
|||||||
{
|
{
|
||||||
if (worldTotal != Vector2.Zero || moveSpeedComponent?.FrictionNoInput == null)
|
if (worldTotal != Vector2.Zero || moveSpeedComponent?.FrictionNoInput == null)
|
||||||
{
|
{
|
||||||
friction = moveSpeedComponent?.Friction ?? MovementSpeedModifierComponent.DefaultFriction;
|
friction = tileDef?.MobFriction ?? moveSpeedComponent?.Friction ?? MovementSpeedModifierComponent.DefaultFriction;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
friction = moveSpeedComponent.FrictionNoInput ?? MovementSpeedModifierComponent.DefaultFrictionNoInput;
|
friction = tileDef?.MobFrictionNoInput ?? moveSpeedComponent.FrictionNoInput ?? MovementSpeedModifierComponent.DefaultFrictionNoInput;
|
||||||
}
|
}
|
||||||
|
|
||||||
weightlessModifier = 1f;
|
weightlessModifier = 1f;
|
||||||
accel = moveSpeedComponent?.Acceleration ?? MovementSpeedModifierComponent.DefaultAcceleration;
|
accel = tileDef?.MobAcceleration ?? moveSpeedComponent?.Acceleration ?? MovementSpeedModifierComponent.DefaultAcceleration;
|
||||||
}
|
}
|
||||||
|
|
||||||
var minimumFrictionSpeed = moveSpeedComponent?.MinimumFrictionSpeed ?? MovementSpeedModifierComponent.DefaultMinimumFrictionSpeed;
|
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?
|
// island solver"??. So maybe SetRotation needs an argument to avoid raising an event?
|
||||||
|
|
||||||
if (!weightless && MobMoverQuery.TryGetComponent(uid, out var mobMover) &&
|
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;
|
var soundModifier = mover.Sprinting ? 3.5f : 1.5f;
|
||||||
|
|
||||||
@@ -373,7 +386,14 @@ namespace Content.Shared.Movement.Systems
|
|||||||
|
|
||||||
protected abstract bool CanSound();
|
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;
|
sound = null;
|
||||||
|
|
||||||
@@ -423,10 +443,15 @@ namespace Content.Shared.Movement.Systems
|
|||||||
return true;
|
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;
|
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;
|
tileDef = (ContentTileDefinition) _tileDefinitionManager[tileRef.Tile.TypeId];
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Walking on a tile.
|
if (tileDef == null)
|
||||||
var def = (ContentTileDefinition) _tileDefinitionManager[tileRef.Tile.TypeId];
|
return false;
|
||||||
sound = haveShoes ? def.FootstepSounds : def.BarestepSounds;
|
|
||||||
|
sound = haveShoes ? tileDef.FootstepSounds : tileDef.BarestepSounds;
|
||||||
return sound != null;
|
return sound != null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,6 +81,8 @@ tiles-green-circuit-floor = green circuit floor
|
|||||||
tiles-blue-circuit-floor = blue circuit floor
|
tiles-blue-circuit-floor = blue circuit floor
|
||||||
tiles-snow = snow
|
tiles-snow = snow
|
||||||
tiles-snow-plating = snowed plating
|
tiles-snow-plating = snowed plating
|
||||||
|
tiles-snow-dug = dug snow
|
||||||
|
tiles-ice = ice
|
||||||
tiles-grass-floor = grass floor
|
tiles-grass-floor = grass floor
|
||||||
tiles-asphalt = asphalt
|
tiles-asphalt = asphalt
|
||||||
tiles-planet-grass-floor = grass floor
|
tiles-planet-grass-floor = grass floor
|
||||||
|
|||||||
@@ -441,13 +441,24 @@
|
|||||||
cellularReturnType: Distance2
|
cellularReturnType: Distance2
|
||||||
entities:
|
entities:
|
||||||
- WallRockSnow
|
- 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
|
- !type:BiomeDummyLayer
|
||||||
id: Loot
|
id: Loot
|
||||||
- !type:BiomeTileLayer
|
- !type:BiomeTileLayer
|
||||||
threshold: -1.0
|
threshold: -0.7
|
||||||
tile: FloorSnow
|
|
||||||
- !type:BiomeTileLayer
|
|
||||||
threshold: -0.50
|
|
||||||
tile: FloorSnow
|
tile: FloorSnow
|
||||||
noise:
|
noise:
|
||||||
seed: 0
|
seed: 0
|
||||||
@@ -457,6 +468,7 @@
|
|||||||
- !type:BiomeEntityLayer
|
- !type:BiomeEntityLayer
|
||||||
allowedTiles:
|
allowedTiles:
|
||||||
- FloorSnow
|
- FloorSnow
|
||||||
|
- FloorIce
|
||||||
threshold: 0.95
|
threshold: 0.95
|
||||||
noise:
|
noise:
|
||||||
seed: 3
|
seed: 3
|
||||||
|
|||||||
@@ -62,6 +62,7 @@
|
|||||||
- 1.0
|
- 1.0
|
||||||
- 1.0
|
- 1.0
|
||||||
- 1.0
|
- 1.0
|
||||||
|
edgeSpritePriority: 1
|
||||||
edgeSprites:
|
edgeSprites:
|
||||||
SouthEast: /Textures/Tiles/Planet/Grass/single_edge.png
|
SouthEast: /Textures/Tiles/Planet/Grass/single_edge.png
|
||||||
NorthEast: /Textures/Tiles/Planet/Grass/single_edge.png
|
NorthEast: /Textures/Tiles/Planet/Grass/single_edge.png
|
||||||
@@ -97,7 +98,7 @@
|
|||||||
# Snow
|
# Snow
|
||||||
- type: tile
|
- type: tile
|
||||||
id: FloorSnow
|
id: FloorSnow
|
||||||
name: tiles-snow-floor
|
name: tiles-snow
|
||||||
sprite: /Textures/Tiles/Planet/Snow/snow.png
|
sprite: /Textures/Tiles/Planet/Snow/snow.png
|
||||||
variants: 13
|
variants: 13
|
||||||
placementVariants:
|
placementVariants:
|
||||||
@@ -114,15 +115,50 @@
|
|||||||
- 0.0166
|
- 0.0166
|
||||||
- 0.0116
|
- 0.0116
|
||||||
- 0.0116
|
- 0.0116
|
||||||
#cornerSprites:
|
edgeSpritePriority: 2
|
||||||
# - /Textures/Tiles/Planet/Snow/single_edge.png
|
edgeSprites:
|
||||||
#cardinalSprites:
|
South: /Textures/Tiles/Planet/Snow/snow_double_edge_south.png
|
||||||
# - /Textures/Tiles/Planet/Snow/double_edge.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
|
isSubfloor: true
|
||||||
canCrowbar: false
|
canCrowbar: false
|
||||||
footstepSounds:
|
footstepSounds:
|
||||||
collection: FootstepSnow
|
collection: FootstepSnow
|
||||||
friction: 0.20
|
|
||||||
heatCapacity: 10000
|
heatCapacity: 10000
|
||||||
weather: true
|
weather: true
|
||||||
indestructible: 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"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "snow_corner",
|
"name": "snow_double_edge_south",
|
||||||
"directions": 8
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "snow_surround",
|
"name": "snow_double_edge_east",
|
||||||
"directions": 4
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "gravsnow"
|
"name": "snow_double_edge_north",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "gravsnow_corner",
|
"name": "snow_double_edge_west",
|
||||||
"directions": 8
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "gravsnow_surround",
|
"name": "snow_dug"
|
||||||
"directions": 4
|
},
|
||||||
|
{
|
||||||
|
"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": "plating"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "platingdrift",
|
|
||||||
"directions": 4
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "ice"
|
"name": "ice"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "snowwhite"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "snow0"
|
"name": "snow0"
|
||||||
},
|
},
|
||||||
@@ -81,18 +82,6 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "permafrost"
|
"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 |