Skip to content

Commit

Permalink
door fix
Browse files Browse the repository at this point in the history
- doors that are considered walls even when theyre open, will now allow players to walk on them
  • Loading branch information
Sichii committed Dec 4, 2024
1 parent f8323cf commit c1c304d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
15 changes: 12 additions & 3 deletions Chaos/Collections/MapInstance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -720,12 +720,21 @@ public bool IsWalkable(IPoint point, CreatureType creatureType, bool? ignoreBloc

public bool IsWall(IPoint point)
{
if (Template.IsWall(point))
return true;

var door = GetEntitiesAtPoints<Door>(point)
.FirstOrDefault();

//if there's an open door (even if that door is considered a wall)
//allow them to walk on the spot
if (door is { Closed: false })
return false;

//if the spot is a wall (or a closed door)
//prevent them from walking
if (Template.IsWall(point))
return true;

//if there's a closed door return false
//otherwise return true
return door?.Closed ?? false;
}

Expand Down
15 changes: 9 additions & 6 deletions Chaos/Definitions/CHAOS_CONSTANTS.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#region
using System.Collections.Frozen;
using Chaos.DarkAges.Definitions;
#endregion

namespace Chaos.Definitions;

Expand Down Expand Up @@ -28,12 +30,13 @@ public static class CHAOS_CONSTANTS
// @formatter:max_array_initializer_elements_on_line 10000
public static readonly FrozenSet<ushort> DOOR_TILE_IDS = new ushort[]
{
1994, 1997, 2000, 2003, 2163, 2164, 2165, 2196, 2197, 2198, 2227, 2228, 2229, 2260, 2261, 2262, 2291, 2292, 2293, 2328, 2329, 2330,
2432, 2436, 2461, 2465, 2673, 2674, 2675, 2680, 2681, 2682, 2687, 2688, 2689, 2694, 2695, 2696, 2714, 2715, 2721, 2722, 2727, 2728,
2734, 2735, 2761, 2762, 2768, 2769, 2776, 2777, 2783, 2784, 2850, 2851, 2852, 2857, 2858, 2859, 2874, 2875, 2876, 2881, 2882, 2883,
2897, 2898, 2903, 2904, 2923, 2924, 2929, 2930, 2945, 2946, 2951, 2952, 2971, 2972, 2977, 2978, 2993, 2994, 2999, 3000, 3019, 3020,
3025, 3026, 3058, 3059, 3066, 3067, 3090, 3091, 3098, 3099, 3118, 3119, 3126, 3127, 3150, 3151, 3158, 3159, 3178, 3179, 3186, 3187,
3210, 3211, 3218, 3219, 4519, 4520, 4521, 4523, 4524, 4525, 4527, 4528, 4529, 4532, 4533, 4534, 4536, 4537, 4538, 4540, 4541, 4542
1994, 1996, 1997, 2000, 2001, 2003, 2004, 2163, 2164, 2165, 2196, 2197, 2198, 2227, 2228, 2229, 2260, 2261, 2262, 2291, 2292, 2293,
2328, 2329, 2330, 2432, 2436, 2461, 2465, 2673, 2674, 2675, 2680, 2681, 2682, 2687, 2688, 2689, 2694, 2695, 2696, 2714, 2715, 2721,
2722, 2727, 2728, 2734, 2735, 2761, 2762, 2768, 2769, 2776, 2777, 2783, 2784, 2850, 2851, 2852, 2857, 2858, 2859, 2874, 2875, 2876,
2881, 2882, 2883, 2897, 2898, 2903, 2904, 2923, 2924, 2929, 2930, 2945, 2946, 2951, 2952, 2971, 2972, 2977, 2978, 2993, 2994, 2999,
3000, 3019, 3020, 3025, 3026, 3058, 3059, 3066, 3067, 3090, 3091, 3098, 3099, 3118, 3119, 3126, 3127, 3150, 3151, 3158, 3159, 3178,
3179, 3186, 3187, 3210, 3211, 3218, 3219, 4519, 4520, 4521, 4523, 4524, 4525, 4527, 4528, 4529, 4532, 4533, 4534, 4536, 4537, 4538,
4540, 4541, 4542
}.ToFrozenSet();

// @formatter:max_array_initializer_elements_on_line restore
Expand Down

0 comments on commit c1c304d

Please sign in to comment.