Skip to content
This repository was archived by the owner on Jun 23, 2023. It is now read-only.

Commit acf1819

Browse files
committed
Added cargo ship spawning
1 parent 1b2da85 commit acf1819

File tree

9 files changed

+431
-271
lines changed

9 files changed

+431
-271
lines changed
0 Bytes
Binary file not shown.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
//281
1+
//306
22
//
33
// This code was generated by a tool. Any changes made manually will be lost
44
// the next time this code is regenerated.
55
//
66

77
using System.Reflection;
88

9-
[assembly: AssemblyFileVersion("1.13.5.281")]
10-
[assembly: AssemblyVersion("1.13.5.281")]
9+
[assembly: AssemblyFileVersion("1.13.5.306")]
10+
[assembly: AssemblyVersion("1.13.5.306")]
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
namespace EssentialsPlugin.ChatHandlers.Admin
2+
{
3+
using Utility;
4+
public class HandleAdminSpawnCargo : ChatHandlerBase
5+
{
6+
7+
public override string GetHelp()
8+
{
9+
return "Spawns a cargo ship.";
10+
}
11+
12+
public override string GetCommandText()
13+
{
14+
return "/admin spawn cargo";
15+
}
16+
17+
public override Communication.ServerDialogItem GetHelpDialog( )
18+
{
19+
Communication.ServerDialogItem DialogItem = new Communication.ServerDialogItem( );
20+
DialogItem.title = "Help";
21+
DialogItem.header = "";
22+
DialogItem.content = GetHelp( );
23+
DialogItem.buttonText = "close";
24+
return DialogItem;
25+
}
26+
27+
public override bool IsAdminCommand()
28+
{
29+
return true;
30+
}
31+
32+
public override bool AllowedInConsole()
33+
{
34+
return true;
35+
}
36+
37+
public override bool HandleCommand( ulong userId, string[ ] words )
38+
{
39+
CargoShips.SpawnCargoShip( );
40+
return true;
41+
}
42+
43+
}
44+
45+
}
46+

EssentialsPlugin/ChatHandlers/Admin/HandleAdminTest.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ public override bool AllowedInConsole()
3636

3737
public override bool HandleCommand( ulong userId, string[ ] words )
3838
{
39-
CargoShips.SpawnPrefabWithTrajectory( );
40-
39+
CargoShips.SpawnCargoShip( );
4140
return true;
4241
}
4342

