-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add some actions. Add latest libs of Unturned.
- Loading branch information
Showing
6 changed files
with
148 additions
and
0 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
Dummy/Extensions/Interaction/Actions/Barricade/ClaimBedAction.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using Cysharp.Threading.Tasks; | ||
using Dummy.Users; | ||
using SDG.Unturned; | ||
using System.Threading.Tasks; | ||
using UnityEngine; | ||
|
||
namespace Dummy.Extensions.Interaction.Actions.Barricade | ||
{ | ||
public class ClaimBedAction : IInteractionAction | ||
{ | ||
public ClaimBedAction(byte x, byte y, ushort plant, ushort index) | ||
{ | ||
X = x; | ||
Y = y; | ||
Plant = plant; | ||
Index = index; | ||
} | ||
|
||
public ClaimBedAction(Transform barricade) | ||
{ | ||
if (BarricadeManager.tryGetInfo(barricade, out var x, out var y, out var plant, out var index, out _)) | ||
{ | ||
X = x; | ||
Y = y; | ||
Plant = plant; | ||
Index = index; | ||
} | ||
} | ||
|
||
public byte X { get; } | ||
public byte Y { get; } | ||
public ushort Plant { get; } | ||
public ushort Index { get; } | ||
|
||
public async Task Do(DummyUser dummy) | ||
{ | ||
await UniTask.SwitchToMainThread(); | ||
BarricadeManager.instance.askClaimBed(dummy.SteamID, X, Y, Plant, Index); | ||
} | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
Dummy/Extensions/Interaction/Actions/Barricade/SalvageBarricadeAction.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using Cysharp.Threading.Tasks; | ||
using Dummy.Users; | ||
using SDG.Unturned; | ||
using System.Threading.Tasks; | ||
using UnityEngine; | ||
|
||
namespace Dummy.Extensions.Interaction.Actions.Barricade | ||
{ | ||
public class SalvageBarricadeAction : IInteractionAction | ||
{ | ||
public SalvageBarricadeAction(byte x, byte y, ushort plant, ushort index) | ||
{ | ||
X = x; | ||
Y = y; | ||
Plant = plant; | ||
Index = index; | ||
} | ||
|
||
public SalvageBarricadeAction(Transform barricade) | ||
{ | ||
if (BarricadeManager.tryGetInfo(barricade, out var x, out var y, out var plant, out var index, out _)) | ||
{ | ||
X = x; | ||
Y = y; | ||
Plant = plant; | ||
Index = index; | ||
} | ||
} | ||
|
||
public byte X { get; } | ||
public byte Y { get; } | ||
public ushort Plant { get; } | ||
public ushort Index { get; } | ||
|
||
public async Task Do(DummyUser dummy) | ||
{ | ||
await UniTask.SwitchToMainThread(); | ||
BarricadeManager.instance.askSalvageBarricade(dummy.SteamID, X, Y, Plant, Index); | ||
} | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
Dummy/Extensions/Interaction/Actions/Vehicle/EnterVehicleAction.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using Cysharp.Threading.Tasks; | ||
using Dummy.Users; | ||
using SDG.Unturned; | ||
using System; | ||
using System.Threading.Tasks; | ||
|
||
namespace Dummy.Extensions.Interaction.Actions.Vehicle | ||
{ | ||
public class EnterVehicleAction : IInteractionAction | ||
{ | ||
private readonly InteractableVehicle m_InteractableVehicle; | ||
public uint InstanceId { get; } | ||
|
||
public EnterVehicleAction(InteractableVehicle interactableVehicle) | ||
{ | ||
InstanceId = interactableVehicle.instanceID; | ||
m_InteractableVehicle = interactableVehicle; | ||
} | ||
|
||
public EnterVehicleAction(uint instanceId) | ||
{ | ||
InstanceId = instanceId; | ||
m_InteractableVehicle = VehicleManager.findVehicleByNetInstanceID(instanceId); | ||
} | ||
|
||
public async Task Do(DummyUser dummy) | ||
{ | ||
await UniTask.SwitchToMainThread(); | ||
VehicleManager.instance.askEnterVehicle(dummy.SteamID, InstanceId, m_InteractableVehicle.asset.hash, | ||
(byte)m_InteractableVehicle.asset.engine); | ||
} | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
Dummy/Extensions/Interaction/Actions/Vehicle/ExitVehicleAction.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using Cysharp.Threading.Tasks; | ||
using Dummy.Users; | ||
using SDG.Unturned; | ||
using System; | ||
using System.Threading.Tasks; | ||
using UnityEngine; | ||
|
||
namespace Dummy.Extensions.Interaction.Actions.Vehicle | ||
{ | ||
public class ExitVehicleAction : IInteractionAction | ||
{ | ||
private readonly InteractableVehicle m_InteractableVehicle; | ||
public uint InstanceId { get; } | ||
|
||
public ExitVehicleAction(uint instanceId) | ||
{ | ||
InstanceId = instanceId; | ||
m_InteractableVehicle = VehicleManager.findVehicleByNetInstanceID(instanceId) | ||
?? throw new ArgumentException(nameof(m_InteractableVehicle)); | ||
} | ||
|
||
public ExitVehicleAction(InteractableVehicle interactableVehicle) | ||
{ | ||
InstanceId = interactableVehicle.instanceID; | ||
} | ||
|
||
public async Task Do(DummyUser dummy) | ||
{ | ||
await UniTask.SwitchToMainThread(); | ||
VehicleManager.instance.askExitVehicle(dummy.SteamID, Vector3.zero); | ||
} | ||
} | ||
} |
Binary file not shown.
Binary file not shown.