public override void Start() { base.Start(); radioSpeakerName = TextManager.Get("Tutorial.Radio.Speaker"); mechanic = Character.Controlled; var toolbelt = FindOrGiveItem(mechanic, "toolbelt"); toolbelt.Unequip(mechanic); mechanic.Inventory.RemoveItem(toolbelt); var crowbar = FindOrGiveItem(mechanic, "crowbar"); crowbar.Unequip(mechanic); mechanic.Inventory.RemoveItem(crowbar); var repairOrder = Order.GetPrefab("repairsystems"); mechanic_repairIcon = repairOrder.SymbolSprite; mechanic_repairIconColor = repairOrder.Color; mechanic_weldIcon = new Sprite("Content/UI/MainIconsAtlas.png", new Rectangle(1, 256, 127, 127), new Vector2(0.5f, 0.5f)); // Other tutorial items tutorial_securityFinalDoorLight = Item.ItemList.Find(i => i.HasTag("tutorial_securityfinaldoorlight")).GetComponent <LightComponent>(); tutorial_upperFinalDoor = Item.ItemList.Find(i => i.HasTag("tutorial_upperfinaldoor")).GetComponent <Door>(); 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(tutorial_upperFinalDoor, null, false); // Room 1 mechanic_firstDoor = Item.ItemList.Find(i => i.HasTag("mechanic_firstdoor")).GetComponent <Door>(); mechanic_firstDoorLight = Item.ItemList.Find(i => i.HasTag("mechanic_firstdoorlight")).GetComponent <LightComponent>(); SetDoorAccess(mechanic_firstDoor, mechanic_firstDoorLight, false); // Room 2 mechanic_equipmentObjectiveSensor = Item.ItemList.Find(i => i.HasTag("mechanic_equipmentobjectivesensor")).GetComponent <MotionSensor>(); mechanic_equipmentCabinet = Item.ItemList.Find(i => i.HasTag("mechanic_equipmentcabinet")).GetComponent <ItemContainer>(); mechanic_secondDoor = Item.ItemList.Find(i => i.HasTag("mechanic_seconddoor")).GetComponent <Door>(); mechanic_secondDoorLight = Item.ItemList.Find(i => i.HasTag("mechanic_seconddoorlight")).GetComponent <LightComponent>(); SetDoorAccess(mechanic_secondDoor, mechanic_secondDoorLight, false); // Room 3 mechanic_weldingObjectiveSensor = Item.ItemList.Find(i => i.HasTag("mechanic_weldingobjectivesensor")).GetComponent <MotionSensor>(); mechanic_workingPump = Item.ItemList.Find(i => i.HasTag("mechanic_workingpump")).GetComponent <Pump>(); mechanic_thirdDoor = Item.ItemList.Find(i => i.HasTag("mechanic_thirddoor")).GetComponent <Door>(); mechanic_thirdDoorLight = Item.ItemList.Find(i => i.HasTag("mechanic_thirddoorlight")).GetComponent <LightComponent>(); mechanic_brokenWall_1 = Structure.WallList.Find(i => i.SpecialTag == "mechanic_brokenwall_1"); //mechanic_ladderSensor = Item.ItemList.Find(i => i.HasTag("mechanic_laddersensor")).GetComponent<MotionSensor>(); SetDoorAccess(mechanic_thirdDoor, mechanic_thirdDoorLight, false); mechanic_brokenWall_1.Indestructible = false; mechanic_brokenWall_1.SpriteColor = Color.White; for (int i = 0; i < mechanic_brokenWall_1.SectionCount; i++) { mechanic_brokenWall_1.AddDamage(i, 85); } mechanic_brokenhull_1 = mechanic_brokenWall_1.Sections[0].gap.FlowTargetHull; // Room 4 mechanic_craftingObjectiveSensor = Item.ItemList.Find(i => i.HasTag("mechanic_craftingobjectivesensor")).GetComponent <MotionSensor>(); mechanic_deconstructor = Item.ItemList.Find(i => i.HasTag("mechanic_deconstructor")).GetComponent <Deconstructor>(); mechanic_fabricator = Item.ItemList.Find(i => i.HasTag("mechanic_fabricator")).GetComponent <Fabricator>(); mechanic_craftingCabinet = Item.ItemList.Find(i => i.HasTag("mechanic_craftingcabinet")).GetComponent <ItemContainer>(); mechanic_fourthDoor = Item.ItemList.Find(i => i.HasTag("mechanic_fourthdoor")).GetComponent <Door>(); mechanic_fourthDoorLight = Item.ItemList.Find(i => i.HasTag("mechanic_fourthdoorlight")).GetComponent <LightComponent>(); SetDoorAccess(mechanic_fourthDoor, mechanic_fourthDoorLight, false); // Room 5 mechanic_fifthDoor = Item.ItemList.Find(i => i.HasTag("mechanic_fifthdoor")).GetComponent <Door>(); mechanic_fifthDoorLight = Item.ItemList.Find(i => i.HasTag("mechanic_fifthdoorlight")).GetComponent <LightComponent>(); mechanic_fireSensor = Item.ItemList.Find(i => i.HasTag("mechanic_firesensor")).GetComponent <MotionSensor>(); SetDoorAccess(mechanic_fifthDoor, mechanic_fifthDoorLight, false); // Room 6 mechanic_divingSuitObjectiveSensor = Item.ItemList.Find(i => i.HasTag("mechanic_divingsuitobjectivesensor")).GetComponent <MotionSensor>(); mechanic_divingSuitContainer = Item.ItemList.Find(i => i.HasTag("mechanic_divingsuitcontainer")).GetComponent <ItemContainer>(); for (int i = 0; i < mechanic_divingSuitContainer.Inventory.Items.Length; i++) { foreach (ItemComponent ic in mechanic_divingSuitContainer.Inventory.Items[i].Components) { ic.CanBePicked = true; } } mechanic_oxygenContainer = Item.ItemList.Find(i => i.HasTag("mechanic_oxygencontainer")).GetComponent <ItemContainer>(); for (int i = 0; i < mechanic_oxygenContainer.Inventory.Items.Length; i++) { foreach (ItemComponent ic in mechanic_oxygenContainer.Inventory.Items[i].Components) { ic.CanBePicked = true; } } tutorial_mechanicFinalDoor = Item.ItemList.Find(i => i.HasTag("tutorial_mechanicfinaldoor")).GetComponent <Door>(); tutorial_mechanicFinalDoorLight = Item.ItemList.Find(i => i.HasTag("tutorial_mechanicfinaldoorlight")).GetComponent <LightComponent>(); SetDoorAccess(tutorial_mechanicFinalDoor, tutorial_mechanicFinalDoorLight, false); // Room 7 mechanic_brokenPump = Item.ItemList.Find(i => i.HasTag("mechanic_brokenpump")).GetComponent <Pump>(); mechanic_brokenPump.Item.Indestructible = false; mechanic_brokenPump.Item.Condition = 0; mechanic_brokenPump.CanBeSelected = false; mechanic_brokenPump.Item.GetComponent <Repairable>().CanBeSelected = false; mechanic_brokenWall_2 = Structure.WallList.Find(i => i.SpecialTag == "mechanic_brokenwall_2"); tutorial_submarineDoor = Item.ItemList.Find(i => i.HasTag("tutorial_submarinedoor")).GetComponent <Door>(); tutorial_submarineDoorLight = Item.ItemList.Find(i => i.HasTag("tutorial_submarinedoorlight")).GetComponent <LightComponent>(); mechanic_brokenWall_2.Indestructible = false; mechanic_brokenWall_2.SpriteColor = Color.White; for (int i = 0; i < mechanic_brokenWall_2.SectionCount; i++) { mechanic_brokenWall_2.AddDamage(i, 85); } mechanic_brokenhull_2 = mechanic_brokenWall_2.Sections[0].gap.FlowTargetHull; SetDoorAccess(tutorial_submarineDoor, tutorial_submarineDoorLight, false); // Submarine tutorial_enteredSubmarineSensor = Item.ItemList.Find(i => i.HasTag("tutorial_enteredsubmarinesensor")).GetComponent <MotionSensor>(); mechanic_submarineEngine = Item.ItemList.Find(i => i.HasTag("mechanic_submarineengine")).GetComponent <Engine>(); mechanic_submarineEngine.Item.Indestructible = false; mechanic_submarineEngine.Item.Condition = 0f; mechanic_ballastPump_1 = Item.ItemList.Find(i => i.HasTag("mechanic_ballastpump_1")).GetComponent <Pump>(); mechanic_ballastPump_1.Item.Indestructible = false; mechanic_ballastPump_1.Item.Condition = 0f; mechanic_ballastPump_2 = Item.ItemList.Find(i => i.HasTag("mechanic_ballastpump_2")).GetComponent <Pump>(); mechanic_ballastPump_2.Item.Indestructible = false; mechanic_ballastPump_2.Item.Condition = 0f; }
private FunctionElement Deconstruct() { return(Deconstructor.Deconstruct(this.Value)); }
public bool TryGetTcpEndpoint(out IPAddress ipAddress, out ushort port, bool nameResolving = false) { ipAddress = IPAddress.None; port = 0; var rootFunction = Deconstructor.Deconstruct(this.Value); if (rootFunction == null) { return(false); } if (rootFunction.Name == "tcp") { if (!(rootFunction.Arguments.Count == 2 && rootFunction.Arguments[0] is FunctionElement hostFunction && rootFunction.Arguments[1] is ConstantElement portConstant)) { return(false); } if (hostFunction.Name == "ip4") { if (!(hostFunction.Arguments.Count == 1 && hostFunction.Arguments[0] is ConstantElement ipAddressConstant)) { return(false); } if (!IPAddress.TryParse(ipAddressConstant.Text, out var temp) || temp.AddressFamily != AddressFamily.InterNetwork) { return(false); } ipAddress = temp; } else if (hostFunction.Name == "ip6") { if (!(hostFunction.Arguments.Count == 1 && hostFunction.Arguments[0] is ConstantElement ipAddressConstant)) { return(false); } if (!IPAddress.TryParse(ipAddressConstant.Text, out var temp) || temp.AddressFamily != AddressFamily.InterNetworkV6) { return(false); } ipAddress = temp; } else if (nameResolving && hostFunction.Name == "dns") { if (!(hostFunction.Arguments.Count == 1 && hostFunction.Arguments[0] is ConstantElement hostnameConstant)) { return(false); } try { var hostEntry = Dns.GetHostEntry(hostnameConstant.Text); if (hostEntry.AddressList.Length == 0) { return(false); } ipAddress = hostEntry.AddressList[0]; } catch (Exception e) { _logger.Error(e); return(false); } } else { return(false); } if (!ushort.TryParse(portConstant.Text, out port)) { return(false); } } return(true); }
public static void SolveDeconstruction(int number) { var solver = new Deconstructor($"problems/full/FD{number:D3}_src.mdl"); solver.Solve($"output/full/FD{number:D3}.nbt"); }
public static void DeconstructExtension(this Deconstructor obj, out int age, out int mass) { age = obj.Age; mass = obj.Mass; }