Skip to content

Commit

Permalink
Merge branch 'EXILED' of github.com:PatPeter/ZombieSuicideHotline int…
Browse files Browse the repository at this point in the history
…o EXILED

# Conflicts:
#	ZombieSuicideHotline/PlayerHandlers.cs
#	ZombieSuicideHotline/Properties/AssemblyInfo.cs
#	ZombieSuicideHotline/VentCommand.cs
#	ZombieSuicideHotline/ZombieSuicideHotline.csproj
  • Loading branch information
PatPeter committed Aug 23, 2021
2 parents 6e63933 + 81060ba commit cc39dc7
Show file tree
Hide file tree
Showing 8 changed files with 104 additions and 65 deletions.
97 changes: 53 additions & 44 deletions ZombieSuicideHotline/PlayerHandlers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public class PlayerHandlers
{
IDictionary<RoleType, UnityEngine.Vector3> Spawns = new Dictionary<RoleType, UnityEngine.Vector3>();
private readonly Plugin plugin;
public Dictionary<string, List<string>> DoctorsZombies = new Dictionary<string, List<string>>();
public PlayerHandlers(Plugin plugin) => this.plugin = plugin;

public void OnPlayerVerified(VerifiedEventArgs ev)
Expand All @@ -30,6 +31,7 @@ public void OnRoundEnd()
this.plugin.zombies[player.UserId].Disconnected = false;
}
}
DoctorsZombies = new Dictionary<string, List<string>>();
}
public void OnPlayerRoleChange(ChangingRoleEventArgs ev)
{
Expand Down Expand Up @@ -62,69 +64,76 @@ public void OnPlayerSpawn(SpawningEventArgs ev)
}
if (ev.RoleType == RoleType.Scp173)
{
player.Broadcast(10, "Use .vent to escape NTF fire and travel to another SCP.");
player.Broadcast(10, "Use .vent to teleport to other SCPs");
}

if (Spawns.ContainsKey(ev.RoleType) == false)
{
Spawns.Add(ev.RoleType, ev.Position);
Log.Error(ev.RoleType);
};
}

public void OnPlayerDied(DiedEventArgs ev)
{
if (plugin.Config.IsEnabled)
{
Player player = ev.Target;
if (ev.Target.Role == RoleType.Scp0492)
{
plugin.zombies[player.UserId].Disconnected = false;
}
}
Player player = ev.Target;
if (ev.Target.Role == RoleType.Scp0492)
{
if (this.plugin.zombies.ContainsKey(player.UserId))
{
plugin.zombies[player.UserId].Disconnected = false;
}
}
}

public void OnDoctorRevive(FinishingRecallEventArgs ev)
{
if(DoctorsZombies.ContainsKey(ev.Scp049.UserId))
{
DoctorsZombies[ev.Scp049.UserId].Add(ev.Target.UserId);
}
else
{
DoctorsZombies[ev.Scp049.UserId] = new List<string>{ ev.Target.UserId };
}
}