EssentialsPlugin/Essentials.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,6 +1071,32 @@ public MTObservableCollection<TimedCommandItem> TimedCommandsItems
10711071
PluginSettings.Instance.TimedCommandsItems = value;
10721072
}
10731073
}
1074+
1075+
[Category( "Cargo Ships" )]
1076+
[Description( "This enables or disables random cargo ships." )]
1077+
[Browsable( true )]
1078+
[ReadOnly( false )]
1079+
public bool CargoShipsEnabled {
1080+
get {
1081+
return PluginSettings.Instance.CargoShipsEnabled;
1082+
}
1083+
set {
1084+
PluginSettings.Instance.CargoShipsEnabled = value;
1085+
}
1086+
}
1087+
1088+
[Category( "Cargo Ships" )]
1089+
[Description( "The amount of time, in minutes, between ship spawn." )]
1090+
[Browsable( true )]
1091+
[ReadOnly( false )]
1092+
public float CargoShipSpawnTime {
1093+
get {
1094+
return PluginSettings.Instance.CargoShipSpawnTime;
1095+
}
1096+
set {
1097+
PluginSettings.Instance.CargoShipSpawnTime = value;
1098+
}
1099+
}
10741100
/*
10751101
[Category("Game Modes")]
10761102
[Description("Conquest Game Mode - This mode tracks asteroid owners by counting owned blocks near an asteroid to determine the owner. Includes a leaderboard")]
@@ -1117,6 +1143,7 @@ private void DoInit( string path )
11171143
new ProcessReservedSlots(),
11181144
new ProcessTimedCommands( ),
11191145
new ProcessSpeed( ),
1146+
new ProcessCargoShips( )
11201147
//new ProcessPlayerCleanup( )
11211148
};
11221149

@@ -1135,6 +1162,7 @@ private void DoInit( string path )
11351162
new HandleAdminStop( ),
11361163
new HandleAdminSpeed( ),
11371164
new HandleAdminIdentityCleanup( ),
1165+
new HandleAdminSpawnCargo( ),
11381166

11391167

11401168
//Admin Scan

EssentialsPlugin/EssentialsPlugin.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
<Compile Include="ChatHandlers\Admin\HandleAdminStop.cs" />
8080
<Compile Include="ChatHandlers\Admin\HandleAdminSpeed.cs" />
8181
<Compile Include="ChatHandlers\Admin\HandleAdminIdentityCleanup.cs" />
82+
<Compile Include="ChatHandlers\Admin\HandleAdminSpawnCargo.cs" />
8283
<Compile Include="ChatHandlers\Admin\HandleAdminVersion.cs" />
8384
<Compile Include="ChatHandlers\HandleLastSeen.cs" />
8485
<Compile Include="ChatHandlers\Settings\HandleSettingsEnableBlockEnforcement.cs" />
@@ -139,6 +140,7 @@
139140
<Compile Include="EntityManagers\TurretManagement.cs" />
140141
<Compile Include="GameModes\Conquest.cs" />
141142
<Compile Include="ProcessHandlers\ProcessPlayerCleanup.cs" />
143+
<Compile Include="ProcessHandlers\ProcessCargoShips.cs" />
142144
<Compile Include="ProcessHandlers\ProcessSpeed.cs" />
143145
<Compile Include="ProcessHandlers\ProcessBlockEnforcement.cs" />
144146
<Compile Include="ProcessHandlers\ProcessCleanup.cs" />
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
namespace EssentialsPlugin.ProcessHandlers
2+
{
3+
using System;
4+
using System.Collections.Generic;
5+
using System.Diagnostics;
6+
using System.IO;
7+
using System.Net;
8+
using System.Threading;
9+
using System.Windows.Forms;
10+
using EssentialsPlugin.Settings;
11+
using EssentialsPlugin.Utility;
12+
using Sandbox;
13+
using Sandbox.ModAPI;
14+
using SEModAPIExtensions.API;
15+
using SEModAPIInternal.API.Common;
16+
using SteamSDK;
17+
using VRage.Game.ModAPI;
18+
using VRage.ModAPI;
19+
using VRageMath;
20+
21+
class ProcessCargoShips : ProcessHandlerBase
22+
{
23+
public override int GetUpdateResolution()
24+
{
25+
return (int)(PluginSettings.Instance.CargoShipSpawnTime * 60000);
26+
}
27+
28+
public override void Handle()
29+
{
30+
if(!PluginSettings.Instance.CargoShipsEnabled)
31+
return;
32+
33+
CargoShips.SpawnCargoShip( );
34+
}
35+
}
36+
}

EssentialsPlugin/Settings/PluginSettings.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ public class PluginSettings
121121

122122
private bool _timedCommandsEnabled;
123123
private MTObservableCollection<TimedCommandItem> _TimedCommandsItem;
124+
125+
private bool _cargoShipsEnabled;
126+
private float _cargoShipSpawnTime;
124127
#endregion
125128

126129
#region Static Properties
@@ -974,6 +977,26 @@ public MTObservableCollection<TimedCommandItem> TimedCommandsItems
974977
Save( );
975978
}
976979
}
980+
981+
public bool CargoShipsEnabled
982+
{
983+
get { return _cargoShipsEnabled; }
984+
set
985+
{
986+
_cargoShipsEnabled = value;
987+
Save( );
988+
}
989+
}
990+
991+
public float CargoShipSpawnTime
992+
{
993+
get { return _cargoShipSpawnTime; }
994+
set
995+
{
996+
_cargoShipSpawnTime = value;
997+
Save( );
998+
}
999+
}
9771000
#endregion
9781001

9791002
#region Constructor
@@ -1047,6 +1070,9 @@ public PluginSettings()
10471070
_timedCommandsEnabled = false;
10481071
_TimedCommandsItem = new MTObservableCollection<TimedCommandItem>( );
10491072
_TimedCommandsItem.CollectionChanged += ItemsCollectionChanged;
1073+
1074+
_cargoShipsEnabled = false;
1075+
_cargoShipSpawnTime = 10.0f;
10501076
}
10511077

10521078

0 commit comments

Comments
 (0)