Skip to content

Commit 2303a6d

Browse files
authored
p34.6 hotfix (#510)
1 parent 35c92d4 commit 2303a6d

File tree

7 files changed

+64
-3
lines changed

7 files changed

+64
-3
lines changed

src/Perpetuum/Services/Channels/ChatCommands/AdminCommandHandlers.cs

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ private static void ZoneSetTilesControl(AdminCommandData data, TerrainControlFla
7272
}
7373
SendMessageToAll(data, string.Format("Altered state of control layer on {0} Tiles ({1}: set to {2})", lockedtiles.Count, flag, adddelete));
7474
}
75+
7576
private static void LockOrUnlockZoneLayers(AdminCommandData data, bool toLock)
7677
{
7778
if (!IsDevModeEnabled(data))
@@ -102,6 +103,39 @@ private static void LockOrUnlockZoneLayers(AdminCommandData data, bool toLock)
102103
zone.IsLayerEditLocked = toLock;
103104
SendMessageToAll(data, $"All layers on zone {zoneId} {(toLock ? "LOCKED" : "UNLOCKED")}!");
104105
}
106+
107+
private static void SwitchZoneDegrade(AdminCommandData data, bool state)
108+
{
109+
if (!IsDevModeEnabled(data))
110+
{
111+
return;
112+
}
113+
114+
bool err = false;
115+
int zoneId = -1;
116+
if (data.Command.Args.IsNullOrEmpty())
117+
{
118+
Character character = data.Request.Session.Character;
119+
zoneId = character.ZoneId ?? -1;
120+
}
121+
else if (data.Command.Args.Length >= 1)
122+
{
123+
err = !int.TryParse(data.Command.Args[0], out int id);
124+
zoneId = id;
125+
}
126+
127+
if (err)
128+
{
129+
SendMessageToAll(data, "Error parsing args");
130+
throw PerpetuumException.Create(ErrorCodes.RequiredArgumentIsNotSpecified);
131+
}
132+
133+
CheckZoneId(data, zoneId);
134+
IZone zone = data.Request.Session.ZoneMgr.GetZone(zoneId);
135+
zone.TerraformHandler.Degrade = state;
136+
SendMessageToAll(data, $"Zone {zoneId} degrade {(state ? "ENABLED" : "DISABLED")}!");
137+
}
138+
105139
public static void CheckZoneId(AdminCommandData data, int zoneId)
106140
{
107141
if (!data.Request.Session.ZoneMgr.ContainsZone(zoneId))
@@ -1507,11 +1541,25 @@ public static void ZoneLockLayers(AdminCommandData data)
15071541
{
15081542
LockOrUnlockZoneLayers(data, true);
15091543
}
1544+
15101545
[ChatCommand("ZoneUnlockLayers")]
15111546
public static void ZoneUnlockLayers(AdminCommandData data)
15121547
{
15131548
LockOrUnlockZoneLayers(data, false);
15141549
}
1550+
1551+
[ChatCommand("ZoneDisableDegrade")]
1552+
public static void ZoneDisableDegrade(AdminCommandData data)
1553+
{
1554+
SwitchZoneDegrade(data, false);
1555+
}
1556+
1557+
[ChatCommand("ZoneEnableDegrade")]
1558+
public static void ZoneEnableDegrade(AdminCommandData data)
1559+
{
1560+
SwitchZoneDegrade(data, true);
1561+
}
1562+
15151563
[ChatCommand("TestMissions")]
15161564
public static void TestMissions(AdminCommandData data)
15171565
{

src/Perpetuum/Zones/FieldEffectGenerators/FieldEccmEffectGenerator.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ private int EmitRadius
5757
public void SetDespawnTime(TimeSpan despawnTime)
5858
{
5959
_despawnHelper = UnitDespawnHelper.Create(this, despawnTime);
60+
_despawnHelper.DespawnStrategy = Kill;
6061
}
6162

6263
public void ApplyFieldEffect()

src/Perpetuum/Zones/FieldEffectGenerators/FieldReactorStabilizerEffectGenerator.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ private int EmitRadius
5858
public void SetDespawnTime(TimeSpan despawnTime)
5959
{
6060
_despawnHelper = UnitDespawnHelper.Create(this, despawnTime);
61+
_despawnHelper.DespawnStrategy = Kill;
6162
}
6263

6364
public void ApplyFieldEffect()

src/Perpetuum/Zones/FieldEffectGenerators/FieldStealthEffectGenerator.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ private int EmitRadius
5454
public void SetDespawnTime(TimeSpan despawnTime)
5555
{
5656
_despawnHelper = UnitDespawnHelper.Create(this, despawnTime);
57+
_despawnHelper.DespawnStrategy = Kill;
5758
}
5859

5960
public void ApplyFieldEffect()

src/Perpetuum/Zones/LandMines/LandMine.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,11 @@ public override void AcceptVisitor(IEntityVisitor visitor)
115115

116116
public override void OnUnitsFound(List<Player> unitsFound)
117117
{
118-
throw new NotImplementedException();
118+
}
119+
120+
protected override ProximityDeviceBase GetThis()
121+
{
122+
return this;
119123
}
120124
#endregion
121125
}

src/Perpetuum/Zones/ProximityProbes/ProximityDevice.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,11 @@ public virtual void CheckDeploymentAndThrow(IZone zone, Position spawnPosition)
4444
zone.Units.OfType<ProximityDeviceBase>().WithinRange(spawnPosition, DistanceConstants.PROXIMITY_PROBE_DEPLOY_RANGE_FROM_PROBE).Any().ThrowIfTrue(ErrorCodes.TooCloseToOtherDevice);
4545
}
4646

47+
protected abstract ProximityDeviceBase GetThis();
48+
4749
public void SetDespawnTime(TimeSpan despawnTime)
4850
{
49-
_despawnHelper = UnitDespawnHelper.Create(this, despawnTime);
51+
_despawnHelper = UnitDespawnHelper.Create(GetThis(), despawnTime);
5052
_despawnHelper.DespawnStrategy = Kill;
5153
}
5254

src/Perpetuum/Zones/ProximityProbes/ProximityProbe.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,11 @@ public override void OnUnitsFound(List<Player> unitsFound)
102102

103103
public override void OnUnitsFound(List<Robot> unitsFound)
104104
{
105-
throw new System.NotImplementedException();
105+
}
106+
107+
protected override ProximityDeviceBase GetThis()
108+
{
109+
return this;
106110
}
107111
}
108112
}

0 commit comments

Comments
 (0)