Made a new class for storing house stuff like the suspects, victims etc..

master
Supopur 1 year ago
parent 6ba3f433a7
commit 9f8587f810

@ -3,31 +3,146 @@ using System.Linq;
using Rage; using Rage;
using LSPD_First_Response.Mod.API; using LSPD_First_Response.Mod.API;
using LSPD_First_Response.Mod.Callouts; using LSPD_First_Response.Mod.Callouts;
using CalloutInterfaceAPI;
using System.Collections.Generic;
using DialogueSystem;
using CalloutInterface;
using LSPD_First_Response.Engine;
namespace Code_Blue_Calls.Callouts namespace Code_Blue_Calls.Callouts
{ {
[CalloutInfo("Domestic Violence", CalloutProbability.High)]
[CalloutInterface("Domestic Violence", CalloutProbability.Medium, "Code 3", "LSPD")]
public class DomesticViolence : Callout public class DomesticViolence : Callout
{ {
private Ped victim, suspect; private Ped victim, suspect;
private Blip blip_suspect; private Blip blip_suspect, blip_victim;
private Blip blip_victim; private Vector3 location_suspect, location_victim;
private Vector3 location_suspect;
private Vector3 location_victim; private Vector3 GetClosestHouse(List<Vector3> houses)
private bool Victimfleeing; {
private bool SuspectKillingPlayer; Vector3 playerPosition = Game.LocalPlayer.Character.Position;
private bool ShotAtVictim; Vector3 closestHouse = Vector3.Zero;
float closestDistance = float.MaxValue;
foreach (Vector3 house in houses)
{
float distance = Vector3.Distance(playerPosition, house);
if (distance < closestDistance)
{
closestHouse = house;
closestDistance = distance;
}
}
return closestHouse;
}
// I don't know what im doing
private class House
{
public Vector3 Position;
public List<Vector3> Victims { get; set; }
public List<Vector3> Suspects { get; set; }
public string Name;
}
public override bool OnBeforeCalloutDisplayed() public override bool OnBeforeCalloutDisplayed()
{ {
location_suspect = new Vector3(-111.19f, -8.28f, 70.52f); // This is stupid and will get replaced with a list containing a list with the suspect and the victim and its gonna be per house
location_victim = new Vector3(-111.19f, -11f, 70.52f); List<Vector3> location_suspect = new List<Vector3> {
new Vector3()
};
ShowCalloutAreaBlipBeforeAccepting(location_suspect, 30f); //This is a list of all the houses/interiors
//This is used for getting the closest house to the player so its not random and he/she doesn't have to go to the other side of the map
List<Vector3> houses = new List<Vector3>
{
new Vector3(1276.979f, -1725.641f, 54.65f), //Lester's place
new Vector3(249.1075f, -1720.578f, 29.16469f), //Generic house
new Vector3(-775.9423f, 291.741f, 85.38015f), //West eclips towers
new Vector3(-131.3567f, -32.02588f, 57.84212f), //Janitors house
new Vector3(-66.24619f, -574.7697f, 36.95814f), //4 integrity way (players apt.)
new Vector3(-13.93472f, -1455.081f, 30.4537f), //Franklin
new Vector3(-616.9177f, 22.83247f, 41.47743f), //Strangeways
new Vector3(-178.65f, 507.2562f, 136.0046f), //Wild oats
new Vector3(-553.8226f, 666.5585f, 144.6216f), //Normandy
new Vector3(1122.733f, 2647.359f, 37.99636f), //Vespuci aka sandy motel
};
List<House> houses1 = new List<House>
{
new House
{
Name = "Lesterhouse",
Victims = new List<Vector3>
{
new Vector3(1273.748f, -1709.831f, 54.77149f)
},
Suspects = new List<Vector3>
{
new Vector3(1274.567f, -1713.383f, 54.77149f)
},
Position = new Vector3(1276.979f, -1725.641f, 54.65f)
},
new House
{
Name = "Generic House",
Victims = new List<Vector3>
{
new Vector3(264.6913f, -997.2188f, -99.00867f)
},
Suspects = new List<Vector3>
{
new Vector3(261.1124f, -998.8026f, -99.00865f)
},
Position = new Vector3(249.1075f, -1720.578f, 29.16469f)
},
new House
{
Name = "Frankiln house old",
Victims = new List<Vector3>
{
new Vector3(-11.18673f, -1429.365f, 31.10147f)
},
Suspects = new List<Vector3>
{
new Vector3(-10.82392f, -1438.442f, 31.10153f)
},
Position = new Vector3(-13.93472f, -1455.081f, 30.4537f)
},
new House
{
Name = "Med rich apt.",
}
};
// Choose the closest house to the player. This isn't really optimal as if the player isn't patrolling and doing radar or some other thing wich involves being in one place
// Then the player will get the same house again and again
Vector3 SpawnPoint = GetClosestHouse(houses);
// Not needed as My code isn't goofy and doesn't set the callout position to the other side of the map
//AddMaximumDistanceCheck(600f, SpawnPoint); //Player must be 600m or closer
ShowCalloutAreaBlipBeforeAccepting(SpawnPoint, 30f);
CalloutMessage = "Domestic Violence"; CalloutMessage = "Domestic Violence";
CalloutPosition = location_suspect; CalloutPosition = SpawnPoint;
Functions.PlayScannerAudioUsingPosition("WE_HAVE CRIME_RESISTING_ARREST_02 IN_OR_ON_POSITION", location_suspect); LSPD_First_Response.Mod.API.Functions.PlayScannerAudioUsingPosition("WE_HAVE CRIME_RESISTING_ARREST_02 IN_OR_ON_POSITION", SpawnPoint);
return base.OnBeforeCalloutDisplayed(); return base.OnBeforeCalloutDisplayed();
} }

@ -1,79 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Rage;
using LSPD_First_Response.Mod.API;
using LSPD_First_Response.Mod.Callouts;
using System.Drawing;
namespace Code_Blue_Calls.Callouts
{
[CalloutInfo("Test", CalloutProbability.High)]
public class Test : Callout
{
private Ped suspect;
private Vehicle vehicle;
private Blip blip;
private LHandle Pursuit;
private Vector3 spawn;
private bool created;
public override bool OnBeforeCalloutDisplayed()
{
spawn = World.GetRandomPositionOnStreet();
ShowCalloutAreaBlipBeforeAccepting(spawn, 30f);
//AddMaximumDistanceCheck(40, spawn);
CalloutMessage = "Test";
CalloutPosition = spawn;
Functions.PlayScannerAudioUsingPosition("WE_HAVE CRIME_RESISTING_ARREST_02 IN_OR_ON_POSITION", spawn);
return base.OnBeforeCalloutDisplayed();
}
public override bool OnCalloutAccepted()
{
vehicle = new Vehicle("BLISTA", spawn);
vehicle.IsPersistent = true;
suspect = new Ped(vehicle.GetOffsetPositionFront(5f));
suspect.IsPersistent = true;
suspect.BlockPermanentEvents = true;
suspect.WarpIntoVehicle(vehicle, -1);
blip = suspect.AttachBlip();
blip.Color = System.Drawing.Color.Yellow;
blip.IsRouteEnabled = true;
created = false;
return base.OnCalloutAccepted();
}
public override void Process()
{
base.Process();
if (!created && Game.LocalPlayer.Character.DistanceTo(vehicle) <= 20f)
{
Pursuit = Functions.CreatePursuit();
Functions.AddPedToPursuit(Pursuit, suspect);
Functions.SetPursuitIsActiveForPlayer(Pursuit, true);
created = true;
}
if (created && !Functions.IsPursuitStillRunning(Pursuit))
{
End();
}
}
public override void End()
{
base.End();
if (suspect.Exists())
{
suspect.Dismiss();
}
}
}
}

@ -56,6 +56,12 @@
<Reference Include="CalloutInterfaceAPI"> <Reference Include="CalloutInterfaceAPI">
<HintPath>..\..\..\Documents\References\CalloutInterfaceAPI.dll</HintPath> <HintPath>..\..\..\Documents\References\CalloutInterfaceAPI.dll</HintPath>
</Reference> </Reference>
<Reference Include="DialogueSystem">
<HintPath>..\..\..\Documents\References\DialogueSystem.dll</HintPath>
</Reference>
<Reference Include="IPT.Common">
<HintPath>..\..\..\..\..\Program Files\Epic Games\GTAV\IPT.Common.dll</HintPath>
</Reference>
<Reference Include="LSPD First Response"> <Reference Include="LSPD First Response">
<HintPath>..\..\..\Documents\References\LSPD First Response.dll</HintPath> <HintPath>..\..\..\Documents\References\LSPD First Response.dll</HintPath>
</Reference> </Reference>
@ -82,7 +88,7 @@
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Callouts\Test.cs" /> <Compile Include="Callouts\DomesticViolence.cs" />
<Compile Include="IniFile.cs" /> <Compile Include="IniFile.cs" />
<Compile Include="Main.cs" /> <Compile Include="Main.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />

@ -34,14 +34,13 @@ namespace Code_Blue_Calls
{ {
if (OnDuty) if (OnDuty)
{ {
<<<<<<< HEAD
// If the player goes on duty, register the callouts // If the player goes on duty, register the callouts
RegisterCallouts(); RegisterCallouts();
// Display a notification to indicate that the callouts have been loaded // Display a notification to indicate that the callouts have been loaded
=======
RegisterCallouts(); RegisterCallouts();
>>>>>>> parent of ccc531b (Added domestic violence calout)
Game.DisplayNotification("Code Blue Callouts loaded."); Game.DisplayNotification("Code Blue Callouts loaded.");
} }
} }
@ -49,7 +48,7 @@ namespace Code_Blue_Calls
// Register the callouts // Register the callouts
private static void RegisterCallouts() private static void RegisterCallouts()
{ {
Functions.RegisterCallout(typeof(Callouts.Test)); Functions.RegisterCallout(typeof(Callouts.DomesticViolence));
} }
// Event handler for resolving LSPDFR-related assemblies // Event handler for resolving LSPDFR-related assemblies

Loading…
Cancel
Save