Skip to content

Commit

Permalink
-added workaround for OnCubeGridCreated not being fired
Browse files Browse the repository at this point in the history
-message multiplier setting added to let admins slow down the initial dropship messaging.
  • Loading branch information
DraygoKorvan committed Sep 6, 2014
1 parent 4006b18 commit c983f95
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 9 deletions.
55 changes: 48 additions & 7 deletions Core.cs
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,35 @@ public int teleportDistance
get { return settings.teleportDistance; }
set { settings.teleportDistance = value; }
}
[Category("SE Dropship")]
[Description("Additional bootup message.")]
[Browsable(true)]
[ReadOnly(false)]
public string bootupMsg
{
get { return settings.bootupMsg; }
set { settings.bootupMsg = value; }
}
[Category("SE Dropship")]
[Description("Additional arrival message.")]
[Browsable(true)]
[ReadOnly(false)]
public string arrivalMsg
{
get { return settings.arrivalMsg; }
set { settings.arrivalMsg = value; }
}
[Category("SE Dropship")]
[Description("Message speed multiplier, must be greater than or equal to 1")]
[Browsable(true)]
[ReadOnly(false)]
public double message_mult
{
get { return settings.messageMult; }
set { settings.messageMult = value; }
}

#region "Debug"
[Category("Debug")]
[Description("List of allowed asteroids")]
[Browsable(true)]
Expand Down Expand Up @@ -262,7 +291,7 @@ public int debugLevel
get { return m_debuglevel; }
set { m_debuglevel = value; }
}

#endregion
#endregion

#region "Methods"
Expand Down Expand Up @@ -364,7 +393,11 @@ private void mainloop()
m_ignore.Add(grid.EntityId);
}
m_loading = false;

while (m_running)
{
Thread.Sleep(10000);
SectorObjectManager.Instance.Refresh();
}
}
private Vector3 FindInterceptVector(Vector3 spawnOrigin, float meteoroidSpeed, Vector3 targetOrigin, Vector3 targetVel)
{
Expand Down Expand Up @@ -396,6 +429,8 @@ private void OnCubeGridDetected(CubeGridEntity grid)
while (grid.IsLoading)
{
Thread.Sleep(resolution);
if (isdebugging && debugLevel > 1)
LogManager.APILog.WriteLineAndConsole("Loading: " + _entityId);
grid = (CubeGridEntity)GameEntityManager.GetEntity(_entityId);
}
}
Expand Down Expand Up @@ -448,7 +483,8 @@ private void OnCubeGridDetected(CubeGridEntity grid)
}
public void doDrop(CubeGridEntity grid, CockpitEntity seat, long Owner)
{
Console.WriteLine("DoDrop called.");
if(isdebugging)
Console.WriteLine("DoDrop called.");
//find target
if (m_asteroids.Count == 0)
{
Expand All @@ -475,13 +511,13 @@ public void doDrop(CubeGridEntity grid, CockpitEntity seat, long Owner)
}
}
ChatManager.Instance.SendPrivateChatMessage(steamid, "Dropship booting up, please stay in your seat for insertion.");
Thread.Sleep(1000);
Thread.Sleep((int)(2000 * message_mult));
ChatManager.Instance.SendPrivateChatMessage(steamid, "If you exited your ship please return to the passenger seat before the countdown finishes.");
Thread.Sleep(2000);
Thread.Sleep((int)(5000 * message_mult));
ChatManager.Instance.SendPrivateChatMessage(steamid, "Dropship Sequence Initiated, please remain seated. Exiting your seat will abort automatic insertion.");
Thread.Sleep(1000);
Thread.Sleep((int)(2000 * message_mult));
ChatManager.Instance.SendPrivateChatMessage(steamid, "Beginning Insertion Sequence.");
Thread.Sleep(1000);
Thread.Sleep((int)(1000 * message_mult));
for ( int count = countdown; count > 0; count--)
{
ChatManager.Instance.SendPrivateChatMessage(steamid, count.ToString() + ".");
Expand All @@ -499,6 +535,8 @@ public void doDrop(CubeGridEntity grid, CockpitEntity seat, long Owner)

return;
}
if (seat.PilotEntity != null && bootupMsg != "")
ChatManager.Instance.SendPrivateChatMessage(steamid, bootupMsg);
Vector3I startadjustVector = new Vector3I(asteroid.x/2, asteroid.y/2, asteroid.z/2);
MyVoxelMaterialDefinition mat = asteroid.asteroid.GetMaterial(startadjustVector);
Vector3 dir = Vector3.Normalize(new Vector3((float)(m_gen.NextDouble() * 2 - 1), (float)(m_gen.NextDouble() * 2 - 1), (float)(m_gen.NextDouble() * 2 - 1)));
Expand Down Expand Up @@ -561,6 +599,9 @@ public void doDrop(CubeGridEntity grid, CockpitEntity seat, long Owner)
{
ChatManager.Instance.SendPrivateChatMessage(steamid, "Welcome to your destination, pod will attempt to land. If navigation calculations were off it will automatically stop the pod in " + ((int)timeToCollision*2).ToString() + " seconds. Have a nice day!");
grid.LinearVelocity = Vector3.Multiply(Vector3.Normalize(Vector3Intercept), slowSpeed);
Thread.Sleep(1000);
if (seat.PilotEntity != null && arrivalMsg != "")
ChatManager.Instance.SendPrivateChatMessage(steamid, arrivalMsg);
Thread.Sleep((int)timeToCollision*2 * 1000);

grid.LinearVelocity = new Vector3Wrapper(0, 0, 0);
Expand Down
4 changes: 2 additions & 2 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@
// Build Number
// Revision
//
[assembly: AssemblyVersion("0.5.1.4")]
[assembly: AssemblyFileVersion("0.5.1.4")]
[assembly: AssemblyVersion("0.5.3.2")]
[assembly: AssemblyFileVersion("0.5.3.2")]
Binary file modified SE-Dropship.v12.suo
Binary file not shown.
21 changes: 21 additions & 0 deletions SEDropshipSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ public class SEDropshipSettings
private bool m_requireMagnesium = false;
private bool m_requireVital = true;
private string m_ignoreKeyword = "";
private string m_arrivalMsg = "";
private string m_bootupMsg = "";
private double m_messageMult = 1.0d;

public int slowDownDistance
{
Expand Down Expand Up @@ -86,5 +89,23 @@ public string ignoreKeyword
m_ignoreKeyword = value;
}
}

public string arrivalMsg
{
get { return m_arrivalMsg; }
set { m_arrivalMsg = value; }
}

public string bootupMsg
{
get { return m_bootupMsg; }
set { m_bootupMsg = value; }
}

public double messageMult
{
get { return m_messageMult; }
set { if(value >= 1.0d) m_messageMult = value; }
}
}
}

0 comments on commit c983f95

Please sign in to comment.