added aduty system + added ChatService.BroadcastDutyAdmin + fixes in report system + added paaqos busdriver job

This commit is contained in:
2019-09-03 01:04:02 +02:00
parent 18364264f9
commit a6ff47d073
11 changed files with 471 additions and 27 deletions

View File

@@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using System.Text;
using RAGE;
using RAGE.Elements;
namespace ReallifeGamemode.Client.Jobs.BusDriver
{
public static class CheckpointHelper
{
public static List<CheckpointInstance> Checkpoints = new List<CheckpointInstance>();
public static void ClearAllCheckpoints()
{
while (Checkpoints.Count != 0)
{
Checkpoints[Checkpoints.Count - 1].Delete();
Checkpoints.Remove(Checkpoints[Checkpoints.Count - 1]);
}
}
public static void ClearCheckpoint(CheckpointInstance checkpointInstance)
{
checkpointInstance.Delete();
}
public static CheckpointInstance IsNearCheckpoint(float distance)
{
return Checkpoints.Find(checkpoint => checkpoint.Checkpoint.Position.DistanceTo2D(Player.LocalPlayer.Position) <= distance);
}
}
public class CheckpointInstance
{
public Checkpoint Checkpoint { get; set; } = null;
public bool RecentlyPlaced = true;
public float Size = 5f;
public CheckpointInstance(Vector3 position, float size)
{
Checkpoint = new Checkpoint(1, position.Subtract(new Vector3(0, 0, 1)), size, new Vector3(), new RGBA(255, 255, 255, 155), true, 0);
Size = size;
CheckpointHelper.Checkpoints.Add(this);
}
public void Delete()
{
Checkpoint.Destroy();
CheckpointHelper.Checkpoints.Remove(this);
RAGE.Game.Audio.PlaySoundFrontend(1, "Beep_Red", "DLC_HEIST_HACKING_SNAKE_SOUNDS", true);
}
}
}

View File

@@ -0,0 +1,76 @@
using System;
using System.Collections.Generic;
using System.Text;
using RAGE;
namespace ReallifeGamemode.Client.Jobs.BusDriver
{
public class Main : Events.Script
{
public static CheckpointInstance NextObjective { get; set; } = null;
public static int tick = 0;
public static int around_one_sec = 80;
public static bool check_for_key_press = true;
public Main()
{
Chat.Output("Loaded Clientside");
Events.Add("load_objective", LoadObjective);
Events.Add("clear_all_markers", ClearJobCheckPoints);
Events.Tick += OnUpdate;
}
private void OnUpdate(List<Events.TickNametagData> nametags)
{
tick++;
if (tick >= around_one_sec)
{
HeartBeat();
}
}
public void HeartBeat()
{
tick = 0;
check_for_key_press = true;
if (NextObjective != null)
{
CheckpointInstance checkpointInstance = CheckpointHelper.IsNearCheckpoint(3f);
if (checkpointInstance != null)
{
NextObjective = null;
CheckpointHelper.ClearCheckpoint(checkpointInstance);
Events.CallRemote("marker_completed");
}
}
}
public static void ClearJobCheckPoints(object[] args)
{
CheckpointHelper.ClearAllCheckpoints();
}
public static void LoadObjective(object[] args)
{
Vector3 markerPosition = (Vector3)args[0];
float markerSize = Convert.ToSingle(args[1]);
if (markerPosition == null)
return;
if (NextObjective != null)
{
CheckpointHelper.ClearCheckpoint(NextObjective);
}
NextObjective = new CheckpointInstance(markerPosition, markerSize);
}
}
}