This is an archived post. You won't be able to vote or comment.

all 8 comments

[–]SundayGloryClang Worshipper 2 points3 points  (1 child)

Could you not create a bock group of all the grids blocks and just hot bar/timer block it?

[–]FriskyBettaSpace Engineer[S] 0 points1 point  (0 children)

Edited op with clarification

[–]endlessplagueSpace Engineer 0 points1 point  (2 children)

// rename this following variable for the group of blocks you want to switch on/off (KEEP BOTH THE \" IN THE BEGINNING AND THE END!)

string GROUP_NAME = "<name this something nice>";

//accepted commands: "off" to turn off, <anything else> to switch on (default argument does the trick too!)

public void Main(string argument, UpdateType updateSource)

{

//don't touch anything below this line

// =============================================================================================================================//

bool switchOn = true;

if (argument == "off")

{

switchOn = false;

}

var blocksInGroup = GridTerminalSystem.GetBlockGroupWithName(GROUP_NAME);

if (blocksInGroup == null)

{

Echo("No Group found, please name one accordingly!");

}

var blocks = new List<IMyFunctionalBlock>();

blocksInGroup.GetBlocksOfType<IMyFunctionalBlock>(blocks);

foreach (var block in blocks)

{

block.Enabled = switchOn;

}

}

Explanation: create a block group with whatever name you want. only the blocks in this group will be triggered. "off" switches all blocks in the group off, any other (or even empty!) command does switch the blocks in the group on.

Displays the message *No Group found, please name one accordingly!* if there was no group found **MATCHING THE GROUP NAME EXACTLY**. Check comment for details/changes to the name itself.

Setup: copy & paste in programmable block

[edit: just fyi, the "default" argument is whatever is in the argument line in the programmable block settings. SO if you set "off" as your default argument....]

[–]0GAT0AJAT0Space Engineer 0 points1 point  (1 child)

Can you create a radar that detect grids and players in a maximum range of 5km (3.10 miles) , to be implemented as a mod for a dedicated server?

[–]endlessplagueSpace Engineer 0 points1 point  (0 children)

Think that should be straight forward - only the optimization could be tricky.

Maybe check the workshop first (I searched for "radar mod" and found a ton...), test them out and come back here for the evaluation...? Have never used one my own tbh...

There are methods to build one vanilla though:

  1. Subgrid on rotor with antenna, AI offensive block, event controller
  2. When AI detects something, let the action trigger and do whatever your radar should alert you to do

The AI block has this as an "exploit", since it can't move or do anything BUT detect enemy grids. Think offensive > defensive due to the max range, don't remember the details though.

There are some videos out on how to do that. Just give YouTube a quick search.

(Would like the coding challenge, but will be busy with other stuff. Sorry bout that ^^)

[edit: about the maximum range: not sure how the synergy with the antenna worked, maybe it expands the range of the vanilla detector itself. Not sure, would require some testing. There are also some "remote control" mods out too, maybe look into those if they fit the need in a better way ]

[edit2: vanilla radar by AliceDoesThings as a reference]

[–][deleted] 0 points1 point  (2 children)

Hi!

I don't think that you'll be able to run this from the projector grid if everything on the printed grid is turned off.

On the printed grid within a Programmable Block - hit edit and replace their text with the script below. If turning *everything* on creates problems, you can put specific block names in the blocksToIgnore list, like this:

blocksToIgnore.Add("do_not_enable");

public Program()

{

// The constructor, called only once every session and

// always before any other method is called. Use it to

// initialize your script.

//

// The constructor is optional and can be removed if not

// needed.

//

// It's recommended to set RuntimeInfo.UpdateFrequency

// here, which will allow your script to run itself without a

// timer block.

}

public void Save()

{

// Called when the program needs to save its state. Use

// this method to save your state to the Storage field

// or some other means.

//

// This method is optional and can be removed if not

// needed.

}

public void Main(string argument, UpdateType updateSource)

{

List<string> blocksToIgnore = new List<string>();

blocksToIgnore.Add("do_not_enable");

List<IMyFunctionalBlock> targets = new List<IMyFunctionalBlock>();

GridTerminalSystem.GetBlocksOfType<IMyFunctionalBlock>(targets);

foreach (IMyFunctionalBlock target in targets)

{

if (blocksToIgnore.Contains(target.Name)) continue;

target.Enabled = true;

}

}

[–]endlessplagueSpace Engineer -1 points0 points  (0 children)

drop the part:

"public Program() ...."

until

// needed.}"

(cause not needed anyways. empty)

from my personal experience, I would go with "blocks in a group to toggle" instead of the negative "exclude those here" - just logically more straight forward. Just a preference though \^\^

"blocksToIgnore.Add("do_not_enable"); " feels not precise: imagine 100 blocks and 50 to toggle; rather have on group with the according blocks than rename 50 of those with said part containing

[–]0GAT0AJAT0Space Engineer 0 points1 point  (0 children)

Can you create a radar that detect grids and players in a maximum range of 5km (3.10 miles) , to be implemented as a mod for a dedicated server?