internal static void CreateShootActionSet <T>() where T : IMyTerminalBlock { var action0 = MyAPIGateway.TerminalControls.CreateAction <T>($"Shoot"); action0.Icon = @"Textures\GUI\Icons\Actions\Toggle.dds"; action0.Name = new StringBuilder($"Shoot On/Off"); action0.Action = delegate(IMyTerminalBlock blk) { var comp = blk?.Components?.Get <WeaponComponent>(); if (comp == null || comp.Platform.State != MyWeaponPlatform.PlatformState.Ready) { return; } TerminalHelpers.WCShootToggleAction(comp); }; action0.Writer = (blk, sb) => { var comp = blk.Components.Get <WeaponComponent>(); if (comp == null || comp.Platform.State != MyWeaponPlatform.PlatformState.Ready) { return; } if (comp.State.Value.ShootOn) { sb.Append("On"); } else { sb.Append("Off"); } }; action0.Enabled = (b) => { return(b.Components.Has <WeaponComponent>()); }; action0.ValidForGroups = true; MyAPIGateway.TerminalControls.AddAction <T>(action0); var action1 = MyAPIGateway.TerminalControls.CreateAction <T>($"Shoot_On"); action1.Icon = @"Textures\GUI\Icons\Actions\SwitchOn.dds"; action1.Name = new StringBuilder($"Shoot On"); action1.Action = delegate(IMyTerminalBlock blk) { var comp = blk?.Components?.Get <WeaponComponent>(); if (comp == null || comp.Platform.State != MyWeaponPlatform.PlatformState.Ready) { return; } TerminalHelpers.WCShootOnAction(comp); }; action1.Writer = (blk, sb) => { var comp = blk.Components.Get <WeaponComponent>(); if (comp == null || comp.Platform.State != MyWeaponPlatform.PlatformState.Ready) { return; } if (comp.State.Value.ShootOn) { sb.Append("On"); } else { sb.Append("Off"); } }; action1.Enabled = (b) => { return(b.Components.Has <WeaponComponent>()); }; action1.ValidForGroups = true; MyAPIGateway.TerminalControls.AddAction <T>(action1); var action2 = MyAPIGateway.TerminalControls.CreateAction <T>($"Shoot_Off"); action2.Icon = @"Textures\GUI\Icons\Actions\SwitchOff.dds"; action2.Name = new StringBuilder($"Shoot Off"); action2.Action = delegate(IMyTerminalBlock blk) { var comp = blk?.Components?.Get <WeaponComponent>(); if (comp == null || comp.Platform.State != MyWeaponPlatform.PlatformState.Ready) { return; } TerminalHelpers.WCShootOffAction(comp); }; action2.Writer = (blk, sb) => { var comp = blk.Components.Get <WeaponComponent>(); if (comp == null || comp.Platform.State != MyWeaponPlatform.PlatformState.Ready) { return; } if (comp.State.Value.ShootOn) { sb.Append("On"); } else { sb.Append("Off"); } }; action2.Enabled = (b) => { return(b.Components.Has <WeaponComponent>()); }; action2.ValidForGroups = true; MyAPIGateway.TerminalControls.AddAction <T>(action2); var action3 = MyAPIGateway.TerminalControls.CreateAction <T>($"ShootOnce"); action3.Icon = @"Textures\GUI\Icons\Actions\SwitchOn.dds"; action3.Name = new StringBuilder($"Shoot Once"); action3.Action = delegate(IMyTerminalBlock blk) { var comp = blk?.Components?.Get <WeaponComponent>(); if (comp == null || comp.Platform.State != MyWeaponPlatform.PlatformState.Ready) { return; } TerminalHelpers.WCShootOnceAction(comp); }; action3.Writer = (b, t) => t.Append(""); action3.Enabled = (b) => { return(b.Components.Has <WeaponComponent>()); }; action3.ValidForGroups = false; MyAPIGateway.TerminalControls.AddAction <T>(action3); }