Space Engineers

Space Engineers

XPAR Mimir (OBSOLETE)
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);
Laatst bewerkt door Animal; 6 jan 2016 om 12:08
< >
1-15 van 28 reacties weergegeven
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; }
Laatst bewerkt door Animal; 13 jan 2016 om 5:18
Craig P  [ontwikkelaar] 25 feb 2016 om 13: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. :(
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.
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  [ontwikkelaar] 28 feb 2016 om 9:43 
I haven't ever needed to use that kind of pseudotimer, but it might be fun to do a turret detection response!
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  [ontwikkelaar] 28 feb 2016 om 10:17 
I'll take a look! Keep in mind that Ratatosk is a quick laser antenna network system based on Mimir.
Craig P  [ontwikkelaar] 28 feb 2016 om 10:18 
Heheh, that's shorter than I thought it'd be!
In truth it's a pain in the ass to build, drilling out the ground to build it.
i think i shall ahve to take Ratatosk apart later to see what evil i can carry out with it.
Craig P  [ontwikkelaar] 28 feb 2016 om 14: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.
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
Laatst bewerkt door Animal; 5 mrt 2016 om 11:36
Craig P  [ontwikkelaar] 5 mrt 2016 om 12:30 
Sure, let me know if it mysteriously stops compiling!
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  [ontwikkelaar] 5 mrt 2016 om 15:05 
No, private text didn't work as of two weeks ago.
< >
1-15 van 28 reacties weergegeven
Per pagina: 1530 50