Skip to content

Commit fb9a6c7

Browse files
committed
1.1.3.3
Major fixes.
1 parent ebb756e commit fb9a6c7

File tree

5 files changed

+22
-24
lines changed

5 files changed

+22
-24
lines changed

Config.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
/// </summary>
77
public partial class Config : IRocketPluginConfiguration
88
{
9+
public bool DebugInformation = true;
910
public List<Zone> Zones = new();
1011
public void LoadDefaults()
1112
{

Controllers/ZoneController.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,17 +104,15 @@ private void SetEnterState(Zombie zombie, bool state)
104104
protected virtual float UpdateCollidersDelay { get; } = 0.2f;
105105
protected void UpdateEnteredColliders(IList<Collider> colliders)
106106
{
107-
for (int i = 0; i < colliders.Count;)
107+
for (int i = 0; i < colliders.Count;i++)
108108
{
109-
var collider = colliders.ElementAtOrDefault(i);
109+
var collider = colliders.ElementAt(i);
110110
if (!collider)
111111
{
112-
colliders.Remove(collider);
113-
i--;
112+
colliders.RemoveAt(i--);
114113
continue;
115114
}
116115
UpdateEnterState(collider);
117-
i++;
118116
}
119117
}
120118
protected virtual void UpdateEnteredColliders() => UpdateEnteredColliders(enteredColliders);
@@ -188,6 +186,8 @@ protected override void Awake()
188186
foreach (var collider in GetComponents<Collider>()) // remove previous colliders
189187
Destroy(collider);
190188
Collider.isTrigger = true;
189+
Collider.material = Collider.sharedMaterial = null;
190+
gameObject.layer = LayerMasks.CLIP;
191191
base.Awake();
192192
}
193193
}

SZones.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<TargetFrameworks>net472</TargetFrameworks>
66
<AssemblyName>SZones</AssemblyName>
77
<RootNamespace>SZones</RootNamespace>
8-
<Version>1.1.3.2</Version>
8+
<Version>1.1.3.3</Version>
99
<NoWarn>$(NoWarn);CS0436</NoWarn>
1010
<RunPostBuildEvent>Always</RunPostBuildEvent>
1111
<Nullable>annotations</Nullable>

ZoneManager.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ public static void Delete(Zone zone)
2222
public static void Save()
2323
{
2424
var config = inst?.Configuration;
25-
lock (config)
26-
config.Save();
25+
lock (config) config.Save();
2726
}
2827

2928
protected override void Unload()
@@ -35,7 +34,6 @@ protected override void Load()
3534
{
3635
foreach (var zone in Zones)
3736
zone.Initialize();
38-
Physics.queriesHitTriggers = false;
3937
}
4038

4139
public static Zone Get(string name) => conf.Zones.FindByName(x => x.Name, name);

Zones/Zone.cs

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public virtual SVector3 Position
2020
Object.transform.position = value;
2121
}
2222
}
23-
public virtual bool ShouldSerializePosition() => true;
23+
public virtual bool ShouldSerializePosition() => true;
2424

2525
[XmlIgnore, JsonIgnore]
2626
public virtual ZoneController Controller { get; protected set; }
@@ -31,15 +31,16 @@ public virtual SVector3 Position
3131

3232
internal virtual void Initialize()
3333
{
34-
if (Object is not null) return;
34+
if (Object) return;
3535
UnityObject.DontDestroyOnLoad(Object = UnityObject.Instantiate(Prefab));
36-
UnityObject.Destroy(Object.GetComponent<Rigidbody>());
36+
foreach(var body in Object.GetComponents<Rigidbody>())
37+
UnityObject.Destroy(body);
3738
Position = position; // update position
3839
}
3940
internal virtual void Dispose()
4041
{
41-
UnityObject.Destroy(Object);
42-
Controller.Dispose();
42+
if (Controller) UnityObject.Destroy(Controller);
43+
if (Object) UnityObject.Destroy(Object);
4344
}
4445

4546
public override string ToString() => ToJsonString(this, true, new ValueTypeToStringJsonConverter());
@@ -54,25 +55,23 @@ internal override void Initialize()
5455
{
5556
base.Initialize();
5657
(Controller = Object.GetOrAddComponent<TController>()).Initialize(this);
57-
#if DEBUG // information for debug
58-
Controller.OnPlayerEnter += PlayerEnterHandler;
59-
Controller.OnPlayerExit += PlayerExitHandler;
60-
#endif
58+
Controller.OnPlayerEnter += Debug_PlayerEnterHandler;
59+
Controller.OnPlayerExit += Debug_PlayerExitHandler;
6160
}
6261
internal override void Dispose()
6362
{
64-
#if DEBUG
65-
Controller.OnPlayerEnter -= PlayerEnterHandler;
66-
Controller.OnPlayerExit -= PlayerExitHandler;
67-
#endif
63+
Controller.OnPlayerEnter -= Debug_PlayerEnterHandler;
64+
Controller.OnPlayerExit -= Debug_PlayerExitHandler;
6865
base.Dispose();
6966
}
70-
private void PlayerEnterHandler(Player player)
67+
private void Debug_PlayerEnterHandler(Player player)
7168
{
69+
if (!conf.DebugInformation) return;
7270
player.ReceiveMessage($"Enter {Name}");
7371
}
74-
private void PlayerExitHandler(Player player)
72+
private void Debug_PlayerExitHandler(Player player)
7573
{
74+
if (!conf.DebugInformation) return;
7675
player.ReceiveMessage($"Exit {Name}");
7776
}
7877
}

0 commit comments

Comments
 (0)