Skip to content

Commit

Permalink
Fix large wall mount clipping (RE-SS3D#1347) (RE-SS3D#1433)
Browse files Browse the repository at this point in the history
* Fix large wall mount clipping (RE-SS3D#1347)

* Set isLarge on the wall mounts that clip
  • Loading branch information
withwater authored Mar 15, 2024
1 parent 6222a50 commit 1fdb32a
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 4584c35d672b8a74797cc5efa123ce16, type: 3}
m_Name: APC
m_EditorClassIdentifier:
nameString: apc
prefab: {fileID: 5287103069661579500, guid: 4c966398d6624164c910cd29c1faa980, type: 3}
icon: {fileID: 0}
layer: 6
genericType: 0
specificType: 0
width: 1
height: 1
isLarge: 1
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 4584c35d672b8a74797cc5efa123ce16, type: 3}
m_Name: AirAlarm
m_EditorClassIdentifier:
nameString: airalarm
prefab: {fileID: 6961426338783081091, guid: 11a2276338ebc64429dfc565b491e437, type: 3}
icon: {fileID: 0}
layer: 6
genericType: 0
specificType: 0
width: 1
height: 1
isLarge: 1
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 4584c35d672b8a74797cc5efa123ce16, type: 3}
m_Name: FireAlarm
m_EditorClassIdentifier:
nameString: firealarm
prefab: {fileID: 4866668043303595546, guid: 50dd6be959d44844ab1abf8a3f2adb01, type: 3}
icon: {fileID: 0}
layer: 6
genericType: 0
specificType: 0
width: 1
height: 1
isLarge: 1
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 4584c35d672b8a74797cc5efa123ce16, type: 3}
m_Name: Mirror
m_EditorClassIdentifier:
nameString: mirror
prefab: {fileID: 4866668043303595546, guid: a777a6da30f0704478e25312963a8151, type: 3}
icon: {fileID: 21300000, guid: 9e89894392ee65f45bd559d4619cbade, type: 3}
layer: 6
genericType: 0
specificType: 0
width: 1
height: 1
isLarge: 1
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 4584c35d672b8a74797cc5efa123ce16, type: 3}
m_Name: PosterHorizontal
m_EditorClassIdentifier:
nameString: poster_horizontal
prefab: {fileID: 5161561551087789900, guid: fdaaabc96a55d824a86a3636906240c1, type: 3}
icon: {fileID: 0}
layer: 6
genericType: 0
specificType: 0
width: 1
height: 1
isLarge: 1
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 4584c35d672b8a74797cc5efa123ce16, type: 3}
m_Name: PosterVertical
m_EditorClassIdentifier:
nameString: poster_vertical
prefab: {fileID: 5927714388255546572, guid: 0d6ab6288624c7348bdcbfb81d07088f, type: 3}
icon: {fileID: 0}
layer: 6
genericType: 0
specificType: 0
width: 1
height: 1
isLarge: 1
4 changes: 4 additions & 0 deletions Assets/Scripts/SS3D/Systems/Tile/BuildChecker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ public static bool CanBuild(ITileLocation[] tileLocations, TileObjectSo tileObje
case TileLayer.WallMountHigh when canBuild:
case TileLayer.WallMountLow when canBuild:
{
// If a wall mount is large, check to see if there are other large wall mounts
canBuild &= !(tileObjectSo.isLarge && !tileLocations[(int)placedLayer].IsEmpty(TileHelper.GetNextCardinalDir(dir)));
canBuild &= !(tileObjectSo.isLarge && !tileLocations[(int)placedLayer].IsEmpty(TileHelper.GetPreviousCardinalDir(dir)));

canBuild &= CanBuildWallAttachment((SingleTileLocation) tileLocations[(int)TileLayer.Turf],
tileObjectSo, dir, adjacentObjects);
break;
Expand Down
3 changes: 3 additions & 0 deletions Assets/Scripts/SS3D/Systems/Tile/SO/TileObjectSo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ public class TileObjectSo : GenericObjectSo
public int width = 1;
public int height = 1;

// Whether or not a wall mount is large
public bool isLarge;

/// <summary>
/// TODO : document and understand properly this method. Why the diagonal directions are not treated ?
/// </summary>
Expand Down

0 comments on commit 1fdb32a

Please sign in to comment.