Space Engineers

Space Engineers

XPAR Mimir (OBSOLETE)
Animal 2016 年 1 月 6 日 上午 5:55
Additional Methods
I've been learning to code, with Mimir, noticed that you didn't have a way to check a door's Openness. Wrote my own, figured I'd offer it to you to give back to the community. Also present is a simple two door airlock tool

List<string> pairedDoors = new List<string> () { "Sliding Door - Forward Airlock 1", "Sliding Door - Forward Airlock 2", "Sliding Door - Engineering Airlock 1", "Sliding Door - Engineering Airlock 2", "Sliding Door - Access Hatch 1", "Sliding Door - Access Hatch 2", bool IsOpen(string doorName) { IMyDoor block = (IMyDoor)GridTerminalSystem.GetBlockWithName(doorName); if (block == null) { Log("No block named " + doorName); return false; } if (!(block is IMyDoor)) { Log(doorName + " is not a door"); return false; } return (block.Open); } void Airlocks() { for(int i = 0; i < pairedDoors.Count; i+=2) { if(IsOpen(pairedDoors))
{
if(IsEnabled(pairedDoors[i+1]))
Apply(pairedDoors[i+1]+".Off");
}
else
{
if(!IsEnabled(pairedDoors[i+1]))
Apply(pairedDoors[i+1]+".On");
}
if(IsOpen(pairedDoors[i+1]))
{
if(IsEnabled(pairedDoors))
Apply(pairedDoors+".Off");
}
else
{
if(!IsEnabled(pairedDoors))
Apply(pairedDoors+".On");
}
} }[/code]

and slip this into Status()
if (block is IMyDoor) return ( (block as IMyDoor).Open ? 1 : 0);
最后由 Animal 编辑于; 2016 年 1 月 6 日 下午 12:08
< >
正在显示第 1 - 15 条,共 28 条留言
Animal 2016 年 1 月 12 日 上午 5:02 
And here we go, IsCharging() now can be used to test whether a jumpdrive is charging

EDIT: found a better way to do it in the Jumpington and Rolled it into the IsCharging() Method

bool IsCharging(string batteryName) { IMyTerminalBlock block = Fetch(batteryName); if (block == null) { Log("No block named " + batteryName); return false; } if (block is IMyBatteryBlock) { string recharging = FetchLine("Fully recharged", block.DetailedInfo); return (recharging != null); } if (block is IMyJumpDrive) { return (block.GetValueBool("Recharge")); } return false; }
最后由 Animal 编辑于; 2016 年 1 月 13 日 上午 5:18
Craig P  [开发者] 2016 年 2 月 25 日 下午 1:01 
Oh, nice, I wrote Mimir so long ago that those didn't exist! I'll roll them into the next update!

Keep in mind that I don't get notified if someone creates a new topic. :(
Animal 2016 年 2 月 28 日 上午 8:31 
I've made some more changes since, but i kinda dropped out of SE for a bit, pending further updates. I'll be glad to offer up any further extensions i've written.
Animal 2016 年 2 月 28 日 上午 8:56 
Made this to turn on and off some grinders based on a turret set up to detect characters, so bugs couldnt eat my base. Got to thinking maybe it could be dismantled and serialized to make a PseudoTimer() method?

/*List < IMyTerminalBlock > SensorTurrets = new List < IMyTerminalBlock > (); // create list GridTerminalSystem.GetBlocksOfType < IMyLargeTurretBase > (SensorTurrets); // populate it int SensorCount = SensorTurrets.Count; // count it for(int i = 0; i < SensorCount; i++) // check all the turrets { if ((SensorTurrets as IMyLargeTurretBase).Azimuth != 0 || (SensorTurrets as IMyLargeTurretBase).Elevation != 0)
{

if (SensorTurrets.CustomName.Contains("Interior Turret - Bio Sensor")) // if turret is a bio sensor ...
{
Apply("*BK.On");
ResetSensorTurret (SensorTurrets as IMyLargeTurretBase);
TimerCountBio = 3; // trying to make my own timer
}
}
}

//Built In Timers
if((TimerCountBio > 0))
{
TimerCountBio = (TimerCountBio - 1);
}
if((TimerCountBio == 0))
{
Apply("*BK.Off");
} */
Craig P  [开发者] 2016 年 2 月 28 日 上午 9:43 
I haven't ever needed to use that kind of pseudotimer, but it might be fun to do a turret detection response!
Animal 2016 年 2 月 28 日 上午 9:49 
https://www.youtube.com/watch?v=FQ050ZlC1O4 Meet Oscar the Grouch, a SAM system I built. plans were to include laser turret networking, but Oscar got everything working using MIMIR and a single timer. Pseudo timers would be awesome for large vehicle doors and auto closing doors, good stuff for base management
Craig P  [开发者] 2016 年 2 月 28 日 上午 10:17 
I'll take a look! Keep in mind that Ratatosk is a quick laser antenna network system based on Mimir.
Craig P  [开发者] 2016 年 2 月 28 日 上午 10:18 
Heheh, that's shorter than I thought it'd be!
Animal 2016 年 2 月 28 日 上午 10:26 
In truth it's a pain in the ass to build, drilling out the ground to build it.
Animal 2016 年 2 月 28 日 上午 10:43 
i think i shall ahve to take Ratatosk apart later to see what evil i can carry out with it.
Craig P  [开发者] 2016 年 2 月 28 日 下午 2:26 
It's pretty easy. You can embed your current Mimir scripts inside of a Ratatosk install, it's the same library. Ratatosk is just a few functions on top of it.
Animal 2016 年 3 月 5 日 上午 11:15 
I just watched the ratatosk video, and oh my ♥♥♥♥♥♥♥ god remote commands i can make a garage door opener!!!!

Or even integrate it into my defensive outposts to trigger an alarm back at base
最后由 Animal 编辑于; 2016 年 3 月 5 日 上午 11:36
Craig P  [开发者] 2016 年 3 月 5 日 下午 12:30 
Sure, let me know if it mysteriously stops compiling!
Animal 2016 年 3 月 5 日 下午 1:35 
Based on experience i'm more likely to have it throw an object does not exist error on game reload. Out of curiosity, does ratatosk do anything with the private text strings?
Craig P  [开发者] 2016 年 3 月 5 日 下午 3:05 
No, private text didn't work as of two weeks ago.
< >
正在显示第 1 - 15 条,共 28 条留言
每页显示数: 1530 50