mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2024-11-15 00:37:09 +00:00
add command "enemy"
This commit is contained in:
parent
ed023bdcf7
commit
217bf12473
3 changed files with 29 additions and 0 deletions
|
@ -468,6 +468,13 @@ namespace SanAndreasUnity.Behaviours
|
|||
this.TargetPed = ped;
|
||||
}
|
||||
|
||||
public void StartChasing(Ped ped)
|
||||
{
|
||||
this.Action = PedAIAction.Chasing;
|
||||
this.TargetPed = ped;
|
||||
_enemyPeds.AddIfNotPresent(ped);
|
||||
}
|
||||
|
||||
public void Recruit(Ped recruiterPed)
|
||||
{
|
||||
if (this.Action == PedAIAction.Following)
|
||||
|
|
|
@ -52,6 +52,13 @@ namespace SanAndreasUnity.Behaviours
|
|||
return ped.gameObject.GetOrAddComponent<PedAI>();
|
||||
}
|
||||
|
||||
public static PedAI SpawnPedAI(int pedId, Transform nearbyTransform)
|
||||
{
|
||||
if (GetPositionForPedSpawn (out var pos, out var rot, nearbyTransform))
|
||||
return SpawnPedAI(pedId, pos, rot);
|
||||
return null;
|
||||
}
|
||||
|
||||
public static PedAI SpawnPedStalker (int pedId, Vector3 pos, Quaternion rot, Ped targetPed)
|
||||
{
|
||||
var ped = SpawnPed (pedId, pos, rot, true);
|
||||
|
|
|
@ -44,6 +44,7 @@ namespace SanAndreasUnity.Commands
|
|||
{
|
||||
new CommandManager.CommandInfo("skin", "change skin", true, true, this.pedLimitInterval),
|
||||
new CommandManager.CommandInfo("stalker", "spawn stalker ped", true, true, this.pedLimitInterval),
|
||||
new CommandManager.CommandInfo("enemy", "spawn enemy ped", true, true, this.pedLimitInterval),
|
||||
new CommandManager.CommandInfo("suicide", "commit suicide", true, true, this.pedLimitInterval),
|
||||
new CommandManager.CommandInfo("teleport", "teleport", true, true, this.pedLimitInterval),
|
||||
new CommandManager.CommandInfo("veh", "spawn a vehicle", true, true, this.vehicleLimitInterval),
|
||||
|
@ -122,6 +123,20 @@ namespace SanAndreasUnity.Commands
|
|||
|
||||
return CommandManager.ProcessCommandResult.Success;
|
||||
}
|
||||
else if (arguments[0] == "enemy")
|
||||
{
|
||||
if (null == player.OwnedPed)
|
||||
return pedNotAliveResult;
|
||||
|
||||
if (!GetPedModelId(arguments, 1, out int modelId))
|
||||
return pedModelIdDoesNotExist;
|
||||
|
||||
var pedAI = Ped.SpawnPedAI(modelId, player.OwnedPed.transform);
|
||||
// add weapon ...
|
||||
pedAI.StartChasing(player.OwnedPed);
|
||||
|
||||
return CommandManager.ProcessCommandResult.Success;
|
||||
}
|
||||
else if (arguments[0] == "suicide")
|
||||
{
|
||||
if (null == player.OwnedPed)
|
||||
|
|
Loading…
Reference in a new issue