File tree Expand file tree Collapse file tree 3 files changed +12
-55
lines changed
Framework/Intersect.Framework.Core/Config
Intersect.Client.Core/Entities
Intersect.Server.Core/Entities Expand file tree Collapse file tree 3 files changed +12
-55
lines changed Original file line number Diff line number Diff line change 1- using Newtonsoft . Json ;
1+ using Intersect . Framework . Core . GameObjects . Maps ;
22
33namespace Intersect . Config ;
44
5- public partial class PassabilityOptions
5+ public partial class PassabilityOptions : Dictionary < MapZone , bool >
66{
7- private bool [ ] ? _cache ;
8- private bool _arena ;
9- private bool _normal ;
10- private bool _safe = true ;
7+ public bool Default { get ; set ; } = false ;
118
12- public bool Arena
9+ public PassabilityOptions ( )
1310 {
14- get => _arena ;
15- set
16- {
17- if ( value == _arena )
18- {
19- return ;
20- }
21-
22- _arena = value ;
23- _cache = null ;
24- }
25- }
26-
27- //Can players move through each other on the following map types/moralities
28- public bool Normal
29- {
30- get => _normal ;
31- set
32- {
33- if ( value == _arena )
34- {
35- return ;
36- }
37-
38- _normal = value ;
39- _cache = null ;
40- }
41- }
42-
43- public bool Safe
44- {
45- get => _safe ;
46- set
47- {
48- if ( value == _arena )
49- {
50- return ;
51- }
52-
53- _safe = value ;
54- _cache = null ;
55- }
11+ this [ MapZone . Arena ] = false ;
12+ this [ MapZone . Normal ] = false ;
13+ this [ MapZone . Safe ] = true ;
5614 }
5715
58- [ JsonIgnore ]
59- public bool [ ] Passable => _cache ??= [ Normal , Safe , Arena ] ;
16+ public bool IsPassable ( MapZone mapZoneType ) => TryGetValue ( mapZoneType , out var passable ) ? passable : Default ;
6017}
Original file line number Diff line number Diff line change @@ -2523,9 +2523,9 @@ public int IsTileBlocked(
25232523 break ;
25242524
25252525 case Player player :
2526- //Return the entity key as this should block the player. Only exception is if the MapZone this entity is on is passable.
2527- var entityMap = Maps . MapInstance . Get ( player . MapId ) ;
2528- if ( Options . Instance . Passability . Passable [ ( int ) entityMap . ZoneType ] )
2526+ // Return the entity key as this should block the player. Only exception is if the MapZone this entity is on is passable.
2527+ if ( Maps . MapInstance . TryGet ( player . MapId , out var playerMapInstance ) &&
2528+ Options . Instance . Passability . IsPassable ( playerMapInstance . ZoneType ) )
25292529 {
25302530 continue ;
25312531 }
Original file line number Diff line number Diff line change @@ -7298,7 +7298,7 @@ out EntityType entityType
72987298
72997299 protected override bool CanPassPlayer ( MapController targetMap )
73007300 {
7301- return Options . Instance . Passability . Passable [ ( int ) targetMap . ZoneType ] ;
7301+ return Options . Instance . Passability . IsPassable ( Map . ZoneType ) ;
73027302 }
73037303
73047304 protected override bool IsBlockedByEvent (
You can’t perform that action at this time.
0 commit comments