-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from TenDRILLL/1.0.2
Release 1.0.2
- Loading branch information
Showing
8 changed files
with
170 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 23 additions & 23 deletions
46
SigmaWarhead/Config.cs → ...m.github.tendrilll.sigmawarhead/Config.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
65
SigmaWarhead/com.github.tendrilll.sigmawarhead/EventHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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."); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |