Difference between revisions of "Incisor mk.1"

From Space Engineers Wiki
Jump to: navigation, search
 
Line 22: Line 22:
 
=== Interior Defenses ===
 
=== Interior Defenses ===
 
The ship has no interior.
 
The ship has no interior.
 +
 +
== Programming ==
 +
Through [[hacking]] an Incisor, it appears that [[Programmable Block]] #1 has the following code:
 +
 +
List<IMyTerminalBlock> list = new List<IMyTerminalBlock>();
 +
 
 +
void Main(string argument)
 +
{
 +
    Vector3D origin = new Vector3D(0, 0, 0);
 +
    if (this.Storage == null || this.Storage == "")
 +
    {
 +
        origin = Me.GetPosition();
 +
        this.Storage = origin.ToString();
 +
    }
 +
    else
 +
    {
 +
        Vector3D.TryParse(this.Storage, out origin);
 +
    }
 +
 
 +
    GridTerminalSystem.GetBlocksOfType<IMyRemoteControl>(list);
 +
    if (list.Count > 0)
 +
    {
 +
        var remote = list[0] as IMyRemoteControl;
 +
        remote.ClearWaypoints();
 +
        Vector3D player = new Vector3D(0, 0, 0);
 +
        bool success = remote.GetNearestPlayer(out player);
 +
        if (success)
 +
        {
 +
            bool gotoOrigin = false;
 +
            GridTerminalSystem.GetBlocksOfType<IMyUserControllableGun>(list);
 +
            if (list.Count == 0)
 +
            {
 +
                gotoOrigin = true;
 +
            }
 +
            else
 +
            {
 +
                bool hasUsableGun = false;
 +
                for (int i = 0; i < list.Count; ++i)
 +
                {
 +
                    var weapon = list[i];
 +
                    if (!weapon.IsFunctional) continue;
 +
                    if (weapon.HasInventory() && !weapon.GetInventory(0).IsItemAt(0)) continue;
 +
 
 +
                    hasUsableGun = true;
 +
                }
 +
 
 +
                if (!hasUsableGun)
 +
                {
 +
                    gotoOrigin = true;
 +
                }
 +
            }
 +
 
 +
            if (Vector3D.DistanceSquared(player, origin) > 20000 * 20000)
 +
            {
 +
                gotoOrigin = true;
 +
            }
 +
 
 +
            if (gotoOrigin)
 +
            {
 +
                remote.AddWaypoint(origin, "Origin");
 +
            }
 +
            else
 +
            {
 +
                remote.AddWaypoint(player, "Player");
 +
            }
 +
            remote.SetAutoPilotEnabled(true);
 +
        }
 +
    }
 +
}
 +
 +
Programmable Block #2 has the following code:
 +
 +
void Main(string argument) 
 +
 +
    var list = new List<IMyTerminalBlock>(); 
 +
    GridTerminalSystem.GetBlocksOfType<IMyRemoteControl>(list); 
 +
    if (list.Count > 0) 
 +
    { 
 +
        var remote = list[0] as IMyRemoteControl; 
 +
        remote.ClearWaypoints(); 
 +
        Vector3D player = new Vector3D(0, 0, 0); 
 +
        Vector3D oppositedirection = new Vector3D(0, 0, 0); 
 +
 
 +
        bool success = remote.GetNearestPlayer(out player); 
 +
 
 +
        if (success) 
 +
        { 
 +
                    oppositedirection = remote.GetPosition (); 
 +
                    oppositedirection = oppositedirection + oppositedirection - player; 
 +
                    remote.AddWaypoint(oppositedirection, "FleeDirection"); 
 +
                    remote.SetAutoPilotEnabled(true); 
 +
        } 
 +
    } 
 +
}
 +
 +
Timer Block 1 is set on a 3 second delay and triggers Programmable Block 1 as well as setting itself to start again after its delay expires. Timer Block 2 does nothing and has no actions set.
 +
 +
The [[Gatling Turret]] is set to default settings (600 m range, target everything except missiles) except that idle movement is turned off.
 +
 +
== Analysis ==
 +
It appears that Programmable Block 2 is never run. It may be leftover code which is no longer in use, or code which hasn't yet been fully implemented. As such, Programmable Block 1 is the only one of real significance in the ship's operation.
 +
 +
With Timer Block 1, the ship runs a loop every three seconds. It saves its starting position with the first run-through of the script and reloads it in subsequent iterations for later use. Then, the ship will check to see if it has a working gun. It does this by getting a list of any weapons it might have and checking each of them to see if any have ammo. As long as it has a weapon with ammo, it will attempt to attack the nearest player. If it has been disarmed, it will retreat. It does nothing and simply waits if it has a working weapon but cannot find a player.
 +
 +
In attacking, it simply creates a waypoint at the detected player's position and moves there.
 +
 +
In retreating, it creates a waypoint at its point of origin and moves there. It will also stop pursuing a player and return to its point of origin if the nearest player is more than 20 km from its point of origin.
 +
 +
Programmable Block 2, if it were functional, appears to make the ship try to move in the exact opposite direction from the player when activated.

Latest revision as of 15:52, 1 March 2018

Cargo Ship

Incisor_mk.1

300px
Class:
Drone
Mass:
178,865 kg
Speed:
N/a m/s
Trapped:
no
Direct Fire Weapons:
none
Exterior Defenses:
Interior Defenses:
none
Ship size:
large

A Incisor_mk.1 is a type of drone. It is spawned by various Cargo Ships.

Defenses

Exterior Defenses

The turret is directly connected to 2x cargo containers.

Interior Defenses

The ship has no interior.

Programming

Through hacking an Incisor, it appears that Programmable Block #1 has the following code:

List<IMyTerminalBlock> list = new List<IMyTerminalBlock>(); 
 
void Main(string argument) 
{ 
    Vector3D origin = new Vector3D(0, 0, 0); 
    if (this.Storage == null || this.Storage == "") 
    { 
        origin = Me.GetPosition(); 
        this.Storage = origin.ToString(); 
    } 
    else 
    { 
        Vector3D.TryParse(this.Storage, out origin); 
    } 
 
    GridTerminalSystem.GetBlocksOfType<IMyRemoteControl>(list); 
    if (list.Count > 0) 
    { 
        var remote = list[0] as IMyRemoteControl; 
        remote.ClearWaypoints(); 
        Vector3D player = new Vector3D(0, 0, 0); 
        bool success = remote.GetNearestPlayer(out player); 
        if (success) 
        { 
            bool gotoOrigin = false; 
            GridTerminalSystem.GetBlocksOfType<IMyUserControllableGun>(list); 
            if (list.Count == 0) 
            { 
                gotoOrigin = true; 
            } 
            else 
            { 
                bool hasUsableGun = false; 
                for (int i = 0; i < list.Count; ++i) 
                { 
                    var weapon = list[i]; 
                    if (!weapon.IsFunctional) continue; 
                    if (weapon.HasInventory() && !weapon.GetInventory(0).IsItemAt(0)) continue; 
 
                    hasUsableGun = true; 
                } 
 
                if (!hasUsableGun) 
                { 
                    gotoOrigin = true; 
                } 
            } 
 
            if (Vector3D.DistanceSquared(player, origin) > 20000 * 20000) 
            { 
                gotoOrigin = true; 
            } 
 
            if (gotoOrigin) 
            { 
                remote.AddWaypoint(origin, "Origin"); 
            } 
            else 
            { 
                remote.AddWaypoint(player, "Player"); 
            } 
            remote.SetAutoPilotEnabled(true); 
        } 
    } 
}

Programmable Block #2 has the following code:

void Main(string argument)  
{  
    var list = new List<IMyTerminalBlock>();  
    GridTerminalSystem.GetBlocksOfType<IMyRemoteControl>(list);  
    if (list.Count > 0)  
    {  
        var remote = list[0] as IMyRemoteControl;  
        remote.ClearWaypoints();  
        Vector3D player = new Vector3D(0, 0, 0);  
        Vector3D oppositedirection = new Vector3D(0, 0, 0);  
 
        bool success = remote.GetNearestPlayer(out player);  
 
        if (success)  
        {  
                    oppositedirection = remote.GetPosition ();  
                    oppositedirection = oppositedirection + oppositedirection - player;  
                    remote.AddWaypoint(oppositedirection, "FleeDirection");  
                    remote.SetAutoPilotEnabled(true);  
        }  
    }  
}

Timer Block 1 is set on a 3 second delay and triggers Programmable Block 1 as well as setting itself to start again after its delay expires. Timer Block 2 does nothing and has no actions set.

The Gatling Turret is set to default settings (600 m range, target everything except missiles) except that idle movement is turned off.

Analysis

It appears that Programmable Block 2 is never run. It may be leftover code which is no longer in use, or code which hasn't yet been fully implemented. As such, Programmable Block 1 is the only one of real significance in the ship's operation.

With Timer Block 1, the ship runs a loop every three seconds. It saves its starting position with the first run-through of the script and reloads it in subsequent iterations for later use. Then, the ship will check to see if it has a working gun. It does this by getting a list of any weapons it might have and checking each of them to see if any have ammo. As long as it has a weapon with ammo, it will attempt to attack the nearest player. If it has been disarmed, it will retreat. It does nothing and simply waits if it has a working weapon but cannot find a player.

In attacking, it simply creates a waypoint at the detected player's position and moves there.

In retreating, it creates a waypoint at its point of origin and moves there. It will also stop pursuing a player and return to its point of origin if the nearest player is more than 20 km from its point of origin.

Programmable Block 2, if it were functional, appears to make the ship try to move in the exact opposite direction from the player when activated.