Skip to content

Commit

Permalink
Update for 14.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ced777ric committed Nov 28, 2024
1 parent 71e2867 commit d0fa9b8
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 21 deletions.
10 changes: 0 additions & 10 deletions NwPluginAPI/Core/Facility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,16 +121,6 @@ private static void RegisterDoor(FacilityRoom room, DoorVariant door)
}
}

public static void RegisterDoor(DoorSpawnpoint spawnpoint, DoorVariant door)
{
var roomIdentity = FindRoomIdentifier(spawnpoint.transform);
if (roomIdentity == null) return;

if (!TryGetRoom(roomIdentity, out FacilityRoom room)) return;

RegisterDoor(room, door);
}

private static RoomIdentifier FindRoomIdentifier(Transform tr)
{
if (tr.TryGetComponent<RoomIdentifier>(out RoomIdentifier ri))
Expand Down
2 changes: 1 addition & 1 deletion NwPluginAPI/Core/Map.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public static class Map
/// <remarks>
/// Please avoid calling this method several times, I recommend you to save the values in a variable in your code and update it every time a map is generated again.
/// </remarks>
public static IReadOnlyCollection<TeslaGate> TeslaGates => TeslaGateController.Singleton.TeslaGates;
public static IReadOnlyCollection<TeslaGate> TeslaGates => TeslaGate.AllGates;

/// <summary>
/// Get the current generators of the map.
Expand Down
2 changes: 1 addition & 1 deletion NwPluginAPI/Core/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1343,7 +1343,7 @@ public void SetGroup(UserGroup group)
/// <param name="force">The force of explosion.</param>
/// <param name="armorPenetration">The amount of armor penetration.</param>
/// <returns>Whether or not damaging was successful.</returns>
public bool Damage(float amount, Player attacker, Vector3 force = default, int armorPenetration = 0) => Damage(new ExplosionDamageHandler(new Footprint(attacker.ReferenceHub), force, amount, armorPenetration));
public bool Damage(float amount, Player attacker, Vector3 force = default, int armorPenetration = 0) => Damage(new ExplosionDamageHandler(new Footprint(attacker.ReferenceHub), force, amount, armorPenetration, ExplosionType.Grenade));

/// <summary>
/// Damages player.
Expand Down
82 changes: 76 additions & 6 deletions NwPluginAPI/Core/Respawn.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
using System;
using PlayerRoles;
using Respawning.Waves;

namespace PluginAPI.Core
{
using Respawning;
Expand All @@ -11,24 +15,72 @@ public static class Respawn
/// <summary>
/// Gets the amount of NTF tickets left.
/// </summary>
public static float NtfTickets => RespawnTokensManager.GetTeamDominance(SpawnableTeamType.NineTailedFox);
[Obsolete]
public static float NtfTickets => 0;

/// <summary>
/// Gets the amount of NTF tokens left.
/// </summary>
public static float NtfTokens
{
get
{
if(!WaveManager.TryGet(Faction.FoundationStaff, out SpawnableWaveBase wave) || wave is not NtfSpawnWave ntfWave)
return 0;

return ntfWave.RespawnTokens;
}
}

/// <summary>
/// Gets the amount of chaos tickets left.
/// </summary>
public static float ChaosTickets => RespawnTokensManager.GetTeamDominance(SpawnableTeamType.ChaosInsurgency);
public static float ChaosTickets => 0;

/// <summary>
/// Gets the amount of Chaos tokens left.
/// </summary>
public static float ChaosTokens
{
get
{
if(!WaveManager.TryGet(Faction.FoundationEnemy, out SpawnableWaveBase wave) || wave is not NtfSpawnWave chaosWave)
return 0;

return chaosWave.RespawnTokens;
}
}

/// <summary>
/// Gets the next team which will be spawned.
/// </summary>
public static SpawnableTeamType NextKnownTeam => RespawnManager.Singleton.NextKnownTeam;
[Obsolete]
public static SpawnableTeamType NextKnownTeam => SpawnableTeamType.None;

/// <summary>
/// Adds tickets to a specific team.
/// </summary>
/// <param name="team">The team to add tickets to.</param>
/// <param name="amount">The amount of tickets to add.</param>
public static void AddTickets(SpawnableTeamType team, float amount) => RespawnTokensManager.GrantTokens(team, amount);
public static void AddTickets(SpawnableTeamType team, float amount)
{
switch (team)
{
case SpawnableTeamType.ChaosInsurgency:
if (!WaveManager.TryGet(Faction.FoundationEnemy, out SpawnableWaveBase chaosWave) || chaosWave is not NtfSpawnWave chaosSpawnWave)
return;

chaosSpawnWave.RespawnTokens += (int)amount;
break;

case SpawnableTeamType.NineTailedFox:
if (!WaveManager.TryGet(Faction.FoundationStaff, out SpawnableWaveBase ntfWave) || ntfWave is not NtfSpawnWave ntfSpawnWave)
return;

ntfSpawnWave.RespawnTokens += (int)amount;
break;
}
}

/// <summary>
/// Spawns a specific team.
Expand All @@ -37,8 +89,26 @@ public static class Respawn
/// <param name="playEffects">Plays spawn effects.</param>
public static void Spawn(SpawnableTeamType team, bool playEffects = false)
{
RespawnManager.Singleton.ForceSpawnTeam(team);
if (playEffects) ExecuteAllEffects(EffectType.Selection, team);
switch (team)
{
case SpawnableTeamType.ChaosInsurgency:
if (!WaveManager.TryGet(Faction.FoundationEnemy, out SpawnableWaveBase chaosWave))
return;

WaveManager.Spawn(chaosWave);
if (playEffects)
WaveManager.InitiateRespawn(chaosWave);
break;

case SpawnableTeamType.NineTailedFox:
if (!WaveManager.TryGet(Faction.FoundationStaff, out SpawnableWaveBase ntfWave))
return;

WaveManager.Spawn(ntfWave);
if (playEffects)
WaveManager.InitiateRespawn(ntfWave);
break;
}
}
}
}
2 changes: 1 addition & 1 deletion NwPluginAPI/NwPluginAPI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Title>Northwood.PluginAPI</Title>
<Copyright>Copyright by Hubert Moszka Northwood, 2022-2023</Copyright>
<PackageVersion>13.1.2</PackageVersion>
<PackageVersion>13.1.5</PackageVersion>
<LangVersion>default</LangVersion>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
Expand Down
4 changes: 2 additions & 2 deletions NwPluginAPI/PluginApiVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
{
public static class PluginApiVersion
{
public const string Version = "13.1.4"; //major.minor.patch ONLY
public const string VersionString = "13.1.4";
public const string Version = "13.1.5"; //major.minor.patch ONLY
public const string VersionString = "13.1.5";

//PackageVersion needs to be set to the same value as VersionString MANUALLY IN .csproj

Expand Down

0 comments on commit d0fa9b8

Please sign in to comment.