{"id":492,"date":"2015-12-09T20:53:26","date_gmt":"2015-12-09T17:53:26","guid":{"rendered":"http:\/\/www.suuronen.eu\/blog\/?p=492"},"modified":"2015-12-09T20:57:01","modified_gmt":"2015-12-09T17:57:01","slug":"reactor-backup-start-script","status":"publish","type":"post","link":"https:\/\/suuronen.eu\/blog\/reactor-backup-start-script\/","title":{"rendered":"Reactor Backup start script"},"content":{"rendered":"<p>A little example for the <a href=\"http:\/\/www.spaceengineersgame.com\/\" target=\"_blank\">Space Engineers<\/a> game, when one reactor is shutdown, and the other needs to be started. An when main is back On, the secondary is shutdown. Do not forget to add the timer block!<\/p>\n<pre lang=\"csharp\" line=\"1\">const String PRI_REACTOR = \"Primary Reactor\";\r\nconst String SEC_REACTOR = \"Secondary Reactor\";\r\nconst String STATUS_PANEL = \"Reactor status LCD\";\r\n\r\nvoid Main(string argument) {\r\n  var GTS = GridTerminalSystem;\r\n  IMyReactor pri = GTS.GetBlockWithName(PRI_REACTOR) as IMyReactor;\r\n  IMyReactor sec = GTS.GetBlockWithName(SEC_REACTOR) as IMyReactor;\r\n  IMyTextPanel panel = GTS.GetBlockWithName(STATUS_PANEL) as IMyTextPanel;\r\n\r\n  if (!pri.IsWorking) {\r\n    sec.ApplyAction(\"OnOff_On\");\r\n  } else {\r\n    sec.ApplyAction(\"OnOff_Off\");\r\n  }\r\n  rewrite(panel,\r\n    PRI_REACTOR + \": \" + (pri.IsWorking?\"On\":\"Off\") + \"\\n\" +\r\n    SEC_REACTOR + \": \" + (sec.IsWorking?\"On\":\"Off\") + \"\\n\");\r\n}\r\n\r\nvoid rewrite(IMyTextPanel panel, String text) {\r\n  panel.WritePublicText(text, false);\r\n  panel.ShowPublicTextOnScreen();\r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>A little example for the Space Engineers game, when one reactor is shutdown, and the other needs to be started. An when main is back On, the secondary is shutdown. Do not forget to add the timer block! const String &hellip; <a href=\"https:\/\/suuronen.eu\/blog\/reactor-backup-start-script\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,5],"tags":[33,32],"class_list":["post-492","post","type-post","status-publish","format-standard","hentry","category-coding","category-gaming","tag-c","tag-space-engineers"],"_links":{"self":[{"href":"https:\/\/suuronen.eu\/blog\/wp-json\/wp\/v2\/posts\/492","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/suuronen.eu\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/suuronen.eu\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/suuronen.eu\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/suuronen.eu\/blog\/wp-json\/wp\/v2\/comments?post=492"}],"version-history":[{"count":7,"href":"https:\/\/suuronen.eu\/blog\/wp-json\/wp\/v2\/posts\/492\/revisions"}],"predecessor-version":[{"id":499,"href":"https:\/\/suuronen.eu\/blog\/wp-json\/wp\/v2\/posts\/492\/revisions\/499"}],"wp:attachment":[{"href":"https:\/\/suuronen.eu\/blog\/wp-json\/wp\/v2\/media?parent=492"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/suuronen.eu\/blog\/wp-json\/wp\/v2\/categories?post=492"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/suuronen.eu\/blog\/wp-json\/wp\/v2\/tags?post=492"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}