public void OnPlayerHurt(HurtingEventArgs ev)
{
if (plugin.Config.IsEnabled &&
plugin.Config.HotlineCalls.ContainsKey(ev.Target.Role.ToString()) &&
plugin.Config.HotlineCalls[ev.Target.Role.ToString()] != -1)
{
if ((ev.DamageType == DamageTypes.Tesla || ev.DamageType == DamageTypes.Wall || ev.DamageType == DamageTypes.Decont))
{
float originalAmount = ev.Amount;
float percentHealth = ev.Target.Health * plugin.Config.HotlineCalls[ev.Target.Role.ToString()];
Log.Debug(ev.Target.Nickname + " called the SCP Suicide Hotline and took " + Math.Min(originalAmount, percentHealth) + " damage instead of/same as " + originalAmount + " " + ev.DamageType.name + " damage.");
ev.Target.Broadcast(new Broadcast("You called the SCP Suicide Hotline and took " + Math.Min(originalAmount, percentHealth) + " damage instead of/same as " + originalAmount + " " + ev.DamageType.name + " damage.", 2));

Player targetPlayer = GetTeleportTarget(ev.Target);
if (targetPlayer != null)
{
ev.Amount = Math.Min(originalAmount, percentHealth);
ev.Target.Position = targetPlayer.Position;
}
else
{
// Do not warp SCP-173 back to Light Containment if decontaminated, but still apply the damage
if (Map.IsLCZDecontaminated && ev.Target.Role == RoleType.Scp173)
{
ev.Amount = Math.Min(originalAmount, percentHealth);
}
// Should be impossible to take tesla/wall/decont damage on nuked surface, but do not risk teleporting SCPs back
else if (!Warhead.IsDetonated)
{
ev.Amount = Math.Min(originalAmount, percentHealth);
ev.Target.Position = Spawns[(ev.Target.Role)];
}
}
}
}
if ((ev.DamageType == DamageTypes.Tesla || (ev.DamageType == DamageTypes.Wall && ev.Amount > 10000) || ev.DamageType == DamageTypes.Decont))
{
if (plugin.Config.HotlineCalls.ContainsKey(ev.Target.Role.ToString()) && plugin.Config.HotlineCalls[ev.Target.Role.ToString()] != -1)
{

if (Warhead.IsDetonated != true && (Map.IsLczDecontaminated != true || ev.Target.Role != RoleType.Scp173) && ev.Target.Role != RoleType.Scp0492)
{
ev.Amount = (ev.Target.Health * plugin.Config.HotlineCalls[ev.Target.Role.ToString()]);
Log.Error("ran");
Log.Error(ev.Target.Role);
ev.Target.Position = Spawns[ev.Target.Role];
Log.Error("after");
}
else
{
Player targetPlayer = GetTeleportTarget(ev.Target);
if (targetPlayer != null)
{
ev.Amount = (ev.Target.Health * plugin.Config.HotlineCalls[ev.Target.Role.ToString()]);
ev.Target.Position = targetPlayer.Position;
}
}
}
}
}

public void OnPlayerLeft(LeftEventArgs ev)
{
if (ev.Player.Role == RoleType.Scp0492)
{
plugin.zombies[ev.Player.UserId].Disconnected = true;
if (this.plugin.zombies.ContainsKey(ev.Player.UserId))
{
plugin.zombies[ev.Player.UserId].Disconnected = true;
}
}
}

Expand Down Expand Up @@ -188,4 +197,4 @@ public Player GetTeleportTarget(Player sourcePlayer)
return targetPlayer;
}
}
}
}
3 changes: 2 additions & 1 deletion ZombieSuicideHotline/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public override void OnEnabled()
Player.ChangingRole += PlayerHandlers.OnPlayerRoleChange;
Player.Spawning += PlayerHandlers.OnPlayerSpawn;
Server.RoundStarted += PlayerHandlers.OnRoundEnd;
Exiled.Events.Handlers.Scp049.FinishingRecall += PlayerHandlers.OnDoctorRevive;
}
public override void OnDisabled()
{
Expand All @@ -47,7 +48,7 @@ public override void OnDisabled()
Player.ChangingRole -= PlayerHandlers.OnPlayerRoleChange;
Player.Spawning -= PlayerHandlers.OnPlayerSpawn;
Server.RoundStarted -= PlayerHandlers.OnRoundEnd;

Exiled.Events.Handlers.Scp049.FinishingRecall -= PlayerHandlers.OnDoctorRevive;
}
}

