public override void Init(Reactor reactor) { base.Init(reactor); ComponentMethod cm = null; try { cm = reactor.FindMethod(actionMethod); } catch (ArgumentNullException e) { Debug.LogError("[Action Node] Could not find method :" + actionMethod + "\n" + NodeNamesInStack()); throw e; } if(cm == null) { Debug.LogError("Could not load action method: " + actionMethod); } else { if(cm.methodInfo.ReturnType == typeof(IEnumerator<NodeResult>)) { component = cm.component; methodInfo = cm.methodInfo; if( methodParams != null ) { methodParams.ConvertParams(methodInfo); } } else { Debug.LogError("Action method has invalid signature: " + actionMethod); } } }
public static void RunReactor(Reactor reactor) { for (int t = 0; t < ItsTicksPerGeneration; t++) { reactor.OnTick(); } }
public static ServerWebSocketUpgradeRequest Create(Reactor.Http.HttpContext context) { try { var path = context.Request.Url.AbsolutePath; var method = context.Request.Method; var protocol = context.Request.ProtocolVersion; var upgrade = context.Request.Headers["Upgrade"]; var connection = context.Request.Headers["Connection"]; if (protocol == HttpVersion.Version11 && method.ToLower() == "get" && upgrade.ToLower().Contains("websocket") && connection.ToLower().Contains("upgrade")) { return new ServerWebSocketUpgradeRequest(context); } return null; } catch { return null; } }
public Server(Reactor.Http.Server server, string path) { this.path = path; this.server = server; if(this.server.OnContext == null) { this.server.OnContext = context => { context.Response.StatusCode = 401; context.Response.ContentType = "text/plain"; context.Response.Write("method not allowed"); context.Response.End(); }; } this.servercb = this.server.OnContext; this.server.OnContext = this.OnContext; this.OnUpgrade = (context, callback) => callback(true, string.Empty); }
public Server Listen(int port, Reactor.Action<Exception> callback) { try { this.httplistener = new Reactor.Net.HttpListener(); this.httplistener.Prefixes.Add(string.Format("http://*:{0}/", port)); this.httplistener.Start(); this.GetContext(); callback(null); } catch(Exception exception) { if(exception is HttpListenerException) { callback(exception); } else { callback(exception); } } return this; }
public static Server Create(Reactor.Action<Reactor.Fusion.Socket> callback) { var server = new Server(); server.onsocket = callback; return server; }
private ServerWebSocketUpgradeRequest(Reactor.Http.HttpContext context) { this.Context = context; this.SecWebSocketExtensions = context.Request.Headers["Sec-WebSocket-Extensions"]; this.SecWebSocketKey = context.Request.Headers["Sec-WebSocket-Key"]; this.SecWebSocketVersion = context.Request.Headers["Sec-WebSocket-Version"]; }
public override void Init(Reactor reactor) { base.Init(reactor); var cm = reactor.FindMethod (functionName); if (cm == null) { Debug.LogError ("Could not load function method: " + functionName); } else { component = cm.component; methodInfo = cm.methodInfo; } }
internal WebSocketResponse(Reactor.Tcp.Socket socket, Reactor.Buffer buffer) { this.Socket = socket; this.Frames = new List<Frame>(); this.Headers = new Dictionary<string, string>(); this.ParseResponseHeader(buffer); this.ParseResponseBody(buffer); }
internal HttpContext(Reactor.Net.HttpListenerContext HttpListenerContext) { this.httpListenerContext = HttpListenerContext; this.User = this.httpListenerContext.User; this.Connection = new ServerConnection (this, this.httpListenerContext.Connection); this.Request = new ServerRequest (this, this.httpListenerContext.Request); this.Response = new ServerResponse (this, this.httpListenerContext.Response); }
public static Reactor GetInstance() { lock (typeof(Reactor)) { if (reactor == null) { reactor = new Reactor(); } } return reactor; }
public Route(string pattern, string method, Reactor.Web.Middleware[] middleware, Action<Context> handler) { this.Method = method; this.middleware = new List<Reactor.Web.Middleware>(middleware); this.handler = handler; this.Pattern = pattern; this.names = this.ComputeNames(); this.regex = this.ComputeRegex(); }
public override void Init(Reactor reactor) { base.Init(reactor); var cm = reactor.FindMethod(conditionMethod); if(cm == null) { Debug.LogError("Could not load condition method: " + conditionMethod); } else { if(cm.methodInfo.ReturnType == typeof(bool)) { component = cm.component; methodInfo = cm.methodInfo; } else { Debug.LogError("Condition method has invalid signature: " + conditionMethod); } } }
public Socket(Reactor.Udp.Socket socket, System.Net.EndPoint endpoint) { this.OnConnect += () => { }; this.OnData += data => { }; this.OnError += error => { }; this.OnEnd += () => { }; this.sending = false; this.socket = socket; this.endpoint = endpoint; }
void Load(Reactor asset) { Reactor.s_breakePoints.Clear(); if( reactor != null ) { reactor.isInDebug = false; } reactor = asset; if (reactor != null) { if(EditorApplication.isPlaying) { reactor.isInDebug = true; root = reactor.GetRoot(); } } }
public DeathStar() { ExteriorQuadaniumsteelouterhull exteriorQuandaniumsteelouterhull = new ExteriorQuadaniumsteelouterhull(100, 100, 100); Console.WriteLine("Outer Shell Hardness is {0}, Health is {1}, Nanites are at {2}", exteriorQuandaniumsteelouterhull.Hardness, exteriorQuandaniumsteelouterhull.Health, exteriorQuandaniumsteelouterhull.Nanites); exteriorQuandaniumsteelouterhull.TakeDamage(); exteriorQuandaniumsteelouterhull.NaniteRepair(); Reactor reactor = new Reactor(100); Console.WriteLine("Power is {0} %", reactor); reactor.GeneratePower(); ReactorCore reactorCore = new ReactorCore(50, 100, 50, 100, 100, 100, 100); Console.WriteLine("Fuel rod level {1}, control rod level {3}, water reactor level {4}, uranium level {5}, boron level {6}", reactorCore.fuelRodLevel, reactorCore.controlRodLevel, reactorCore.waterReactorLevel, reactorCore.uraniumAmount, reactorCore.boronAmount); }
public static IList<IComponent> BuildComponentsFromRNA(Reactor reactor, string rna ) { if (rna.Length - reactor.GetWidth() != reactor.GetWidth()*reactor.GetHeight()) throw new ArgumentOutOfRangeException("rna", @"rna didnt match reactor parameters"); var gridRNA = rna.Split(':'); var toReturn = new List<IComponent>(); for (uint x = 0; x < gridRNA.Length; x++) { string column = gridRNA[x]; for (uint y = 0; y < column.Length; y++) { Component.Component toBuild; switch (column[(int)y]) { case 'U': toBuild = Component.Component.UranCell; break; case 'C': toBuild = Component.Component.CoolCell; break; case 'E': toBuild = Component.Component.Empty; break; case 'R': toBuild = Component.Component.ReactorPlating; break; case 'H': toBuild = Component.Component.HeatDispenser; break; default: throw new ArgumentOutOfRangeException(); } var newComponent = BuildComponent(x, y, toBuild); reactor.Pulse += newComponent.PulseHandler; toReturn.Add(newComponent); } } return toReturn; }
public Server(Reactor.Http.Server httpserver) { this.router = new Router(); this.httpserver = httpserver; this.servercb = this.httpserver.OnContext; this.httpserver.OnContext = this.OnHttpContext; this.httpserver.OnError += (error) => { if (this.OnError != null) { this.OnError(error); } }; }
internal Socket(Reactor.Web.Socket.Transport transport) { this.transport = transport; this.State = SocketState.Open; this.transport.OnOpen = () => { if (this.OnOpen != null) { this.OnOpen(); } }; this.transport.OnError = (exception) => { if (this.OnError != null) { this.OnError(exception); } }; this.transport.OnClose = () => { this.State = SocketState.Closed; this.Close(); if (this.OnClose != null) { this.OnClose(); } }; this.transport.OnMessage = (message) => { if (this.OnMessage != null) { this.OnMessage(message); } }; }
public static void Process(Reactor.Web.Context context, List<Middleware> middlware, Action next) { if (middlware == null) { next(); return; } if (middlware.Count == 0) { next(); return; } int index = 0; Reactor.Action action = null; action = () => { if (index < middlware.Count) { middlware[index](context, () => { index++; action(); }); } else { next(); } }; action(); }
public override void Init(Reactor reactor) { base.Init(reactor); if (reactable != null) { #region Edited by PanDenat reactor.AddComponentsIfMissing(reactable); #endregion var root = (React.Root)React.JsonSerializer.Decode(reactable.json); root.PreProcess(gameObject, reactor); importedChild = root.children[0]; #region Log if null if (importedChild == null) { Debug.LogWarning("Imported root: " + root + " \n\n" + "Imported reactable: " + reactable + "\n\n" + "Imported reactable behaviours: " + reactable.behaviourTypes + "\n\n" + "Reactor: " + reactor); Debug.Log(reactable.json); } #endregion } else Debug.LogError("[Import Reactable Node] no reactable to import!\n Reactor.reactable = " + reactor.reactable); }
private void RebalanceHeat(Reactor reactor) { int difference = reactor.ItsHeat - this.ItsCurrentHeat; if (Math.Abs(difference - 0.0f) < 0) return; int rebalance = (int)Math.Abs(difference) /2; if (rebalance > 25) rebalance = 25; //reactor has more heat if (difference > 0) { this.ItsCurrentHeat -= rebalance; reactor.ItsHeat += rebalance; } //this has more heat else { this.ItsCurrentHeat += rebalance; reactor.ItsHeat -= rebalance; } }
public OldMan(GameServer server, Mundane mundane) : base(server, mundane) { reactor = new Reactor() { Name = "Tutorial : Magic", CanActAgain = false, CallingNpc = mundane.Template.Name, WhenCanActAgain = new GameServerTimer(TimeSpan.FromMinutes(10)), Sequences = new List <DialogSequence>() { new DialogSequence() { Id = 0, CanMoveBack = false, CanMoveNext = true, DisplayImage = (ushort)mundane.Template.Image, DisplayText = "Hey.", Title = mundane.Template.Name, }, new DialogSequence() { Id = 1, CanMoveBack = true, CanMoveNext = true, DisplayImage = (ushort)mundane.Template.Image, Title = mundane.Template.Name, DisplayText = "What's Up?", }, new DialogSequence() { Id = 2, CanMoveBack = true, CanMoveNext = true, DisplayImage = (ushort)mundane.Template.Image, Title = mundane.Template.Name, DisplayText = "Let me tell you what?", ContinueOn = 0x0003, ContinueAt = 3, RollBackTo = 1, HasOptions = true, Options = new OptionsDataItem[] { new OptionsDataItem(0x0001, "Tutorial : Interface"), new OptionsDataItem(0x0002, "Tutorial : Interaction"), new OptionsDataItem(0x0003, "Tutorial : Bulletins"), new OptionsDataItem(0x0004, "Tutorial : Classes"), new OptionsDataItem(0x0005, "Tutorial : General Info"), }, }, new DialogSequence() { Id = 3, CanMoveBack = true, CanMoveNext = true, DisplayImage = (ushort)mundane.Template.Image, Title = mundane.Template.Name, DisplayText = "engaged", }, new DialogSequence() { Id = 4, CanMoveBack = true, CanMoveNext = true, DisplayImage = (ushort)mundane.Template.Image, Title = mundane.Template.Name, DisplayText = "To attack a creature, face the creature and press the <Space Bar>. It is recommended that you use the keyboard arrow keys during combat. Be careful what you attack. Never attack mundanes, like me. You cannot harm other Aislings and they cannot harm you.", }, new DialogSequence() { Id = 5, CanMoveBack = true, CanMoveNext = true, DisplayImage = (ushort)mundane.Template.Image, Title = mundane.Template.Name, DisplayText = "To help you see creatures, press <Tab>. The creatures will appear as red on the overhead map.", }, new DialogSequence() { Id = 6, CanMoveBack = true, CanMoveNext = true, DisplayImage = (ushort)mundane.Template.Image, Title = mundane.Template.Name, DisplayText = "Initially, several creatures will be too great for you. Ask a friend which areas are safe to venture into at first.", }, new DialogSequence() { Id = 7, CanMoveBack = false, CanMoveNext = true, DisplayImage = (ushort)mundane.Template.Image, Title = mundane.Template.Name, DisplayText = "There are some small creatures here you can practice on. go and kill 5 for me using what I've taught you, Come back here once you're done for your next challenge.", IsCheckPoint = true, Conditions = new List <QuestRequirement>() { new QuestRequirement() { Type = QuestType.KillCount, Value = "Kardi", Amount = 5, } }, ContinueAt = 8, ContinueOn = 8, ConditionFailMessage = "You have not done what i have asked of you yet. Please return when you have." }, new DialogSequence() { Id = 8, CanMoveBack = false, CanMoveNext = true, DisplayImage = (ushort)mundane.Template.Image, Title = mundane.Template.Name, ContinueOn = 0x0006, ContinueAt = 9, RollBackTo = 7, HasOptions = true, DisplayText = "Great, Here you go. Now, Ready for the next challenge?", Options = new OptionsDataItem[] { new OptionsDataItem(0x0006, "Bring it On."), new OptionsDataItem(0x0007, "No I've had enough."), }, }, new DialogSequence() { Id = 9, CanMoveBack = true, CanMoveNext = true, DisplayImage = (ushort)mundane.Template.Image, Title = mundane.Template.Name, IsCheckPoint = true, DisplayText = "I'm a new reactor. I'm the next dialog.", }, new DialogSequence() { Id = 10, CanMoveBack = true, CanMoveNext = true, DisplayImage = (ushort)mundane.Template.Image, Title = mundane.Template.Name, DisplayText = "bye bye bye", }, new DialogSequence() { Id = 11, CanMoveBack = false, CanMoveNext = true, DisplayImage = (ushort)mundane.Template.Image, Title = mundane.Template.Name, DisplayText = "a", }, new DialogSequence() { Id = 12, CanMoveBack = false, CanMoveNext = true, DisplayImage = (ushort)mundane.Template.Image, Title = mundane.Template.Name, DisplayText = "b", }, }, }; Serialize(); }
public override void Start() { base.Start(); radioSpeakerName = TextManager.Get("Tutorial.Radio.Speaker"); engineer = Character.Controlled; var toolbox = engineer.Inventory.FindItemByIdentifier("toolbox"); toolbox.Unequip(engineer); engineer.Inventory.RemoveItem(toolbox); var repairOrder = Order.PrefabList.Find(order => order.AITag == "repairsystems"); engineer_repairIcon = repairOrder.SymbolSprite; engineer_repairIconColor = repairOrder.Color; var reactorOrder = Order.PrefabList.Find(order => order.AITag == "operatereactor"); engineer_reactorIcon = reactorOrder.SymbolSprite; engineer_reactorIconColor = reactorOrder.Color; // Other tutorial items tutorial_securityFinalDoorLight = Item.ItemList.Find(i => i.HasTag("tutorial_securityfinaldoorlight")).GetComponent <LightComponent>(); tutorial_mechanicFinalDoorLight = Item.ItemList.Find(i => i.HasTag("tutorial_mechanicfinaldoorlight")).GetComponent <LightComponent>(); tutorial_submarineSteering = Item.ItemList.Find(i => i.HasTag("command")).GetComponent <Steering>(); tutorial_submarineSteering.CanBeSelected = false; foreach (ItemComponent ic in tutorial_submarineSteering.Item.Components) { ic.CanBeSelected = false; } SetDoorAccess(null, tutorial_securityFinalDoorLight, false); SetDoorAccess(null, tutorial_mechanicFinalDoorLight, false); // Room 2 engineer_equipmentObjectiveSensor = Item.ItemList.Find(i => i.HasTag("engineer_equipmentobjectivesensor")).GetComponent <MotionSensor>(); engineer_equipmentCabinet = Item.ItemList.Find(i => i.HasTag("engineer_equipmentcabinet")).GetComponent <ItemContainer>(); engineer_firstDoor = Item.ItemList.Find(i => i.HasTag("engineer_firstdoor")).GetComponent <Door>(); engineer_firstDoorLight = Item.ItemList.Find(i => i.HasTag("engineer_firstdoorlight")).GetComponent <LightComponent>(); SetDoorAccess(engineer_firstDoor, engineer_firstDoorLight, false); // Room 3 engineer_reactorObjectiveSensor = Item.ItemList.Find(i => i.HasTag("engineer_reactorobjectivesensor")).GetComponent <MotionSensor>(); tutorial_oxygenGenerator = Item.ItemList.Find(i => i.HasTag("tutorial_oxygengenerator")).GetComponent <Powered>(); engineer_reactor = Item.ItemList.Find(i => i.HasTag("engineer_reactor")).GetComponent <Reactor>(); engineer_reactor.FireDelay = engineer_reactor.MeltdownDelay = float.PositiveInfinity; engineer_reactor.FuelConsumptionRate = 0.0f; engineer_reactor.OnOffSwitch.BarScroll = 1f; reactorOperatedProperly = false; engineer_secondDoor = Item.ItemList.Find(i => i.HasTag("engineer_seconddoor")).GetComponent <Door>();; engineer_secondDoorLight = Item.ItemList.Find(i => i.HasTag("engineer_seconddoorlight")).GetComponent <LightComponent>(); SetDoorAccess(engineer_secondDoor, engineer_secondDoorLight, false); // Room 4 engineer_repairJunctionBoxObjectiveSensor = Item.ItemList.Find(i => i.HasTag("engineer_repairjunctionboxobjectivesensor")).GetComponent <MotionSensor>(); engineer_brokenJunctionBox = Item.ItemList.Find(i => i.HasTag("engineer_brokenjunctionbox")); engineer_thirdDoor = Item.ItemList.Find(i => i.HasTag("engineer_thirddoor")).GetComponent <Door>(); engineer_thirdDoorLight = Item.ItemList.Find(i => i.HasTag("engineer_thirddoorlight")).GetComponent <LightComponent>(); engineer_brokenJunctionBox.Indestructible = false; engineer_brokenJunctionBox.Condition = 0f; SetDoorAccess(engineer_thirdDoor, engineer_thirdDoorLight, false); // Room 5 engineer_disconnectedJunctionBoxObjectiveSensor = Item.ItemList.Find(i => i.HasTag("engineer_disconnectedjunctionboxobjectivesensor")).GetComponent <MotionSensor>(); engineer_disconnectedJunctionBoxes = new PowerTransfer[4]; engineer_disconnectedConnectionPanels = new ConnectionPanel[4]; for (int i = 0; i < engineer_disconnectedJunctionBoxes.Length; i++) { engineer_disconnectedJunctionBoxes[i] = Item.ItemList.Find(item => item.HasTag($"engineer_disconnectedjunctionbox_{i + 1}")).GetComponent <PowerTransfer>(); engineer_disconnectedConnectionPanels[i] = engineer_disconnectedJunctionBoxes[i].Item.GetComponent <ConnectionPanel>(); engineer_disconnectedConnectionPanels[i].Locked = false; for (int j = 0; j < engineer_disconnectedJunctionBoxes[i].PowerConnections.Count; j++) { foreach (Wire wire in engineer_disconnectedJunctionBoxes[i].PowerConnections[j].Wires) { if (wire == null) { continue; } wire.Locked = true; } } } engineer_wire_1 = Item.ItemList.Find(i => i.HasTag("engineer_wire_1")); engineer_wire_2 = Item.ItemList.Find(i => i.HasTag("engineer_wire_2")); engineer_lamp_1 = Item.ItemList.Find(i => i.HasTag("engineer_lamp_1")).GetComponent <Powered>(); engineer_lamp_2 = Item.ItemList.Find(i => i.HasTag("engineer_lamp_2")).GetComponent <Powered>(); engineer_fourthDoor = Item.ItemList.Find(i => i.HasTag("engineer_fourthdoor")).GetComponent <Door>(); engineer_fourthDoorLight = Item.ItemList.Find(i => i.HasTag("engineer_fourthdoorlight")).GetComponent <LightComponent>(); SetDoorAccess(engineer_fourthDoor, engineer_fourthDoorLight, false); // Room 6 engineer_workingPump = Item.ItemList.Find(i => i.HasTag("engineer_workingpump")).GetComponent <Pump>(); engineer_workingPump.Item.CurrentHull.WaterVolume += engineer_workingPump.Item.CurrentHull.Volume; engineer_workingPump.IsActive = true; tutorial_lockedDoor_1 = Item.ItemList.Find(i => i.HasTag("tutorial_lockeddoor_1")).GetComponent <Door>(); SetDoorAccess(tutorial_lockedDoor_1, null, true); // Submarine tutorial_submarineDoor = Item.ItemList.Find(i => i.HasTag("tutorial_submarinedoor")).GetComponent <Door>(); tutorial_submarineDoorLight = Item.ItemList.Find(i => i.HasTag("tutorial_submarinedoorlight")).GetComponent <LightComponent>(); SetDoorAccess(tutorial_submarineDoor, tutorial_submarineDoorLight, true); tutorial_enteredSubmarineSensor = Item.ItemList.Find(i => i.HasTag("tutorial_enteredsubmarinesensor")).GetComponent <MotionSensor>(); engineer_submarineJunctionBox_1 = Item.ItemList.Find(i => i.HasTag("engineer_submarinejunctionbox_1")); engineer_submarineJunctionBox_2 = Item.ItemList.Find(i => i.HasTag("engineer_submarinejunctionbox_2")); engineer_submarineJunctionBox_3 = Item.ItemList.Find(i => i.HasTag("engineer_submarinejunctionbox_3")); engineer_submarineReactor = Item.ItemList.Find(i => i.HasTag("engineer_submarinereactor")).GetComponent <Reactor>(); engineer_submarineReactor.OnOffSwitch.BarScrollValue = .25f; engineer_submarineReactor.IsActive = engineer_submarineReactor.AutoTemp = false; engineer_submarineJunctionBox_1.Indestructible = false; engineer_submarineJunctionBox_1.Condition = 0f; engineer_submarineJunctionBox_2.Indestructible = false; engineer_submarineJunctionBox_2.Condition = 0f; engineer_submarineJunctionBox_3.Indestructible = false; engineer_submarineJunctionBox_3.Condition = 0f; }
public override void OnAfterDeserialize(BaseNode parent, Reactor reactor) { base.OnAfterDeserialize(parent, reactor); }
public ExampleReactor(Reactor reactor) : base(reactor) { Reactor = reactor; }
public Raghnall(GameServer server, Mundane mundane) : base(server, mundane) { reactor = new Reactor { Name = "Tutorial : Combat", CallerType = ReactorQualifer.Object, CanActAgain = false, Sequences = new List <DialogSequence> { new DialogSequence { CanMoveBack = false, CanMoveNext = true, DisplayImage = (ushort)mundane.Template.Image, DisplayText = "Hello, I'm going to teach you about combat.", Title = mundane.Template.Name }, new DialogSequence { CanMoveBack = true, CanMoveNext = true, DisplayImage = (ushort)mundane.Template.Image, Title = mundane.Template.Name, DisplayText = "First be aware that combat is dangerous. Make friends about your same level and adventure in a group." }, new DialogSequence { CanMoveBack = true, CanMoveNext = true, DisplayImage = (ushort)mundane.Template.Image, Title = mundane.Template.Name, DisplayText = "If you die, most of your magic items will be destroyed, you will lose a percentage of your experience points, and you will gain a legendary scar of Sgrios, a legend mark from the god of destruction." }, new DialogSequence { CanMoveBack = true, CanMoveNext = true, DisplayImage = (ushort)mundane.Template.Image, Title = mundane.Template.Name, DisplayText = "The current skill you have is called the Assail skill. It is a basic attack skill. Throughout the game you will learn more variety of skills that can perform different actions. To use skills just double-click their icon." }, new DialogSequence { CanMoveBack = true, CanMoveNext = true, DisplayImage = (ushort)mundane.Template.Image, Title = mundane.Template.Name, DisplayText = "To attack a creature, face the creature and press the <Space Bar>. It is recommended that you use the keyboard arrow keys during combat. Be careful what you attack. Never attack mundanes, like me. You cannot harm other Aislings and they cannot harm you." }, new DialogSequence { CanMoveBack = true, CanMoveNext = true, DisplayImage = (ushort)mundane.Template.Image, Title = mundane.Template.Name, DisplayText = "To help you see creatures, press <Tab>. The creatures will appear as red on the overhead map." }, new DialogSequence { CanMoveBack = true, CanMoveNext = true, DisplayImage = (ushort)mundane.Template.Image, Title = mundane.Template.Name, DisplayText = "Initially, several creatures will be too great for you. Ask a friend which areas are safe to venture into at first." }, new DialogSequence { CanMoveBack = false, CanMoveNext = true, DisplayImage = (ushort)mundane.Template.Image, Title = mundane.Template.Name, DisplayText = "Here is a stick if you don't already have one. it's not much but its better then nothing. Make sure to equip it.", OnSequenceStep = (cbAisling, cbSequence) => { if (cbAisling.Inventory.Has(i => i.Template.Name == "Stick") == null) { if (Item.Create(cbAisling, "Stick")?.GiveTo(cbAisling) ?? false) { } } } }, new DialogSequence { CanMoveBack = true, CanMoveNext = true, DisplayImage = (ushort)mundane.Template.Image, Title = mundane.Template.Name, DisplayText = "There are some small creatures here you can practice on. When you are ready walk up the path and you should see an Old Man. Double-Click him to learn more." } } }; }
/// <summary> /// Streams media from this file to the http response stream. /// </summary> /// <param name="context">The reactor web context</param> /// <param name="filename">The filename to stream.</param> public static void From(Reactor.Web.Context context, string filename) { //-------------------------------------------------------- // if file not found, 404 response. //-------------------------------------------------------- if (!System.IO.File.Exists(filename)) { var buffer = Reactor.Buffer.Create("file not found"); context.Response.StatusCode = 404; context.Response.ContentType = "text/plain"; context.Response.ContentLength = buffer.Length; context.Response.Write(buffer); context.Response.End(); return; } //-------------------------------------------------------- // format disposition //-------------------------------------------------------- var disposition = System.IO.Path.GetFileName(filename).Replace(",", string.Empty).Replace(";", string.Empty).Replace("\"", string.Empty) .Replace("'", string.Empty).Replace("+", string.Empty).Replace("\n", string.Empty) .Replace("\t", string.Empty).Replace("@", string.Empty).Replace("$", string.Empty) .Replace("^", string.Empty).Replace("%", string.Empty).Replace("(", string.Empty); //-------------------------------------------------------- // check for content range. //-------------------------------------------------------- var range = context.Request.Headers["Range"]; if (range == null) { var readstream = Reactor.File.ReadStream.Create(filename, FileMode.OpenOrCreate, FileShare.ReadWrite); context.Response.ContentType = Reactor.Web.Media.Mime.Lookup(filename); context.Response.ContentLength = readstream.Length; context.Response.StatusCode = 200; context.Response.AppendHeader("Content-Disposition", "inline; filename=" + disposition); context.Response.AddHeader("Cache-Control", "public"); readstream.Pipe(context.Response); return; } //----------------------------------------------- // if ranged, compute parameters. //----------------------------------------------- var info = new System.IO.FileInfo(filename); var split = range.Replace("bytes=", "").Split(new char[] { '-' }); var start = long.Parse(split[0]); var end = info.Length - 1; if (split[1] != "") { end = long.Parse(split[1]); } //--------------------------------------------- // stream ranged request //--------------------------------------------- context.Response.ContentType = Reactor.Web.Media.Mime.Lookup(filename); context.Response.ContentLength = (end - start) + 1; context.Response.StatusCode = 206; context.Response.AppendHeader("Content-Disposition", "inline; filename=" + disposition); context.Response.AddHeader("Content-Range", string.Format("bytes {0}-{1}/{2}", start, end, info.Length)); context.Response.AddHeader("Cache-Control", "public"); var streamed = Reactor.File.ReadStream.Create(filename, start, (end - start) + 1, FileMode.OpenOrCreate, FileShare.ReadWrite); streamed.Pipe(context.Response); }
public override void Start() { base.Start(); captain = Character.Controlled; radioSpeakerName = TextManager.Get("Tutorial.Radio.Watchman"); GameMain.GameSession.CrewManager.AllowCharacterSwitch = false; var revolver = FindOrGiveItem(captain, "revolver"); revolver.Unequip(captain); captain.Inventory.RemoveItem(revolver); var captainscap = captain.Inventory.FindItemByIdentifier("captainscap1") ?? captain.Inventory.FindItemByIdentifier("captainscap2") ?? captain.Inventory.FindItemByIdentifier("captainscap3"); if (captainscap != null) { captainscap.Unequip(captain); captain.Inventory.RemoveItem(captainscap); } var captainsuniform = captain.Inventory.FindItemByIdentifier("captainsuniform1") ?? captain.Inventory.FindItemByIdentifier("captainsuniform2") ?? captain.Inventory.FindItemByIdentifier("captainsuniform3"); if (captainsuniform != null) { captainsuniform.Unequip(captain); captain.Inventory.RemoveItem(captainsuniform); } var steerOrder = Order.GetPrefab("steer"); captain_steerIcon = steerOrder.SymbolSprite; captain_steerIconColor = steerOrder.Color; // Room 2 captain_equipmentObjectiveSensor = Item.ItemList.Find(i => i.HasTag("captain_equipmentobjectivesensor")).GetComponent <MotionSensor>(); captain_equipmentCabinet = Item.ItemList.Find(i => i.HasTag("captain_equipmentcabinet")).GetComponent <ItemContainer>(); captain_firstDoor = Item.ItemList.Find(i => i.HasTag("captain_firstdoor")).GetComponent <Door>(); captain_firstDoorLight = Item.ItemList.Find(i => i.HasTag("captain_firstdoorlight")).GetComponent <LightComponent>(); SetDoorAccess(captain_firstDoor, captain_firstDoorLight, true); // Room 3 captain_medicObjectiveSensor = Item.ItemList.Find(i => i.HasTag("captain_medicobjectivesensor")).GetComponent <MotionSensor>(); captain_medicSpawnPos = Item.ItemList.Find(i => i.HasTag("captain_medicspawnpos")).WorldPosition; tutorial_submarineDoor = Item.ItemList.Find(i => i.HasTag("tutorial_submarinedoor")).GetComponent <Door>(); tutorial_submarineDoorLight = Item.ItemList.Find(i => i.HasTag("tutorial_submarinedoorlight")).GetComponent <LightComponent>(); var medicInfo = new CharacterInfo(CharacterPrefab.HumanSpeciesName, "", JobPrefab.Get("medicaldoctor")); captain_medic = Character.Create(medicInfo, captain_medicSpawnPos, "medicaldoctor"); captain_medic.GiveJobItems(null); captain_medic.CanSpeak = captain_medic.AIController.Enabled = false; SetDoorAccess(tutorial_submarineDoor, tutorial_submarineDoorLight, false); // Submarine captain_enteredSubmarineSensor = Item.ItemList.Find(i => i.HasTag("captain_enteredsubmarinesensor")).GetComponent <MotionSensor>(); tutorial_submarineReactor = Item.ItemList.Find(i => i.HasTag("engineer_submarinereactor")).GetComponent <Reactor>(); captain_navConsole = Item.ItemList.Find(i => i.HasTag("command")).GetComponent <Steering>(); captain_navConsoleCustomInterface = Item.ItemList.Find(i => i.HasTag("command")).GetComponent <CustomInterface>(); captain_sonar = captain_navConsole.Item.GetComponent <Sonar>(); captain_statusMonitor = Item.ItemList.Find(i => i.HasTag("captain_statusmonitor")); tutorial_submarineReactor.CanBeSelected = false; tutorial_submarineReactor.IsActive = tutorial_submarineReactor.AutoTemp = false; tutorial_lockedDoor_1 = Item.ItemList.Find(i => i.HasTag("tutorial_lockeddoor_1")).GetComponent <Door>(); tutorial_lockedDoor_2 = Item.ItemList.Find(i => i.HasTag("tutorial_lockeddoor_2")).GetComponent <Door>(); SetDoorAccess(tutorial_lockedDoor_1, null, false); SetDoorAccess(tutorial_lockedDoor_2, null, false); var mechanicInfo = new CharacterInfo(CharacterPrefab.HumanSpeciesName, "", JobPrefab.Get("mechanic")); captain_mechanic = Character.Create(mechanicInfo, WayPoint.GetRandom(SpawnType.Human, mechanicInfo.Job, Submarine.MainSub).WorldPosition, "mechanic"); captain_mechanic.GiveJobItems(); var securityInfo = new CharacterInfo(CharacterPrefab.HumanSpeciesName, "", JobPrefab.Get("securityofficer")); captain_security = Character.Create(securityInfo, WayPoint.GetRandom(SpawnType.Human, securityInfo.Job, Submarine.MainSub).WorldPosition, "securityofficer"); captain_security.GiveJobItems(); var engineerInfo = new CharacterInfo(CharacterPrefab.HumanSpeciesName, "", JobPrefab.Get("engineer")); captain_engineer = Character.Create(engineerInfo, WayPoint.GetRandom(SpawnType.Human, engineerInfo.Job, Submarine.MainSub).WorldPosition, "engineer"); captain_engineer.GiveJobItems(); captain_mechanic.CanSpeak = captain_security.CanSpeak = captain_engineer.CanSpeak = false; captain_mechanic.AIController.Enabled = captain_security.AIController.Enabled = captain_engineer.AIController.Enabled = false; }
/// <summary> /// Registers a component using the specified options. /// </summary> /// <param name="options">The options for the component.</param> public void Register(Dictionary <string, object> options) { if (options == null) { throw new ArgumentNullException("options"); } this.Varz = new Dictionary <string, object>(); string uuid = Guid.NewGuid().ToString("N"); object type = options["type"]; object index = options.ContainsKey("index") ? options["index"] : null; if (index != null) { uuid = string.Format(CultureInfo.InvariantCulture, "{0}-{1}", index, uuid); } string host = options["host"].ToString(); int port = options.ContainsKey("statusPort") ? (int)options["statusPort"] : 0; if (port < 1) { port = NetworkInterface.GrabEphemeralPort(); } Reactor nats = (Reactor)options["nats"]; //// string[] auth = new string[] //// { //// options.ContainsKey("user") ? options["user"].ToString() : string.Empty, //// options.ContainsKey("password") ? options["password"].ToString() : string.Empty //// }; string[] auth = new string[] { Credentials.GenerateCredential(32), Credentials.GenerateCredential(32) }; // Discover message limited this.discover = new Dictionary <string, object>() { { "type", type }, { "index", index }, { "uuid", uuid }, { "host", string.Format(CultureInfo.InvariantCulture, "{0}:{1}", host, port) }, { "credentials", auth }, { "start", RubyCompatibility.DateTimeToRubyString(DateTime.Now) } }; // Varz is customizable this.Varz = new Dictionary <string, object>(); foreach (string key in this.discover.Keys) { this.Varz[key] = this.discover[key]; } this.Varz["num_cores"] = Environment.ProcessorCount; // todo: change this to a more accurate method // consider: // PerformanceCounter upTime = new PerformanceCounter("System", "System Up Time"); // upTime.NextValue(); // TimeSpan ts2 = TimeSpan.FromSeconds(upTime.NextValue()); // Console.WriteLine("{0}d {1}h {2}m {3}s", ts2.Days, ts2.Hours, ts2.Minutes, ts2.Seconds); this.Varz["system_start"] = RubyCompatibility.DateTimeToRubyString(DateTime.Now.AddMilliseconds(-Environment.TickCount)); this.CpuPerformance = new PerformanceCounter(); this.CpuPerformance.CategoryName = "Processor Information"; this.CpuPerformance.CounterName = "% Processor Time"; this.CpuPerformance.InstanceName = "_Total"; this.CpuPerformance.NextValue(); this.Healthz = "ok\n"; this.StartHttpServer(host, port, auth); // Listen for discovery requests nats.Subscribe( "vcap.component.discover", delegate(string msg, string reply, string subject) { this.UpdateDiscoverUptime(); nats.Publish(reply, null, JsonConvertibleObject.SerializeToJson(this.discover)); }); // Also announce ourselves on startup.. nats.Publish("vcap.component.announce", null, msg: JsonConvertibleObject.SerializeToJson(this.discover)); }
public void SpawnNotification(Reactor reactor) { ConsoleControllerInstance.PushNotification($"Reactor Online! {reactor.name}"); // SpawnNotification($"Reactor Online!\n{reactor.name}", string.Format("Max Fuel {0}\nDrain Rate {1}", reactor.MaxFuel, reactor.DrainRate), ThumbsUpSprite); }
internal Transport(Reactor.IDuplexable<Reactor.Buffer> duplexable) { this.duplexable = duplexable; this.duplexable.OnData += (buffer) => { //------------------------------------------------- // WEB SOCKET FRAME PARSER //------------------------------------------------- var data = buffer.ToArray(); //------------------------------------------------- // if we have any leftovers...join to data.. //------------------------------------------------- if(this.unprocessed != null) { data = ByteData.Join(this.unprocessed, data); this.unprocessed = null; } //------------------------------------------------- // read in first frame... //------------------------------------------------- try { var frame = Frame.Parse(data, true); this.AcceptFrame(frame); data = ByteData.Unshift(data, (int)frame.FrameLength); } catch { // todo: catch multiple failed exceptions... or fix Frame.Parse this.unprocessed = data; return; } //----------------------------------------------- // read in additional frames... //----------------------------------------------- while (data.Length > 0) { try { var frame = Frame.Parse(data, true); this.AcceptFrame(frame); data = ByteData.Unshift(data, (int)frame.FrameLength); } catch { // todo: catch multiple failed exceptions... or fix Frame.Parse this.unprocessed = data; return; } } }; this.duplexable.OnEnd += () => { if(this.OnClose != null) { this.OnClose(); } }; var readable = duplexable as IReadable<Reactor.Buffer>; readable.OnError += (exception) => { if(this.OnError != null) { this.OnError(exception); } }; var writeable = duplexable as IWriteable<Reactor.Buffer>; writeable.OnError += (exception) => { if (this.OnError != null) { this.OnError(exception); } }; if (this.OnOpen != null) { this.OnOpen(); } }
public override void OnClick(GameServer server, GameClient client) { var proceed = client != null && client.Aisling != null && client.Aisling.WithinRangeOf(Mundane); if (!proceed) { return; } if (client.Aisling.Path != Class.Monk) { client.SendOptionsDialog(Mundane, "We have no business together."); return; } Actor = new Reactor { CallBackScriptKey = Mundane.Template.ScriptKey, CallerType = ReactorQualifer.Reactor, ScriptKey = "Default Response Handler", CallingReactor = "Default Response Handler", Name = "Erin Part 1", Quest = new Quest { Name = Mundane.Template.QuestKey, Completed = false, ItemRewards = new List <string> { "Wolf Earrings" }, LegendRewards = new List <Legend.LegendItem> { new Legend.LegendItem { Category = "Class", Icon = (byte)LegendIcon.Monk, Color = (byte)LegendColor.Blue, Value = "Met Erin and Became Friends." } }, ExpRewards = new List <uint> { 1000, 2000, 3000, 4000, 6000 }, GoldReward = 5000, QuestStages = new List <QuestStep <Template> > { new QuestStep <Template> { Prerequisites = new List <QuestRequirement> { new QuestRequirement { Type = QuestType.ItemHandIn, Amount = 2, TemplateContext = ServerContext.GlobalItemTemplateCache["Wolf's Teeth"], Value = "Wolf's Teeth" }, new QuestRequirement { Type = QuestType.ItemHandIn, Amount = 1, TemplateContext = ServerContext.GlobalItemTemplateCache["Silver Earrings"], Value = "Silver Earrings" } } } } } }; Actor.Sequences = new List <DialogSequence> { new DialogSequence { HasOptions = false, CanMoveBack = false, CanMoveNext = true, DisplayText = "Ah... a new Monk. You have a difficult path ahead of you. You think you're going to get far with that equipment?", DisplayImage = (ushort)Mundane.Template.Image, Title = "Erin" }, new DialogSequence { HasOptions = true, CanMoveBack = true, CanMoveNext = true, DisplayImage = (ushort)Mundane.Template.Image, Title = "Erin", DisplayText = "I can help you make something a little more violent, but i will need a few things.", OnSequenceStep = (lpAisling, lpSequence) => { lpSequence.OnSequenceStep = QuestCompleted; if (lpSequence.HasOptions) { var subject = lpAisling.Quests.Find(i => i.Name == Mundane.Template.QuestKey); if (subject == null) { lpAisling.Client.SendOptionsDialog(Mundane, "Are you Interested?", new OptionsDataItem(0x002A, "Yes i need your help"), new OptionsDataItem(0x001B, "No thanks, i'll be fine") ); } else if (subject != null && !subject.Completed) { Actor.Quest.HandleQuest(lpAisling.Client, null, quest_completed_ok => { if (quest_completed_ok) { lpAisling.Client.SendOptionsDialog(Mundane, "I see you have everything. Let me get to work on this.", new OptionsDataItem(0x004A, "Put a hole here... put the silk through like so...") ); } else { lpAisling.Client.SendOptionsDialog(Mundane, "Return to me when you have the items. I need 2 pieces of Wolf's Teeth, 1 Silver Earrings, and 2 Pieces of Spider's Silk."); } }); } else if (subject != null && subject.Completed) { lpAisling.Client.SendOptionsDialog(Mundane, "Thanks again. I hope you enjoy those Wolf Earrings."); } } } } }; var lpsubject = client.Aisling.Quests.Find(i => i.Name == Mundane.Template.QuestKey); if (lpsubject != null && lpsubject.Completed) { client.SendOptionsDialog(Mundane, "Thanks again. I hope you enjoy those Wolf Earrings."); return; } Actor.Decorators = ScriptManager.Load <ReactorScript>(Actor.ScriptKey, Actor); if (Actor != null && Actor.Decorators != null) { foreach (var script in Actor.Decorators.Values) { script.OnTriggered(client.Aisling); } } }
public override void Start() { if (!Initialized) { return; } PreloadVideoContent(); Completed = true; // Trigger completed at start to prevent the contextual tutorial from automatically activating on starting new campaigns after this one base.Start(); activeSegment = null; tutorialTimer = 0.0f; degrading2ActivationCountdown = -1; subStartingPosition = Vector2.Zero; characterTimeOnSonar.Clear(); subStartingPosition = Submarine.MainSub.WorldPosition; navConsole = Item.ItemList.Find(i => i.HasTag("command"))?.GetComponent <Steering>(); sonar = navConsole?.Item.GetComponent <Sonar>(); reactor = Item.ItemList.Find(i => i.HasTag("reactor"))?.GetComponent <Reactor>(); #if DEBUG if (reactor == null || navConsole == null || sonar == null) { infoBox = CreateInfoFrame("Submarine not compatible with the tutorial:" + "\nReactor - " + (reactor != null ? "OK" : "Tag 'reactor' not found") + "\nNavigation Console - " + (navConsole != null ? "OK" : "Tag 'command' not found") + "\nSonar - " + (sonar != null ? "OK" : "Not found under Navigation Console"), true); CoroutineManager.StartCoroutine(WaitForErrorClosed()); return; } #endif if (disableTutorialOnDeficiencyFound) { if (reactor == null || navConsole == null || sonar == null) { Stop(); return; } } else { if (navConsole == null) { segments[2].IsTriggered = true; // Disable navigation console usage tutorial } if (reactor == null) { segments[5].IsTriggered = true; // Disable reactor usage tutorial } if (sonar == null) { segments[6].IsTriggered = true; // Disable enemy on sonar tutorial } } crew = GameMain.GameSession.CrewManager.GetCharacters().ToList(); started = true; }
public Network() { _protoBytes = new Dictionary <string, ByteArray>(); _reactor = new Reactor(OnConnect, OnDisconnect, OnHandleMessage); }
protected ReactorScript(Reactor reactor) { Reactor = reactor; }
public static bool StateOfReactorIsCorrect(Reactor reactor) { return(true); }
public void ShowShip(Entity entity, Entity player = null) { _enemy = player != null; _player = player; if (_schematicItems != null) { foreach (var item in _schematicItems) { item.ListElement.GetComponent <Prototype>().ReturnToPool(); } } _entity = entity; if (!_enemy) { _cockpit = entity.GetBehavior <Cockpit>(); _reactor = entity.GetBehavior <Reactor>(); _capacitors = entity.GetBehaviors <Capacitor>().ToArray(); _aetherDrive = entity.GetBehavior <AetherDrive>(); AetherDriveUi.SetActive(_aetherDrive != null); _radiators = entity.GetBehaviors <Radiator>().ToArray(); if (_radiators.Length == 0) { RadiatorTemperatureLabel.text = "N/A"; } _heatStorages = entity.GetBehaviors <HeatStorage>().ToArray(); if (_heatStorages.Length == 0) { HeatStorageTemperatureLabel.text = "N/A"; } _cargoBays = entity.CargoBays.ToArray(); if (_cargoBays.Length == 0) { CargoTemperatureLabel.text = "N/A"; } } _schematicItems = entity.Equipment .Where(x => x.Behaviors.Any(b => b.Data is WeaponData)) .Select(x => new SchematicDisplayItem { Item = x, ListElement = ListElementPrototype.Instantiate <SchematicListElement>(), Cooldown = _enemy ? null : (IProgressBehavior)x.Behaviors.FirstOrDefault(b => b is IProgressBehavior), // ItemUsage = _enemy ? null : (ItemUsage) x.Behaviors.FirstOrDefault(b=> b is ItemUsage), Weapon = (Weapon)x.Behaviors.FirstOrDefault(b => b is Weapon) }) .ToArray(); foreach (var x in _schematicItems) { if (x.Item.Data is WeaponItemData weaponItemData) { x.ListElement.ShowWeapon(weaponItemData); } //x.ListElement.Label.text = x.Item.EquippableItem.Name; if (!_enemy) { x.ListElement.InfiniteAmmoIcon.gameObject.SetActive(x.Weapon.WeaponData.AmmoType == Guid.Empty); x.ListElement.AmmoLabel.gameObject.SetActive(x.Weapon.WeaponData.AmmoType != Guid.Empty); } } }
private void InsertAssemblies(object obj) { Reactor.Insert(InsertingAssemblies); _insertAction(InsertingAssemblies); _spectGraphic.GetData(Reactor, null); }
protected Shield(Reactor source, int capacity, int energy) : base(capacity, energy) { Source = source; }
public ReactorEventArgs(Reactor reactor) { PulsingReactor = reactor; }
public static void LoadAndCacheStorage() { Paused = true; EmptyCacheCollectors(); lock (SyncObj) { LoadMaps(); LoadSkillTemplates(); LoadSpellTemplates(); LoadItemTemplates(); LoadMonsterTemplates(); LoadMundaneTemplates(); LoadWarpTemplates(); LoadWorldMapTemplates(); CacheCommunityAssets(); BindTemplates(); LoadMetaDatabase(); LoadExtensions(); } var trap = new SpellTemplate() { Animation = 91, ScriptKey = "Needle Trap", IsTrap = true, Name = "Needle Trap", TargetType = SpellTemplate.SpellUseType.NoTarget, Icon = 16, ManaCost = 20, BaseLines = 1, MaxLines = 9, MaxLevel = 100, Pane = Pane.Spells, Sound = 89, MinLines = 0, DamageExponent = 5.0, Description = "Place a Small Trap damaging enemies who walk over it.", ElementalProperty = ElementManager.Element.Light, TargetAnimation = 68, LevelRate = 0.05, TierLevel = Tier.Tier1, Prerequisites = new LearningPredicate() { Class_Required = Class.Rogue, Dex_Required = 19, Gold_Required = 1000, Int_Required = 3, Stage_Required = ClassStage.Class, ExpLevel_Required = 5 } }; var poisontrap = new SpellTemplate() { Animation = 196, ScriptKey = "Poison Trap", IsTrap = true, Name = "Poison Trap", TargetType = SpellTemplate.SpellUseType.NoTarget, Icon = 35, ManaCost = 20, BaseLines = 0, MaxLines = 9, MaxLevel = 100, Pane = Pane.Spells, Sound = 89, MinLines = 0, DamageExponent = 5.0, Description = "Place a Small Trap that will poison enemies who walk over it.", ElementalProperty = ElementManager.Element.None, TargetAnimation = 196, LevelRate = 0.15, TierLevel = Tier.Tier1, Prerequisites = new LearningPredicate() { Class_Required = Class.Rogue, Dex_Required = 10, Gold_Required = 500, Int_Required = 8, Stage_Required = ClassStage.Class, ExpLevel_Required = 5 } }; GlobalSpellTemplateCache["Poison Trap"] = poisontrap; GlobalItemTemplateCache["Apple"] = new ItemTemplate() { LevelRequired = 1, Name = "Apple", MiniScript = "user.CurrentHp += 10;", CanStack = true, MaxStack = 100, Flags = ItemFlags.Consumable | ItemFlags.Bankable | ItemFlags.Stackable | ItemFlags.Sellable | ItemFlags.Tradeable | ItemFlags.QuestRelated | ItemFlags.Dropable, DropRate = 0.95, CarryWeight = 0, Image = 0x8028, DisplayImage = 0x8028, }; var spider = new MonsterTemplate() { Name = "Spider", ScriptName = "Common Monster", AreaID = 426, Level = 1, BaseName = "Spider", AttackSpeed = 1000, MovementSpeed = 1000, CastSpeed = 10000, DefenseElement = ElementManager.Element.None, OffenseElement = ElementManager.Element.None, Description = "Small creature that dwells in dark places, such as crypts. Not very Aggressive, Unless Attacked.", ElementType = ElementQualifer.None, IgnoreCollision = false, LootType = LootQualifer.Table, ImageVarience = 0, Image = 0x4035, UpdateMapWide = false, MoodType = MoodQualifer.Neutral, SpawnType = SpawnQualifer.Random, PathQualifer = PathQualifer.Wander, SpawnRate = 12, SpawnSize = 26, SpawnMax = 200, FamilyKey = "Insect", Grow = false, Drops = new System.Collections.ObjectModel.Collection <string>() { "Spiders's Eye" }, }; var item = new ItemTemplate() { Name = "Spider's Eye", Flags = ItemFlags.Bankable | ItemFlags.Dropable | ItemFlags.Tradeable | ItemFlags.QuestRelated | ItemFlags.Sellable | ItemFlags.Stackable, CanStack = true, MaxStack = 20, Value = 300, CarryWeight = 1, DropRate = 80, Image = 0x814F, LevelRequired = 1, Description = "These can be found by killing spiders down in the mileth crypt.", }; var rawberyl = new ItemTemplate() { Name = "Raw Beryl", Flags = ItemFlags.Bankable | ItemFlags.Dropable | ItemFlags.Tradeable | ItemFlags.QuestRelated | ItemFlags.Sellable | ItemFlags.Stackable, CanStack = true, MaxStack = 20, Value = 300, CarryWeight = 1, DropRate = 40, Image = 0x80E8, DisplayImage = 0x80E8, LevelRequired = 1, Description = "A beryl that is used for upgrading.", }; var rawcoral = new ItemTemplate() { Name = "Raw Coral", Flags = ItemFlags.Bankable | ItemFlags.Dropable | ItemFlags.Tradeable | ItemFlags.QuestRelated | ItemFlags.Sellable | ItemFlags.Stackable, CanStack = true, MaxStack = 20, Value = 300, CarryWeight = 1, DropRate = 20, Image = 0x80E9, DisplayImage = 0x80E9, LevelRequired = 1, Description = "A coral fragment that is used for upgrading.", }; var rawruby = new ItemTemplate() { Name = "Raw Ruby", Flags = ItemFlags.Bankable | ItemFlags.Dropable | ItemFlags.Tradeable | ItemFlags.QuestRelated | ItemFlags.Sellable | ItemFlags.Stackable, CanStack = true, MaxStack = 20, Value = 300, CarryWeight = 1, DropRate = 10, Image = 0x80EA, DisplayImage = 0x80EA, LevelRequired = 1, Description = "A ruby fragment that is used for upgrading.", }; var forsakenjewel = new ItemTemplate() { Name = "Forsaken Jewel", Flags = ItemFlags.Bankable | ItemFlags.Dropable | ItemFlags.Tradeable | ItemFlags.QuestRelated | ItemFlags.Sellable | ItemFlags.Stackable, CanStack = true, MaxStack = 20, Value = 300000000, CarryWeight = 1, DropRate = 1, Image = 0x8385, DisplayImage = 0x8385, LevelRequired = 1, Description = "Used to upgrade a weapon.", }; GlobalItemTemplateCache["Raw Ruby"] = rawruby; GlobalItemTemplateCache["Raw Coral"] = rawcoral; GlobalItemTemplateCache["Raw Beryl"] = rawberyl; GlobalItemTemplateCache["Forsaken Jewel"] = forsakenjewel; //StorageManager.ItemBucket.Save(item); //StorageManager.MonsterBucket.Save(spider); var stab = new SkillTemplate() { Name = "Stab", ScriptName = "Stab", Cooldown = 5, Description = "Stab an target, dealing heavy damage. and weaken the target.", Icon = 5, FailMessage = "You failed to stab.", LevelRate = 0.3, MaxLevel = 100, TierLevel = Tier.Tier1, MissAnimation = 68, TargetAnimation = 70, Pane = Pane.Skills, NpcKey = "Bullop", PostQualifers = PostQualifer.BreakInvisible | PostQualifer.IgnoreDefense, Sound = 31, Type = SkillScope.Ability, ID = 77, Prerequisites = new LearningPredicate() { Class_Required = Class.Rogue, Dex_Required = 15, ExpLevel_Required = 9, Gold_Required = 15000, Int_Required = 8, Wis_Required = 5, Str_Required = 6, Items_Required = new List <ItemPredicate>() { new ItemPredicate() { AmountRequired = 3, Item = "Raw Beryl", }, new ItemPredicate() { Item = "Raw Ruby", AmountRequired = 1, }, } }, }; GlobalSkillTemplateCache["Stab"] = stab; var trap2 = new SpellTemplate() { Animation = 91, ScriptKey = "Stiletto Trap", IsTrap = true, Name = "Stiletto Trap", TargetType = SpellTemplate.SpellUseType.NoTarget, Icon = 52, ManaCost = 20, BaseLines = 1, MaxLines = 9, MaxLevel = 100, Pane = Pane.Spells, Sound = 60, MinLines = 0, DamageExponent = 5.0, Description = "Place a medium Trap damaging enemies who walk over it.", ElementalProperty = ElementManager.Element.Light, TargetAnimation = 394, LevelRate = 0.05, TierLevel = Tier.Tier1, Prerequisites = new LearningPredicate() { Class_Required = Class.Rogue, Dex_Required = 6, Gold_Required = 5000, Int_Required = 8, Stage_Required = ClassStage.Class, ExpLevel_Required = 9, Items_Required = new List <ItemPredicate>() { new ItemPredicate() { Item = "Snow Secret", AmountRequired = 1, } } } }; GlobalSpellTemplateCache["Needle Trap"] = trap; GlobalSpellTemplateCache["Stiletto Trap"] = trap2; GlobalReactorCache["tut_reactor_1"] = new Reactor() { CallerType = ReactorQualifer.Map, Description = "test description", Name = "tut_reactor_1", Location = new Position(40, 21), MapId = 101, ScriptKey = "example reactor", QuestReward = new Quest() { ExpRewards = new List <uint>() { 500 }, GoldReward = 500, LegendRewards = new List <Legend.LegendItem>() { new Legend.LegendItem() { Category = Convert.ToString(LegendIcon.Wizard), Color = (byte)LegendColor.White, Icon = (byte)LegendIcon.Heart, Value = "Witnessed the Magical Tree.", } }, }, Steps = new List <DialogSequence>() { new DialogSequence() { Title = "Oi", DisplayText = "This tree does not belong here. you can see it's out of place. It was stolen.", DisplayImage = 0x4004, CanMoveBack = false, CanMoveNext = true, }, new DialogSequence() { Title = "Oi", DisplayText = "I found it here, We've all been looking for it. I must go report this. If i don't make it. Please visit East Woodlands and travel north.", DisplayImage = 0x4004, CanMoveBack = false, CanMoveNext = true, }, new DialogSequence() { Title = "Oi", DisplayText = "Oh yeah, Take this. \n\nRemember!, If i don't make it back - Visit my family in East Woodlands.", DisplayImage = 0x4004, CanMoveBack = false, CanMoveNext = true, }, } }; Paused = false; }
internal CentralHeavyLaserCannon(Reactor source, ZoneLocation currentZone) : base(source, 5, currentZone) { }
public Client(Reactor reactor, Int32 index) { this.index = index; this.reactor = reactor; sn = new ClientNetwork(reactor); }
public void StopParticle(Reactor onBuilding) { ReactorsWithParticles.Remove(onBuilding); }
public override void Configure(Reactor reactor, GameObject context) { //switch context for children to new gameObject. base.Configure(reactor, target); }
public DefaultReactor(Reactor reactor) : base(reactor) { Reactor = reactor; }
public override IEnumerable <object> UpdateState() { //spawn some fish next to the player GameMain.GameScreen.BackgroundCreatureManager.SpawnSprites(2, Submarine.MainSub.Position + Character.Controlled.Position); foreach (Item item in Item.ItemList) { var wire = item.GetComponent <Wire>(); if (wire != null && wire.Connections.Any(c => c != null)) { wire.Locked = true; } } yield return(new WaitForSeconds(4.0f)); infoBox = CreateInfoFrame("Use WASD to move and the mouse to look around"); yield return(new WaitForSeconds(5.0f)); //----------------------------------- infoBox = CreateInfoFrame("Open the door at your right side by highlighting the button next to it with your cursor and pressing E"); Door tutorialDoor = Item.ItemList.Find(i => i.HasTag("tutorialdoor")).GetComponent <Door>(); while (!tutorialDoor.IsOpen && Character.Controlled.WorldPosition.X < tutorialDoor.Item.WorldPosition.X) { yield return(CoroutineStatus.Running); } yield return(new WaitForSeconds(2.0f)); //----------------------------------- infoBox = CreateInfoFrame("Hold W or S to walk up or down stairs. Use shift to run.", true); while (infoBox != null) { yield return(CoroutineStatus.Running); } //----------------------------------- infoBox = CreateInfoFrame("At the moment the submarine has no power, which means that crucial systems such as the oxygen generator or the engine aren't running. Let's fix this: go to the upper left corner of the submarine, where you'll find a nuclear reactor."); Reactor reactor = Item.ItemList.Find(i => i.HasTag("tutorialreactor")).GetComponent <Reactor>(); reactor.MeltDownTemp = 20000.0f; while (Vector2.Distance(Character.Controlled.Position, reactor.Item.Position) > 200.0f) { yield return(CoroutineStatus.Running); } infoBox = CreateInfoFrame("The reactor requires fuel rods to generate power. You can grab one from the steel cabinet by walking next to it and pressing E."); while (Character.Controlled.SelectedConstruction == null || Character.Controlled.SelectedConstruction.Name != "Steel Cabinet") { yield return(CoroutineStatus.Running); } infoBox = CreateInfoFrame("Pick up one of the fuel rods either by double-clicking or dragging and dropping it into your inventory."); while (!HasItem("Fuel Rod")) { yield return(CoroutineStatus.Running); } infoBox = CreateInfoFrame("Select the reactor by walking next to it and pressing E."); while (Character.Controlled.SelectedConstruction != reactor.Item) { yield return(CoroutineStatus.Running); } yield return(new WaitForSeconds(0.5f)); infoBox = CreateInfoFrame("Load the fuel rod into the reactor by dropping it into any of the 5 slots."); while (reactor.AvailableFuel <= 0.0f) { yield return(CoroutineStatus.Running); } infoBox = CreateInfoFrame("The reactor is now fueled up. Try turning it on by increasing the fission rate."); while (reactor.FissionRate <= 0.0f) { yield return(CoroutineStatus.Running); } yield return(new WaitForSeconds(0.5f)); infoBox = CreateInfoFrame("The reactor core has started generating heat, which in turn generates power for the submarine. The power generation is very low at the moment," + " because the reactor is set to shut itself down when the temperature rises above 500 degrees Celsius. You can adjust the temperature limit by changing the \"Shutdown Temperature\" in the control panel.", true); while (infoBox != null) { reactor.ShutDownTemp = Math.Min(reactor.ShutDownTemp, 5000.0f); yield return(CoroutineStatus.Running); } yield return(new WaitForSeconds(0.5f)); infoBox = CreateInfoFrame("The amount of power generated by the reactor should be kept close to the amount of power consumed by the devices in the submarine. " + "If there isn't enough power, devices won't function properly (or at all), and if there's too much power, some devices may be damaged." + " Try to raise the temperature of the reactor close to 3000 degrees by adjusting the fission and cooling rates.", true); while (Math.Abs(reactor.Temperature - 3000.0f) > 100.0f) { reactor.AutoTemp = false; reactor.ShutDownTemp = Math.Min(reactor.ShutDownTemp, 5000.0f); yield return(CoroutineStatus.Running); } yield return(new WaitForSeconds(0.5f)); infoBox = CreateInfoFrame("Looks like we're up and running! Now you should turn on the \"Automatic temperature control\", which will make the reactor " + "automatically adjust the temperature to a suitable level. Even though it's an easy way to keep the reactor up and running most of the time, " + "you should keep in mind that it changes the temperature very slowly and carefully, which may cause issues if there are sudden changes in grid load."); while (!reactor.AutoTemp) { yield return(CoroutineStatus.Running); } yield return(new WaitForSeconds(0.5f)); infoBox = CreateInfoFrame("That's the basics of operating the reactor! Now that there's power available for the engines, it's time to get the submarine moving. " + "Deselect the reactor by pressing E and head to the command room at the right edge of the vessel."); Steering steering = Item.ItemList.Find(i => i.HasTag("tutorialsteering")).GetComponent <Steering>(); Radar radar = steering.Item.GetComponent <Radar>(); while (Vector2.Distance(Character.Controlled.Position, steering.Item.Position) > 150.0f) { yield return(CoroutineStatus.Running); } CoroutineManager.StartCoroutine(KeepReactorRunning(reactor)); infoBox = CreateInfoFrame("Select the navigation terminal by walking next to it and pressing E."); while (Character.Controlled.SelectedConstruction != steering.Item) { yield return(CoroutineStatus.Running); } yield return(new WaitForSeconds(0.5f)); infoBox = CreateInfoFrame("There seems to be something wrong with the navigation terminal." + " There's nothing on the monitor, so it's probably out of power. The reactor must still be" + " running or the lights would've gone out, so it's most likely a problem with the wiring." + " Deselect the terminal by pressing E to start checking the wiring."); while (Character.Controlled.SelectedConstruction == steering.Item) { yield return(CoroutineStatus.Running); } yield return(new WaitForSeconds(1.0f)); infoBox = CreateInfoFrame("You need a screwdriver to check the wiring of the terminal." + " Equip a screwdriver by pulling it to either of the slots with a hand symbol, and then use it on the terminal by left clicking."); while (Character.Controlled.SelectedConstruction != steering.Item || Character.Controlled.SelectedItems.FirstOrDefault(i => i != null && i.Name == "Screwdriver") == null) { yield return(CoroutineStatus.Running); } infoBox = CreateInfoFrame("Here you can see all the wires connected to the terminal. Apparently there's no wire" + " going into the to the power connection - that's why the monitor isn't working." + " You should find a piece of wire to connect it. Try searching some of the cabinets scattered around the sub."); while (!HasItem("Wire")) { yield return(CoroutineStatus.Running); } infoBox = CreateInfoFrame("Head back to the navigation terminal to fix the wiring."); PowerTransfer junctionBox = Item.ItemList.Find(i => i != null && i.HasTag("tutorialjunctionbox")).GetComponent <PowerTransfer>(); while ((Character.Controlled.SelectedConstruction != junctionBox.Item && Character.Controlled.SelectedConstruction != steering.Item) || Character.Controlled.SelectedItems.FirstOrDefault(i => i != null && i.Name == "Screwdriver") == null) { yield return(CoroutineStatus.Running); } if (Character.Controlled.SelectedItems.FirstOrDefault(i => i != null && i.GetComponent <Wire>() != null) == null) { infoBox = CreateInfoFrame("Equip the wire by dragging it to one of the slots with a hand symbol."); while (Character.Controlled.SelectedItems.FirstOrDefault(i => i != null && i.GetComponent <Wire>() != null) == null) { yield return(CoroutineStatus.Running); } } infoBox = CreateInfoFrame("You can see the equipped wire at the middle of the connection panel. Drag it to the power connector."); var steeringConnection = steering.Item.Connections.Find(c => c.Name.Contains("power")); while (steeringConnection.Wires.FirstOrDefault(w => w != null) == null) { yield return(CoroutineStatus.Running); } infoBox = CreateInfoFrame("Now you have to connect the other end of the wire to a power source. " + "The junction box in the room just below the command room should do."); while (Character.Controlled.SelectedConstruction != null) { yield return(CoroutineStatus.Running); } yield return(new WaitForSeconds(2.0f)); infoBox = CreateInfoFrame("You can now move the other end of the wire around, and attach it on the wall by left clicking or " + "remove the previous attachment by right clicking. Or if you don't care for neatly laid out wiring, you can just " + "run it straight to the junction box."); while (Character.Controlled.SelectedConstruction == null || Character.Controlled.SelectedConstruction.GetComponent <PowerTransfer>() == null) { yield return(CoroutineStatus.Running); } infoBox = CreateInfoFrame("Connect the wire to the junction box by pulling it to the power connection, the same way you did with the navigation terminal."); while (radar.Voltage < 0.1f) { yield return(CoroutineStatus.Running); } infoBox = CreateInfoFrame("Great! Now we should be able to get moving."); while (Character.Controlled.SelectedConstruction != steering.Item) { yield return(CoroutineStatus.Running); } infoBox = CreateInfoFrame("You can take a look at the area around the sub by selecting the \"Sonar\" checkbox."); while (!radar.IsActive) { yield return(CoroutineStatus.Running); } yield return(new WaitForSeconds(0.5f)); infoBox = CreateInfoFrame("The green rectangle in the middle is the submarine, and the flickering shapes outside it are the walls of an underwater cavern. " + "Try moving the submarine by clicking somewhere on the monitor and dragging the pointer to the direction you want to go to."); while (steering.TargetVelocity == Vector2.Zero && steering.TargetVelocity.Length() < 50.0f) { yield return(CoroutineStatus.Running); } yield return(new WaitForSeconds(4.0f)); infoBox = CreateInfoFrame("The submarine moves up and down by pumping water in and out of the two ballast tanks at the bottom of the submarine. " + "The engine at the back of the sub moves it forwards and backwards.", true); while (infoBox != null) { yield return(CoroutineStatus.Running); } infoBox = CreateInfoFrame("Steer the submarine downwards, heading further into the cavern."); while (Submarine.MainSub.WorldPosition.Y > 40000.0f) { yield return(CoroutineStatus.Running); } yield return(new WaitForSeconds(1.0f)); var moloch = Character.Create( "Content/Characters/Moloch/moloch.xml", steering.Item.WorldPosition + new Vector2(3000.0f, -500.0f)); moloch.PlaySound(CharacterSound.SoundType.Attack); yield return(new WaitForSeconds(1.0f)); infoBox = CreateInfoFrame("Uh-oh... Something enormous just appeared on the radar."); List <Structure> windows = new List <Structure>(); foreach (Structure s in Structure.WallList) { if (s.CastShadow || !s.HasBody) { continue; } if (s.Rect.Right > steering.Item.CurrentHull.Rect.Right) { windows.Add(s); } } float slowdownTimer = 1.0f; bool broken = false; do { steering.TargetVelocity = Vector2.Zero; slowdownTimer = Math.Max(0.0f, slowdownTimer - CoroutineManager.DeltaTime * 0.3f); Submarine.MainSub.Velocity *= slowdownTimer; moloch.AIController.SelectTarget(steering.Item.CurrentHull.AiTarget); Vector2 steeringDir = windows[0].WorldPosition - moloch.WorldPosition; if (steeringDir != Vector2.Zero) { steeringDir = Vector2.Normalize(steeringDir); } moloch.AIController.SteeringManager.SteeringManual(CoroutineManager.DeltaTime, steeringDir * 100.0f); foreach (Structure window in windows) { for (int i = 0; i < window.SectionCount; i++) { if (!window.SectionIsLeaking(i)) { continue; } broken = true; break; } if (broken) { break; } } if (broken) { break; } yield return(CoroutineStatus.Running); } while (!broken); //fix everything except the command windows foreach (Structure w in Structure.WallList) { bool isWindow = windows.Contains(w); for (int i = 0; i < w.SectionCount; i++) { if (!w.SectionIsLeaking(i)) { continue; } if (isWindow) { //decrease window damage to slow down the leaking w.AddDamage(i, -w.SectionDamage(i) * 0.48f); } else { w.AddDamage(i, -100000.0f); } } } Submarine.MainSub.GodMode = true; var capacitor1 = Item.ItemList.Find(i => i.HasTag("capacitor1")).GetComponent <PowerContainer>(); var capacitor2 = Item.ItemList.Find(i => i.HasTag("capacitor1")).GetComponent <PowerContainer>(); CoroutineManager.StartCoroutine(KeepEnemyAway(moloch, new PowerContainer[] { capacitor1, capacitor2 })); infoBox = CreateInfoFrame("The hull has been breached! Close all the doors to the command room to stop the water from flooding the entire sub!"); Door commandDoor1 = Item.ItemList.Find(i => i.HasTag("commanddoor1")).GetComponent <Door>(); Door commandDoor2 = Item.ItemList.Find(i => i.HasTag("commanddoor2")).GetComponent <Door>(); Door commandDoor3 = Item.ItemList.Find(i => i.HasTag("commanddoor3")).GetComponent <Door>(); //wait until the player is out of the room and the doors are closed while (Character.Controlled.WorldPosition.X > commandDoor1.Item.WorldPosition.X || (commandDoor1.IsOpen || (commandDoor2.IsOpen || commandDoor3.IsOpen))) { //prevent the hull from filling up completely and crushing the player steering.Item.CurrentHull.Volume = Math.Min(steering.Item.CurrentHull.Volume, steering.Item.CurrentHull.FullVolume * 0.9f); yield return(CoroutineStatus.Running); } infoBox = CreateInfoFrame("You should quickly find yourself a diving mask or a diving suit. " + "There are some in the room next to the airlock."); bool divingMaskSelected = false; while (!HasItem("Diving Mask") && !HasItem("Diving Suit")) { if (!divingMaskSelected && Character.Controlled.FocusedItem != null && Character.Controlled.FocusedItem.Name == "Diving Suit") { infoBox = CreateInfoFrame("There can only be one item in each inventory slot, so you need to take off " + "the jumpsuit if you wish to wear a diving suit."); divingMaskSelected = true; } yield return(CoroutineStatus.Running); } if (HasItem("Diving Mask")) { infoBox = CreateInfoFrame("The diving mask will let you breathe underwater, but it won't protect from the water pressure outside the sub. " + "It should be fine for the situation at hand, but you still need to find an oxygen tank and drag it into the same slot as the mask." + "You should grab one or two from one of the cabinets."); } else if (HasItem("Diving Suit")) { infoBox = CreateInfoFrame("In addition to letting you breathe underwater, the suit will protect you from the water pressure outside the sub " + "(unlike the diving mask). However, you still need to drag an oxygen tank into the same slot as the suit to supply oxygen. " + "You should grab one or two from one of the cabinets."); } while (!HasItem("Oxygen Tank")) { yield return(CoroutineStatus.Running); } yield return(new WaitForSeconds(5.0f)); infoBox = CreateInfoFrame("Now you should stop the creature attacking the submarine before it does any more damage. Head to the railgun room at the upper right corner of the sub."); var railGun = Item.ItemList.Find(i => i.GetComponent <Turret>() != null); while (Vector2.Distance(Character.Controlled.Position, railGun.Position) > 500) { yield return(new WaitForSeconds(1.0f)); } infoBox = CreateInfoFrame("The railgun requires a large power surge to fire. The reactor can't provide a surge large enough, so we need to use the " + " supercapacitors in the railgun room. The capacitors need to be charged first; select them and crank up the recharge rate."); while (capacitor1.RechargeSpeed < 0.5f && capacitor2.RechargeSpeed < 0.5f) { yield return(new WaitForSeconds(1.0f)); } infoBox = CreateInfoFrame("The capacitors take some time to recharge, so now is a good " + "time to head to the room below and load some shells for the railgun."); var loader = Item.ItemList.Find(i => i.Name == "Railgun Loader").GetComponent <ItemContainer>(); while (Math.Abs(Character.Controlled.Position.Y - loader.Item.Position.Y) > 80) { yield return(CoroutineStatus.Running); } infoBox = CreateInfoFrame("Grab one of the shells. You can load it by selecting the railgun loader and dragging the shell to. " + "one of the free slots. You need two hands to carry a shell, so make sure you don't have anything else in either hand."); while (loader.Item.ContainedItems.FirstOrDefault(i => i != null && i.Name == "Railgun Shell") == null) { moloch.Health = 50.0f; capacitor1.Charge += 5.0f; capacitor2.Charge += 5.0f; yield return(CoroutineStatus.Running); } infoBox = CreateInfoFrame("Now we're ready to shoot! Select the railgun controller."); while (Character.Controlled.SelectedConstruction == null || Character.Controlled.SelectedConstruction.Name != "Railgun Controller") { yield return(CoroutineStatus.Running); } moloch.AnimController.SetPosition(ConvertUnits.ToSimUnits(Character.Controlled.WorldPosition + Vector2.UnitY * 600.0f)); infoBox = CreateInfoFrame("Use the right mouse button to aim and wait for the creature to come closer. When you're ready to shoot, " + "press the left mouse button."); while (!moloch.IsDead) { if (moloch.WorldPosition.Y > Character.Controlled.WorldPosition.Y + 600.0f) { moloch.AIController.SteeringManager.SteeringManual(CoroutineManager.DeltaTime, Character.Controlled.WorldPosition - moloch.WorldPosition); } moloch.AIController.SelectTarget(Character.Controlled.AiTarget); yield return(CoroutineStatus.Running); } Submarine.MainSub.GodMode = false; infoBox = CreateInfoFrame("The creature has died. Now you should fix the damages in the control room: " + "Grab a welding tool from the closet in the railgun room."); while (!HasItem("Welding Tool")) { yield return(CoroutineStatus.Running); } infoBox = CreateInfoFrame("The welding tool requires fuel to work. Grab a welding fuel tank and attach it to the tool " + "by dragging it into the same slot."); do { var weldingTool = Character.Controlled.Inventory.Items.FirstOrDefault(i => i != null && i.Name == "Welding Tool"); if (weldingTool != null && weldingTool.ContainedItems.FirstOrDefault(contained => contained != null && contained.Name == "Welding Fuel Tank") != null) { break; } yield return(CoroutineStatus.Running); } while (true); infoBox = CreateInfoFrame("You can aim with the tool using the right mouse button and weld using the left button. " + "Head to the command room to fix the leaks there."); do { broken = false; foreach (Structure window in windows) { for (int i = 0; i < window.SectionCount; i++) { if (!window.SectionIsLeaking(i)) { continue; } broken = true; break; } if (broken) { break; } } yield return(new WaitForSeconds(1.0f)); } while (broken); infoBox = CreateInfoFrame("The hull is fixed now, but there's still quite a bit of water inside the sub. It should be pumped out " + "using the bilge pump in the room at the bottom of the submarine."); Pump pump = Item.ItemList.Find(i => i.HasTag("tutorialpump")).GetComponent <Pump>(); while (Vector2.Distance(Character.Controlled.Position, pump.Item.Position) > 100.0f) { yield return(CoroutineStatus.Running); } infoBox = CreateInfoFrame("The two pumps inside the ballast tanks " + "are connected straight to the navigation terminal and can't be manually controlled unless you mess with their wiring, " + "so you should only use the pump in the middle room to pump out the water. Select it, turn it on and adjust the pumping speed " + "to start pumping water out.", true); while (infoBox != null) { yield return(CoroutineStatus.Running); } bool brokenMsgShown = false; Item brokenBox = null; while (pump.FlowPercentage > 0.0f || pump.CurrFlow <= 0.0f || !pump.IsActive) { if (!brokenMsgShown && pump.Voltage < pump.MinVoltage && Character.Controlled.SelectedConstruction == pump.Item) { brokenMsgShown = true; infoBox = CreateInfoFrame("Looks like the pump isn't getting any power. The water must have short-circuited some of the junction " + "boxes. You can check which boxes are broken by selecting them."); while (true) { if (Character.Controlled.SelectedConstruction != null && Character.Controlled.SelectedConstruction.GetComponent <PowerTransfer>() != null && Character.Controlled.SelectedConstruction.Condition == 0.0f) { brokenBox = Character.Controlled.SelectedConstruction; infoBox = CreateInfoFrame("Here's our problem: this junction box is broken. Luckily engineers are adept at fixing electrical devices - " + "you just need to find a spare wire and click the \"Fix\"-button to repair the box."); break; } if (pump.Voltage > pump.MinVoltage) { break; } yield return(CoroutineStatus.Running); } } if (brokenBox != null && brokenBox.Condition > 50.0f && pump.Voltage < pump.MinVoltage) { yield return(new WaitForSeconds(1.0f)); if (pump.Voltage < pump.MinVoltage) { infoBox = CreateInfoFrame("The pump is still not running. Check if there are more broken junction boxes between the pump and the reactor."); } brokenBox = null; } yield return(CoroutineStatus.Running); } infoBox = CreateInfoFrame("The pump is up and running. Wait for the water to be drained out."); while (pump.Item.CurrentHull.Volume > 1000.0f) { yield return(CoroutineStatus.Running); } infoBox = CreateInfoFrame("That was all there is to this tutorial! Now you should be able to handle " + "most of the basic tasks on board the submarine."); yield return(new WaitForSeconds(4.0f)); Character.Controlled = null; GameMain.GameScreen.Cam.TargetPos = Vector2.Zero; GameMain.LightManager.LosEnabled = false; var cinematic = new TransitionCinematic(Submarine.MainSub, GameMain.GameScreen.Cam, 5.0f); while (cinematic.Running) { yield return(CoroutineStatus.Running); } Submarine.Unload(); GameMain.MainMenuScreen.Select(); yield return(CoroutineStatus.Success); }
public static Transport Create(Reactor.IDuplexable<Reactor.Buffer> duplexable) { return new Transport(duplexable); }
public virtual void Configure(Reactor reactor, GameObject context) { this.Reactor = reactor; this.gameObject = context; }
private void ParseResponseHeader(Reactor.Buffer buffer) { var data = buffer.ToString("utf8"); string [] split = data.Split(new string [] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries); try { var http = split[0]; var s1 = http.Split(new char[] { ' ' }); this.StatusCode = int.Parse(s1[1]); for(var i = 1; i < split.Length; i++) { var s2 = split[i].Split(new char[] { ':' }); this.Headers[s2[0]] = s2[1]; } } catch { } }
public void StartSweatParticle(Reactor onBuilding) { StartCoroutine(RunParticles(onBuilding, (Particle par) => { par.SetSweatParticle(); })); ReactorsWithParticles.Add(onBuilding); }
private void ParseResponseBody(Reactor.Buffer buffer) { try { //--------------------------------------------- // checking the body of the response. The goal // here is to extract any frames passed on the // request from the server, as is the case with // socket.io. //--------------------------------------------- var data = buffer.ToString("utf8"); if (data.Contains("\r\n")) { var split = data.Split(new string[] { "\r\n\r\n" }, StringSplitOptions.RemoveEmptyEntries); if (split.Length == 2) { var bytes = buffer.ToArray(); //--------------------------------------------- // scan for frames //--------------------------------------------- var framedatalist = new List<List<byte>>(); List<byte> framedata = null; foreach (var b in bytes) { if (b == 0x81) { framedata = new List<byte>(); framedatalist.Add(framedata); } if (framedata != null) { framedata.Add(b); } } //--------------------------------------------- // add frame to frame list. //--------------------------------------------- foreach (var item in framedatalist) { var frame = Reactor.Web.Socket.Protocol.Frame.Parse(item.ToArray(), true); this.Frames.Add(frame); } } } } catch { } }
public void StartSteamParticle(Reactor onBuilding) { StartCoroutine(RunParticles(onBuilding, (Particle par) => { par.SetSteamParticle(); })); }
public static TcpHeader Create(Reactor.Divert.Parsers.IpHeader header) { return new TcpHeader(header.Data); }
public ReactorScript(Reactor reactor) { Reactor = reactor; }