Skip to content

Commit

Permalink
Merge pull request #1 from TenDRILLL/1.0.2
Browse files Browse the repository at this point in the history
Release 1.0.2
  • Loading branch information
TenDRILLL authored Jul 20, 2023
2 parents 051f0fd + f5dab6d commit 945ea35
Show file tree
Hide file tree
Showing 8 changed files with 170 additions and 113 deletions.
5 changes: 2 additions & 3 deletions SigmaWarhead.sln
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SigmaWarhead", "SigmaWarhead\SigmaWarhead.csproj", "{200E4A7D-0A94-4C5B-9954-91C5E317C652}"
EndProject
Global
Expand All @@ -13,4 +12,4 @@ Global
{200E4A7D-0A94-4C5B-9954-91C5E317C652}.Release|Any CPU.ActiveCfg = Release|Any CPU
{200E4A7D-0A94-4C5B-9954-91C5E317C652}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
EndGlobal
44 changes: 0 additions & 44 deletions SigmaWarhead/EventHandler.cs

This file was deleted.

34 changes: 0 additions & 34 deletions SigmaWarhead/Plugin.cs

This file was deleted.

58 changes: 50 additions & 8 deletions SigmaWarhead/SigmaWarhead.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
Expand Down Expand Up @@ -33,25 +33,67 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="PluginAPI, Version=12.0.0.0, Culture=neutral, processorArchitecture=Amd64">
<HintPath>..\packages\Northwood.PluginAPI.12.0.0\lib\net48\PluginAPI.dll</HintPath>
<Reference Include="Assembly-CSharp, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\EXILED.7.2.0\lib\net48\Assembly-CSharp-Publicized.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp-firstpass">
<HintPath>..\packages\Assembly-CSharp-firstpass.dll</HintPath>
</Reference>
<Reference Include="CommandSystem.Core, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\EXILED.7.2.0\lib\net48\CommandSystem.Core.dll</HintPath>
</Reference>
<Reference Include="Exiled.API, Version=7.2.0.0, Culture=neutral, processorArchitecture=Amd64">
<HintPath>..\packages\EXILED.7.2.0\lib\net48\Exiled.API.dll</HintPath>
</Reference>
<Reference Include="Exiled.CreditTags, Version=7.2.0.0, Culture=neutral, processorArchitecture=Amd64">
<HintPath>..\packages\EXILED.7.2.0\lib\net48\Exiled.CreditTags.dll</HintPath>
</Reference>
<Reference Include="Exiled.CustomItems, Version=7.2.0.0, Culture=neutral, processorArchitecture=Amd64">
<HintPath>..\packages\EXILED.7.2.0\lib\net48\Exiled.CustomItems.dll</HintPath>
</Reference>
<Reference Include="Exiled.CustomRoles, Version=7.2.0.0, Culture=neutral, processorArchitecture=Amd64">
<HintPath>..\packages\EXILED.7.2.0\lib\net48\Exiled.CustomRoles.dll</HintPath>
</Reference>
<Reference Include="Exiled.Events, Version=7.2.0.0, Culture=neutral, processorArchitecture=Amd64">
<HintPath>..\packages\EXILED.7.2.0\lib\net48\Exiled.Events.dll</HintPath>
</Reference>
<Reference Include="Exiled.Loader, Version=7.2.0.0, Culture=neutral, processorArchitecture=Amd64">
<HintPath>..\packages\EXILED.7.2.0\lib\net48\Exiled.Loader.dll</HintPath>
</Reference>
<Reference Include="Exiled.Permissions, Version=7.2.0.0, Culture=neutral, processorArchitecture=Amd64">
<HintPath>..\packages\EXILED.7.2.0\lib\net48\Exiled.Permissions.dll</HintPath>
</Reference>
<Reference Include="Exiled.Updater, Version=3.1.2.0, Culture=neutral, processorArchitecture=Amd64">
<HintPath>..\packages\EXILED.7.2.0\lib\net48\Exiled.Updater.dll</HintPath>
</Reference>
<Reference Include="Mirror">
<HintPath>deps\Mirror.dll</HintPath>
</Reference>
<Reference Include="NorthwoodLib, Version=1.2.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\EXILED.7.2.0\lib\net48\NorthwoodLib.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Defiant_Zombie.KSP.Skeleton.UnityEngine.CoreModule.1.11.2\lib\UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.PhysicsModule">
<HintPath>deps\UnityEngine.PhysicsModule.dll</HintPath>
</Reference>
<Reference Include="YamlDotNet, Version=11.0.0.0, Culture=neutral, PublicKeyToken=ec19458f3c15af5e, processorArchitecture=MSIL">
<HintPath>..\packages\YamlDotNet.11.0.1\lib\net45\YamlDotNet.dll</HintPath>
<HintPath>..\packages\EXILED.7.2.0\lib\net48\YamlDotNet.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Config.cs" />
<Compile Include="EventHandler.cs" />
<Compile Include="Plugin.cs" />
<Compile Include="com.github.tendrilll.sigmawarhead\Config.cs" />
<Compile Include="com.github.tendrilll.sigmawarhead\EventHandler.cs" />
<Compile Include="com.github.tendrilll.sigmawarhead\Plugin.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
using System.Collections.Generic;
using System.ComponentModel;