Expand Down
2 changes: 1 addition & 1 deletion ZombieSuicideHotline/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ static internal class AssemblyInfo
/// <summary>
/// The AssemblyFileVersion of this web part
/// </summary>
internal const string Version = "1.6.11.65";
internal const string Version = "1.7.0.00";
}
}
2 changes: 1 addition & 1 deletion ZombieSuicideHotline/RecallCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out s
{
foreach (Player players in Exiled.API.Features.Player.List)
{
if (players.Role == RoleType.Scp0492)
if (players.Role == RoleType.Scp0492 && Plugin.Singleton.PlayerHandlers.DoctorsZombies[player.UserId].Contains(players.UserId))
{
players.Position = player.Position;
response = "Zombies recalled!";
Expand Down
2 changes: 1 addition & 1 deletion ZombieSuicideHotline/VentCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class VentCommand : ICommand
{
public string Command => "vent";

public string[] Aliases => null;
public string[] Aliases => new string[] { "retreat" };

public string Description => "Allows SCP-173 to teleport to other SCPs";

Expand Down
48 changes: 31 additions & 17 deletions ZombieSuicideHotline/ZombieSuicideHotline.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,30 +36,40 @@
<Reference Include="0Harmony">
<HintPath>..\..\References\dependencies\0Harmony.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp-firstpass">
<HintPath>..\..\References\Assembly-CSharp-firstpass.dll</HintPath>
<Reference Include="Assembly-CSharp, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp_publicized">
<HintPath>..\..\References\Assembly-CSharp_publicized.dll</HintPath>
<Reference Include="Assembly-CSharp-firstpass, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Assembly-CSharp-firstpass.dll</HintPath>
</Reference>
<Reference Include="CommandSystem.Core">
<HintPath>..\..\References\CommandSystem.Core.dll</HintPath>
</Reference>
<Reference Include="Exiled.API, Version=2.1.11.0, Culture=neutral, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\References\EXILED\Plugins\dependencies\Exiled.API.dll</HintPath>
<Reference Include="Exiled.API, Version=3.0.0.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.3.0.0-alpha.53\lib\net472\Exiled.API.dll</HintPath>
</Reference>
<Reference Include="Exiled.Events, Version=2.1.11.0, Culture=neutral, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\References\EXILED\Plugins\Exiled.Events.dll</HintPath>
<Reference Include="Exiled.Bootstrap, Version=3.0.0.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.3.0.0-alpha.53\lib\net472\Exiled.Bootstrap.dll</HintPath>
</Reference>
<Reference Include="Exiled.Loader, Version=2.1.11.0, Culture=neutral, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\References\EXILED\Exiled.Loader.dll</HintPath>
<Reference Include="Exiled.CreditTags, Version=3.0.0.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.3.0.0-alpha.53\lib\net472\Exiled.CreditTags.dll</HintPath>
</Reference>
<Reference Include="Exiled.Permissions, Version=2.1.11.0, Culture=neutral, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\References\EXILED\Plugins\Exiled.Permissions.dll</HintPath>
<Reference Include="Exiled.CustomItems, Version=3.0.0.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.3.0.0-alpha.53\lib\net472\Exiled.CustomItems.dll</HintPath>
</Reference>
<Reference Include="Exiled.Events, Version=3.0.0.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.3.0.0-alpha.53\lib\net472\Exiled.Events.dll</HintPath>
</Reference>
<Reference Include="Exiled.Loader, Version=3.0.0.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.3.0.0-alpha.53\lib\net472\Exiled.Loader.dll</HintPath>
</Reference>
<Reference Include="Exiled.Permissions, Version=3.0.0.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.3.0.0-alpha.53\lib\net472\Exiled.Permissions.dll</HintPath>
</Reference>
<Reference Include="Exiled.Updater, Version=3.1.1.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\EXILED.3.0.0-alpha.53\lib\net472\Exiled.Updater.dll</HintPath>
</Reference>
<Reference Include="Mirror">
<HintPath>..\..\References\Mirror.dll</HintPath>
Expand All @@ -83,9 +93,13 @@
<Compile Include="Config.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
</Project>
</Project>
11 changes: 11 additions & 0 deletions ZombieSuicideHotline/app.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="YamlDotNet" publicKeyToken="ec19458f3c15af5e" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
4 changes: 4 additions & 0 deletions ZombieSuicideHotline/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EXILED" version="3.0.0-alpha.53" targetFramework="net472" />
</packages>

0 comments on commit cc39dc7

Please sign in to comment.