namespace SigmaWarhead
{
public sealed class Config
{
[Description("Is the Plugin enabled.")]
public bool IsEnabled { get; set; } = true;

[Description("Debug mode.")]
public bool Debug { get; private set; } = false;

[Description("C.A.S.S.I.E. voicelines.")]
public Dictionary<string, string> CassieLines { get; private set; } = new()
{
{ "launch", "Automatic .G3 jam_020_5 Sigma .G1 Warhead has been activated by .G6 pitch_0.69 O5 pitch_1.00 . Time until jam_020_3 detonation is .G2 T minus 90 seconds ." }
};

[Description("Minutes since start of round to activate Sigma Warhead.")]
public int ActivationTime { get; private set; } = 20;
}
}
using System.Collections.Generic;
using System.ComponentModel;
using Exiled.API.Interfaces;

namespace SigmaWarhead.com.github.tendrilll.sigmawarhead
{
public sealed class Config : IConfig
{
[Description("Is the Plugin enabled.")]
public bool IsEnabled { get; set; } = true;

[Description("Debug mode.")]
public bool Debug { get; set; } = false;

[Description("C.A.S.S.I.E. voicelines.")]
public Dictionary<string, string> CassieLines { get; set; } = new(){
{ "launch", "Automatic .G3 jam_020_5 Sigma .G1 Warhead has been activated by .G6 pitch_0.69 O5 pitch_1.00 . Time until jam_020_3 detonation is .G2 T minus 90 seconds ." }
};

[Description("Minutes since start of round to activate Sigma Warhead.")]
public int ActivationTime { get; set; } = 20;
}
}
65 changes: 65 additions & 0 deletions SigmaWarhead/com.github.tendrilll.sigmawarhead/EventHandler.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
using System.Linq;
using Exiled.API.Features;
using Exiled.Events.EventArgs.Server;
using Server = Exiled.Events.Handlers.Server;
using MEC;

namespace SigmaWarhead.com.github.tendrilll.sigmawarhead;

public class EventHandler{
private readonly Plugin<Config> _main;
private readonly bool _debugMode;
private readonly int TimeToLaunch;
private readonly string LaunchMessage;
CoroutineHandle timer;

public EventHandler(Plugin<Config> plugin){
_main = plugin;
_debugMode = plugin.Config.Debug;
if (_debugMode) {
Log.Info("Loading EventHandler");
}

TimeToLaunch = plugin.Config.ActivationTime;
LaunchMessage = plugin.Config.CassieLines.FirstOrDefault(x => x.Key == "launch").Value;

Server.RoundStarted += StartSigma;
Server.RestartingRound += StopSigma;
Server.RoundEnded += StopSigma2;
}

public void UnregisterEvents(){
Server.RoundStarted -= StartSigma;
Server.RestartingRound -= StopSigma;
Server.RoundEnded -= StopSigma2;
}

internal void StartSigma(){
timer = Timing.CallDelayed(TimeToLaunch * 60, LaunchSigmaWarhead);
if (_debugMode)
{
Log.Debug("SigmaWarhead armed and will launch in " + TimeToLaunch + " minutes.");
}
}

internal void StopSigma(){
Timing.KillCoroutines(timer);
if (_debugMode){
Log.Info("SigmaWarhead timer destroyed.");
}
}

internal void StopSigma2(RoundEndedEventArgs args){
StopSigma();
}

internal void LaunchSigmaWarhead(){
Log.Info("SigmaWarhead launched.");
Warhead.Controller.StartDetonation(false, true);
Warhead.Controller.ForceTime(90+13); //+13 for the voiceline. Will make detonation time a variable later.
Warhead.IsLocked = true;
Cassie.Clear();
Cassie.Message(LaunchMessage, false, true, true);
StopSigma();
}
}
28 changes: 28 additions & 0 deletions SigmaWarhead/com.github.tendrilll.sigmawarhead/Plugin.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System;
using Exiled.API.Features;
using Log = Exiled.API.Features.Log;

namespace SigmaWarhead.com.github.tendrilll.sigmawarhead {
public class SigmaWarhead : Plugin<Config> {
public override string Name => "SigmaWarhead";
public override string Author => "TenDRILLL";
public override Version Version => new Version(1, 0, 2);
public EventHandler EventHandler;

public override void OnEnabled() {
Log.Info("SigmaWarhead loading...");
if (!Config.IsEnabled) {
Log.Warn("SigmaWarhead disabled from config, unloading...");
OnDisabled();
return;
}
EventHandler = new EventHandler(this);
Log.Info("SigmaWarhead loaded.");
}

public override void OnDisabled() {
EventHandler.UnregisterEvents();
Log.Info("SigmaWarhead unloaded.");
}
}
}
3 changes: 2 additions & 1 deletion SigmaWarhead/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Northwood.PluginAPI" version="12.0.0" targetFramework="net48" />
<package id="Defiant_Zombie.KSP.Skeleton.UnityEngine.CoreModule" version="1.11.2" targetFramework="net48" />
<package id="EXILED" version="7.2.0" targetFramework="net48" />
<package id="YamlDotNet" version="11.0.1" targetFramework="net48" />
</packages>

0 comments on commit 945ea35

Please sign in to comment.