public GameObject CreatePrefab() { int num = 1; int height = 1; string id = "PropLadder"; string name = STRINGS.BUILDINGS.PREFABS.PROPLADDER.NAME; string desc = STRINGS.BUILDINGS.PREFABS.PROPLADDER.DESC; float mass = 50f; int width = num; GameObject gameObject = EntityTemplates.CreatePlacedEntity(id, name, desc, mass, Assets.GetAnim("ladder_poi_kanim"), "off", Grid.SceneLayer.Building, width, height, TUNING.BUILDINGS.DECOR.BONUS.TIER0, NOISE_POLLUTION.NOISY.TIER0, SimHashes.Creature, null, 293f); PrimaryElement component = gameObject.GetComponent <PrimaryElement>(); component.SetElement(SimHashes.Polypropylene); component.Temperature = 294.15f; Ladder ladder = gameObject.AddOrGet <Ladder>(); ladder.upwardsMovementSpeedMultiplier = 1.5f; ladder.downwardsMovementSpeedMultiplier = 1.5f; gameObject.AddOrGet <AnimTileable>(); OccupyArea obj = gameObject.AddOrGet <OccupyArea>(); Object.DestroyImmediate(obj); obj = gameObject.AddOrGet <OccupyArea>(); obj.OccupiedCellsOffsets = EntityTemplates.GenerateOffsets(num, height); obj.objectLayers = new ObjectLayer[1] { ObjectLayer.Building }; return(gameObject); }
public GameObject CreatePrefab() { GameObject gameObject = EntityTemplates.CreatePlacedEntity("Geyser", STRINGS.CREATURES.SPECIES.GEYSER.NAME, STRINGS.CREATURES.SPECIES.GEYSER.DESC, 2000f, Assets.GetAnim("geyser_side_steam_kanim"), "inactive", Grid.SceneLayer.BuildingBack, 4, 2, TUNING.BUILDINGS.DECOR.BONUS.TIER1, NOISE_POLLUTION.NOISY.TIER6, SimHashes.Creature, null, 293f); gameObject.GetComponent <KPrefabID>().AddTag(GameTags.DeprecatedContent, false); PrimaryElement component = gameObject.GetComponent <PrimaryElement>(); component.SetElement(SimHashes.IgneousRock); component.Temperature = 372.15f; Geyser geyser = gameObject.AddOrGet <Geyser>(); geyser.outputOffset = new Vector2I(0, 1); GeyserConfigurator geyserConfigurator = gameObject.AddOrGet <GeyserConfigurator>(); geyserConfigurator.presetType = "steam"; geyserConfigurator.presetMin = 0.5f; geyserConfigurator.presetMax = 0.75f; Studyable studyable = gameObject.AddOrGet <Studyable>(); studyable.meterTrackerSymbol = "geotracker_target"; studyable.meterAnim = "tracker"; gameObject.AddOrGet <LoopingSounds>(); SoundEventVolumeCache.instance.AddVolume("geyser_side_steam_kanim", "Geyser_shake_LP", NOISE_POLLUTION.NOISY.TIER5); SoundEventVolumeCache.instance.AddVolume("geyser_side_steam_kanim", "Geyser_erupt_LP", NOISE_POLLUTION.NOISY.TIER6); return(gameObject); }
public GameObject CreatePrefab() { GameObject gameObject = EntityTemplates.CreatePlacedEntity("SetLocker", STRINGS.BUILDINGS.PREFABS.SETLOCKER.NAME, STRINGS.BUILDINGS.PREFABS.SETLOCKER.DESC, 100f, Assets.GetAnim("setpiece_locker_kanim"), "on", Grid.SceneLayer.Building, 1, 2, TUNING.BUILDINGS.DECOR.BONUS.TIER0, NOISE_POLLUTION.NOISY.TIER0, SimHashes.Creature, null, 293f); PrimaryElement component = gameObject.GetComponent <PrimaryElement>(); component.SetElement(SimHashes.Unobtanium); component.Temperature = 294.15f; Workable workable = gameObject.AddOrGet <Workable>(); workable.synchronizeAnims = false; workable.resetProgressOnStop = true; SetLocker setLocker = gameObject.AddOrGet <SetLocker>(); setLocker.overrideAnim = "anim_interacts_clothingfactory_kanim"; setLocker.dropOffset = new Vector2I(0, 1); setLocker.possible_contents_ids = new string[3] { "Warm_Vest", "Cool_Vest", "Funky_Vest" }; gameObject.AddOrGet <LoreBearer>(); OccupyArea occupyArea = gameObject.AddOrGet <OccupyArea>(); occupyArea.objectLayers = new ObjectLayer[1] { ObjectLayer.Building }; return(gameObject); }
public GameObject CreateGeyser(string id, string anim, int width, int height, string name, string desc, HashedString presetType) { float mass = 2000f; GameObject gameObject = EntityTemplates.CreatePlacedEntity(id, name, desc, mass, Assets.GetAnim(anim), "inactive", Grid.SceneLayer.BuildingBack, width, height, BUILDINGS.DECOR.BONUS.TIER1, NOISE_POLLUTION.NOISY.TIER6, SimHashes.Creature, null, 293f); gameObject.AddOrGet <OccupyArea>().objectLayers = new ObjectLayer[1] { ObjectLayer.Building }; PrimaryElement component = gameObject.GetComponent <PrimaryElement>(); component.SetElement(SimHashes.Katairite); component.Temperature = 372.15f; gameObject.AddOrGet <Prioritizable>(); gameObject.AddOrGet <Uncoverable>(); Geyser geyser = gameObject.AddOrGet <Geyser>(); geyser.outputOffset = new Vector2I(0, 1); GeyserConfigurator geyserConfigurator = gameObject.AddOrGet <GeyserConfigurator>(); geyserConfigurator.presetType = presetType; Studyable studyable = gameObject.AddOrGet <Studyable>(); studyable.meterTrackerSymbol = "geotracker_target"; studyable.meterAnim = "tracker"; gameObject.AddOrGet <LoopingSounds>(); SoundEventVolumeCache.instance.AddVolume("geyser_side_steam_kanim", "Geyser_shake_LP", NOISE_POLLUTION.NOISY.TIER5); SoundEventVolumeCache.instance.AddVolume("geyser_side_steam_kanim", "Geyser_erupt_LP", NOISE_POLLUTION.NOISY.TIER6); return(gameObject); }
public GameObject CreatePrefab() { GameObject gameObject = EntityTemplates.CreatePlacedEntity("GeneShuffler", STRINGS.BUILDINGS.PREFABS.GENESHUFFLER.NAME, STRINGS.BUILDINGS.PREFABS.GENESHUFFLER.DESC, 2000f, Assets.GetAnim("geneshuffler_kanim"), "on", Grid.SceneLayer.Building, 4, 3, TUNING.BUILDINGS.DECOR.BONUS.TIER0, NOISE_POLLUTION.NOISY.TIER0, SimHashes.Creature, null, 293f); gameObject.AddTag(GameTags.NotRoomAssignable); PrimaryElement component = gameObject.GetComponent <PrimaryElement>(); component.SetElement(SimHashes.Unobtanium); component.Temperature = 294.15f; gameObject.AddOrGet <Operational>(); gameObject.AddOrGet <Notifier>(); gameObject.AddOrGet <GeneShuffler>(); gameObject.AddOrGet <LoreBearer>(); gameObject.AddOrGet <LoopingSounds>(); gameObject.AddOrGet <Ownable>(); gameObject.AddOrGet <Prioritizable>(); Storage storage = gameObject.AddOrGet <Storage>(); storage.dropOnLoad = true; ManualDeliveryKG manualDeliveryKG = gameObject.AddOrGet <ManualDeliveryKG>(); manualDeliveryKG.SetStorage(storage); manualDeliveryKG.choreTypeIDHash = Db.Get().ChoreTypes.MachineFetch.IdHash; manualDeliveryKG.requestedItemTag = new Tag("GeneShufflerRecharge"); manualDeliveryKG.refillMass = 1f; manualDeliveryKG.minimumMass = 1f; manualDeliveryKG.capacity = 1f; KBatchedAnimController kBatchedAnimController = gameObject.AddOrGet <KBatchedAnimController>(); kBatchedAnimController.sceneLayer = Grid.SceneLayer.BuildingBack; kBatchedAnimController.fgLayer = Grid.SceneLayer.BuildingFront; return(gameObject); }
public override void DoPostConfigureComplete(GameObject go) { go.AddOrGet <Storage>().capacityKg = 0.09999999f; go.AddOrGet <MassiveHeatSink>(); go.AddOrGet <MinimumOperatingTemperature>().minimumTemperature = 120f; PrimaryElement component = go.GetComponent <PrimaryElement>(); component.SetElement(SimHashes.Iron); component.Temperature = 294.15f; ConduitConsumer conduitConsumer = go.AddOrGet <ConduitConsumer>(); conduitConsumer.conduitType = ConduitType.Gas; conduitConsumer.consumptionRate = 1f; conduitConsumer.capacityTag = GameTagExtensions.Create(SimHashes.Hydrogen); conduitConsumer.capacityKG = 0.09999999f; conduitConsumer.forceAlwaysSatisfied = true; conduitConsumer.wrongElementResult = ConduitConsumer.WrongElementResult.Dump; go.AddOrGet <ElementConverter>().consumedElements = new ElementConverter.ConsumedElement[1] { new ElementConverter.ConsumedElement(ElementLoader.FindElementByHash(SimHashes.Hydrogen).tag, 0.01f) }; ElementConverter elementConverter = go.AddOrGet <ElementConverter>(); elementConverter.outputElements = new ElementConverter.OutputElement[] { }; GeneratedBuildings.RegisterLogicPorts(go, BriskArcticConfig.INPUT_PORTS); go.AddOrGet <LogicOperationalController>(); go.AddOrGetDef <PoweredActiveController.Def>(); }
public GameObject CreatePrefab() { GameObject placedEntity = EntityTemplates.CreatePlacedEntity( id: Id, name: Name, desc: Description, mass: 2000f, anim: Assets.GetAnim("ironpile_kanim"), initialAnim: "idle", Grid.SceneLayer.BuildingBack, width: 3, height: 2, decor: DECOR.BONUS.TIER1, defaultTemperature: DefaultTemperature); placedEntity.GetComponent <OccupyArea>().objectLayers = new ObjectLayer[1] { ObjectLayer.Building }; PrimaryElement component = placedEntity.GetComponent <PrimaryElement>(); component.SetElement(SimHashes.SedimentaryRock); component.Temperature = 372.15f; placedEntity.AddOrGet <BuildingAttachPoint>().points = new BuildingAttachPoint.HardPoint[1] { new BuildingAttachPoint.HardPoint(new CellOffset(0, 0), Id.ToTag(), null) }; SoundEventVolumeCache.instance.AddVolume("geyser_side_methane_kanim", "GeyserMethane_shake_LP", NOISE_POLLUTION.NOISY.TIER5); SoundEventVolumeCache.instance.AddVolume("geyser_side_methane_kanim", "GeyserMethane_erupt_LP", NOISE_POLLUTION.NOISY.TIER6); return(placedEntity); }
public override void DoPostConfigureComplete(GameObject go) { go.GetComponent <KPrefabID>().AddTag(RoomConstraints.ConstraintTags.IndustrialMachinery); go.AddOrGet <MassiveHeatSink>(); go.AddOrGet <MinimumOperatingTemperature>().minimumTemperature = 1f; PrimaryElement component = go.GetComponent <PrimaryElement>(); component.SetElement(SimHashes.Iron); component.Temperature = 294.15f; go.AddOrGet <LoopingSounds>(); go.AddOrGet <Storage>().capacityKg = 9.99999999f; ConduitConsumer conduitConsumer = go.AddOrGet <ConduitConsumer>(); conduitConsumer.conduitType = ConduitType.Liquid; conduitConsumer.consumptionRate = 10f; conduitConsumer.capacityTag = GameTagExtensions.Create(SimHashes.Mercury); conduitConsumer.capacityKG = 9.99999999f; conduitConsumer.forceAlwaysSatisfied = true; conduitConsumer.wrongElementResult = ConduitConsumer.WrongElementResult.Dump; go.AddOrGet <ElementConverter>().consumedElements = new ElementConverter.ConsumedElement[1] { new ElementConverter.ConsumedElement(ElementLoader.FindElementByHash(SimHashes.Mercury).tag, 1.0f) }; go.AddOrGetDef <PoweredActiveController.Def>(); }
public GameObject CreatePrefab() { GameObject gameObject = EntityTemplates.CreatePlacedEntity("PropTable", STRINGS.BUILDINGS.PREFABS.PROPTABLE.NAME, STRINGS.BUILDINGS.PREFABS.PROPTABLE.DESC, 50f, Assets.GetAnim("table_breakroom_kanim"), "off", Grid.SceneLayer.Building, 3, 1, TUNING.BUILDINGS.DECOR.BONUS.TIER0, NOISE_POLLUTION.NOISY.TIER0, SimHashes.Creature, null, 293f); PrimaryElement component = gameObject.GetComponent <PrimaryElement>(); component.SetElement(SimHashes.Unobtanium); component.Temperature = 294.15f; return(gameObject); }
public GameObject CreatePrefab() { GameObject gameObject = EntityTemplates.CreatePlacedEntity("PropTallPlant", STRINGS.BUILDINGS.PREFABS.PROPFACILITYTALLPLANT.NAME, STRINGS.BUILDINGS.PREFABS.PROPFACILITYTALLPLANT.DESC, 50f, Assets.GetAnim("gravitas_tall_plant_kanim"), "off", Grid.SceneLayer.Building, 1, 3, TUNING.BUILDINGS.DECOR.BONUS.TIER0, NOISE_POLLUTION.NOISY.TIER0, SimHashes.Creature, null, 293f); PrimaryElement component = gameObject.GetComponent <PrimaryElement>(); component.SetElement(SimHashes.Polypropylene); component.Temperature = 294.15f; return(gameObject); }
public GameObject CreatePrefab() { GameObject gameObject = EntityTemplates.CreatePlacedEntity("PropSurfaceSatellite2", STRINGS.BUILDINGS.PREFABS.PROPSURFACESATELLITE2.NAME, STRINGS.BUILDINGS.PREFABS.PROPSURFACESATELLITE2.DESC, 50f, Assets.GetAnim("satellite2_kanim"), "off", Grid.SceneLayer.Building, 4, 4, TUNING.BUILDINGS.DECOR.BONUS.TIER0, NOISE_POLLUTION.NOISY.TIER0, SimHashes.Creature, null, 293f); PrimaryElement component = gameObject.GetComponent <PrimaryElement>(); component.SetElement(SimHashes.Unobtanium); component.Temperature = 294.15f; return(gameObject); }
public GameObject CreatePrefab() { GameObject gameObject = EntityTemplates.CreatePlacedEntity("PropSkeleton", STRINGS.BUILDINGS.PREFABS.PROPSKELETON.NAME, STRINGS.BUILDINGS.PREFABS.PROPSKELETON.DESC, 50f, Assets.GetAnim("skeleton_poi_kanim"), "off", Grid.SceneLayer.Building, 1, 2, TUNING.BUILDINGS.DECOR.BONUS.TIER5, NOISE_POLLUTION.NOISY.TIER0, SimHashes.Creature, null, 293f); PrimaryElement component = gameObject.GetComponent <PrimaryElement>(); component.SetElement(SimHashes.Creature); component.Temperature = 294.15f; return(gameObject); }
public GameObject CreatePrefab() { GameObject gameObject = EntityTemplates.CreatePlacedEntity("PropElevator", STRINGS.BUILDINGS.PREFABS.PROPELEVATOR.NAME, STRINGS.BUILDINGS.PREFABS.PROPELEVATOR.DESC, 50f, Assets.GetAnim("gravitas_elevator_kanim"), "off", Grid.SceneLayer.Building, 2, 3, TUNING.BUILDINGS.DECOR.BONUS.TIER0, NOISE_POLLUTION.NOISY.TIER0, SimHashes.Creature, null, 293f); PrimaryElement component = gameObject.GetComponent <PrimaryElement>(); component.SetElement(SimHashes.Steel); component.Temperature = 294.15f; return(gameObject); }
public GameObject CreatePrefab() { GameObject gameObject = EntityTemplates.CreatePlacedEntity("PropFacilityCouch", STRINGS.BUILDINGS.PREFABS.PROPFACILITYCOUCH.NAME, STRINGS.BUILDINGS.PREFABS.PROPFACILITYCOUCH.DESC, 50f, Assets.GetAnim("gravitas_couch_kanim"), "off", Grid.SceneLayer.Building, 4, 2, TUNING.BUILDINGS.DECOR.BONUS.TIER0, NOISE_POLLUTION.NOISY.TIER0, SimHashes.Creature, null, 293f); PrimaryElement component = gameObject.GetComponent <PrimaryElement>(); component.SetElement(SimHashes.Granite); component.Temperature = 294.15f; return(gameObject); }
public GameObject CreatePrefab() { GameObject gameObject = EntityTemplates.CreatePlacedEntity("PropFacilityDisplay", STRINGS.BUILDINGS.PREFABS.PROPFACILITYDISPLAY1.NAME, STRINGS.BUILDINGS.PREFABS.PROPFACILITYDISPLAY1.DESC, 50f, Assets.GetAnim("gravitas_display1_kanim"), "off", Grid.SceneLayer.Building, 2, 3, TUNING.BUILDINGS.DECOR.BONUS.TIER0, NOISE_POLLUTION.NOISY.TIER0, SimHashes.Creature, null, 293f); PrimaryElement component = gameObject.GetComponent <PrimaryElement>(); component.SetElement(SimHashes.Steel); component.Temperature = 294.15f; gameObject.AddOrGet <LoreBearer>(); return(gameObject); }
public GameObject CreatePrefab() { GameObject gameObject = EntityTemplates.CreatePlacedEntity("PropLight", STRINGS.BUILDINGS.PREFABS.PROPLIGHT.NAME, STRINGS.BUILDINGS.PREFABS.PROPLIGHT.DESC, 50f, Assets.GetAnim("setpiece_light_kanim"), "off", Grid.SceneLayer.Building, 1, 1, TUNING.BUILDINGS.DECOR.BONUS.TIER0, NOISE_POLLUTION.NOISY.TIER0, SimHashes.Creature, null, 293f); PrimaryElement component = gameObject.GetComponent <PrimaryElement>(); component.SetElement(SimHashes.Steel); component.Temperature = 294.15f; OccupyArea occupyArea = gameObject.AddOrGet <OccupyArea>(); occupyArea.objectLayers = new ObjectLayer[1] { ObjectLayer.Building }; return(gameObject); }
public static GameObject CreateOreEntity(SimHashes elementID, CollisionShape shape, float width, float height, List <Tag> additionalTags = null, float default_temperature = 293f) { Element element = ElementLoader.FindElementByHash(elementID); GameObject gameObject = Object.Instantiate(baseOreTemplate); gameObject.name = element.name; Object.DontDestroyOnLoad(gameObject); KPrefabID kPrefabID = gameObject.AddOrGet <KPrefabID>(); kPrefabID.PrefabTag = element.tag; if (additionalTags != null) { foreach (Tag additionalTag in additionalTags) { kPrefabID.AddTag(additionalTag, false); } } if (element.lowTemp < 296.15f && element.highTemp > 296.15f) { kPrefabID.AddTag(GameTags.PedestalDisplayable, false); } PrimaryElement primaryElement = gameObject.AddOrGet <PrimaryElement>(); primaryElement.SetElement(elementID); primaryElement.Mass = 1f; primaryElement.Temperature = default_temperature; Pickupable pickupable = gameObject.AddOrGet <Pickupable>(); pickupable.SetWorkTime(5f); pickupable.sortOrder = element.buildMenuSort; KSelectable kSelectable = gameObject.AddOrGet <KSelectable>(); kSelectable.SetName(element.name); KBatchedAnimController kBatchedAnimController = gameObject.AddOrGet <KBatchedAnimController>(); kBatchedAnimController.AnimFiles = new KAnimFile[1] { element.substance.anim }; kBatchedAnimController.sceneLayer = Grid.SceneLayer.Front; kBatchedAnimController.initialAnim = "idle1"; kBatchedAnimController.isMovable = true; return(AddCollision(gameObject, shape, width, height)); }
public GameObject CreatePrefab() { GameObject gameObject = EntityTemplates.CreateEntity(ID, UI.SPACEDESTINATIONS.COMETS.ROCKCOMET.NAME, true); gameObject.AddOrGet <SaveLoadRoot>(); gameObject.AddOrGet <LoopingSounds>(); Comet comet = gameObject.AddOrGet <Comet>(); float mass = ElementLoader.FindElementByHash(SimHashes.Regolith).defaultValues.mass; comet.massRange = new Vector2(mass * 0.8f * 6f, mass * 1.2f * 6f); comet.temperatureRange = new Vector2(323.15f, 423.15f); comet.addTiles = 6; comet.addTilesMinHeight = 2; comet.addTilesMaxHeight = 8; comet.entityDamage = 20; comet.totalTileDamage = 0f; comet.splashRadius = 1; comet.impactSound = "Meteor_Large_Impact"; comet.flyingSoundID = 2; comet.explosionEffectHash = SpawnFXHashes.MeteorImpactDirt; PrimaryElement primaryElement = gameObject.AddOrGet <PrimaryElement>(); primaryElement.SetElement(SimHashes.Regolith); primaryElement.Temperature = (comet.temperatureRange.x + comet.temperatureRange.y) / 2f; KBatchedAnimController kBatchedAnimController = gameObject.AddOrGet <KBatchedAnimController>(); kBatchedAnimController.AnimFiles = new KAnimFile[1] { Assets.GetAnim("meteor_rock_kanim") }; kBatchedAnimController.isMovable = true; kBatchedAnimController.initialAnim = "fall_loop"; kBatchedAnimController.initialMode = KAnim.PlayMode.Loop; KCircleCollider2D kCircleCollider2D = gameObject.AddOrGet <KCircleCollider2D>(); kCircleCollider2D.radius = 0.5f; return(gameObject); }
public override void ConfigureBuildingTemplate(GameObject go, Tag prefab_tag) { Door door = go.AddOrGet <Door>(); door.hasComplexUserControls = false; door.unpoweredAnimSpeed = 1f; door.doorType = Door.DoorType.ManualPressure; go.AddOrGet <ZoneTile>(); go.AddOrGet <AccessControl>(); go.AddOrGet <Unsealable>(); go.AddOrGet <KBoxCollider2D>(); Prioritizable.AddRef(go); Workable workable = go.AddOrGet <Workable>(); workable.workTime = 5f; KBatchedAnimController kBatchedAnimController = go.AddOrGet <KBatchedAnimController>(); kBatchedAnimController.fgLayer = Grid.SceneLayer.BuildingFront; PrimaryElement component = go.GetComponent <PrimaryElement>(); component.SetElement(SimHashes.Steel); component.Temperature = 273f; }
public GameObject CreatePrefab() { GameObject gameObject = EntityTemplates.CreatePlacedEntity("OilWell", STRINGS.CREATURES.SPECIES.OIL_WELL.NAME, STRINGS.CREATURES.SPECIES.OIL_WELL.DESC, 2000f, Assets.GetAnim("geyser_side_oil_kanim"), "off", Grid.SceneLayer.BuildingBack, 4, 2, TUNING.BUILDINGS.DECOR.BONUS.TIER1, NOISE_POLLUTION.NOISY.TIER5, SimHashes.Creature, null, 293f); OccupyArea component = gameObject.GetComponent <OccupyArea>(); component.objectLayers = new ObjectLayer[1] { ObjectLayer.Building }; PrimaryElement component2 = gameObject.GetComponent <PrimaryElement>(); component2.SetElement(SimHashes.SedimentaryRock); component2.Temperature = 372.15f; BuildingAttachPoint buildingAttachPoint = gameObject.AddOrGet <BuildingAttachPoint>(); buildingAttachPoint.points = new BuildingAttachPoint.HardPoint[1] { new BuildingAttachPoint.HardPoint(new CellOffset(0, 0), GameTags.OilWell, null) }; SoundEventVolumeCache.instance.AddVolume("geyser_side_methane_kanim", "GeyserMethane_shake_LP", NOISE_POLLUTION.NOISY.TIER5); SoundEventVolumeCache.instance.AddVolume("geyser_side_methane_kanim", "GeyserMethane_erupt_LP", NOISE_POLLUTION.NOISY.TIER6); return(gameObject); }
public GameObject CreatePrefab() { GameObject gameObject = EntityTemplates.CreateEntity(ID, UI.SPACEDESTINATIONS.COMETS.GOLDCOMET.NAME, true); gameObject.AddOrGet <SaveLoadRoot>(); gameObject.AddOrGet <LoopingSounds>(); Comet comet = gameObject.AddOrGet <Comet>(); comet.massRange = new Vector2(3f, 20f); comet.temperatureRange = new Vector2(323.15f, 423.15f); comet.explosionOreCount = new Vector2I(2, 4); comet.entityDamage = 15; comet.totalTileDamage = 0.5f; comet.splashRadius = 1; comet.impactSound = "Meteor_Medium_Impact"; comet.flyingSoundID = 1; comet.explosionEffectHash = SpawnFXHashes.MeteorImpactMetal; PrimaryElement primaryElement = gameObject.AddOrGet <PrimaryElement>(); primaryElement.SetElement(SimHashes.GoldAmalgam); primaryElement.Temperature = (comet.temperatureRange.x + comet.temperatureRange.y) / 2f; KBatchedAnimController kBatchedAnimController = gameObject.AddOrGet <KBatchedAnimController>(); kBatchedAnimController.AnimFiles = new KAnimFile[1] { Assets.GetAnim("meteor_gold_kanim") }; kBatchedAnimController.isMovable = true; kBatchedAnimController.initialAnim = "fall_loop"; kBatchedAnimController.initialMode = KAnim.PlayMode.Loop; kBatchedAnimController.visibilityType = KAnimControllerBase.VisibilityType.OffscreenUpdate; KCircleCollider2D kCircleCollider2D = gameObject.AddOrGet <KCircleCollider2D>(); kCircleCollider2D.radius = 0.5f; gameObject.transform.localScale = new Vector3(0.6f, 0.6f, 1f); return(gameObject); }
private PrimaryElement FindSuitableElement() { PrimaryElement ret = null; // Maybe make it buffer an extra message, that might help? // better version: grab stuff from our ass, I mean network - BR int x, y; Grid.CellToXY(Grid.PosToCell(this), out x, out y); JObject message = Z.net.get_message_for("got_packet", x, y); if (outstanding && message != null) { outstanding = false; // We have a response from the server, finally ya lazy basterd if (message["packet"] != null && message["packet"].Type == JTokenType.Object) { JObject mat_packet = (JObject)message["packet"]; JObject germ_packet = null; if (mat_packet["germs"] != null && mat_packet["germs"].Type == JTokenType.Object) { germ_packet = (JObject)mat_packet["germs"]; } if (dave == null) { dave = GasSourceManager.Instance.CreateChunk( (SimHashes)(-1528777920), 0f, 456f, 255, 0, this.transform.GetPosition()); steve = dave.GetComponent <PrimaryElement>(); steve.KeepZeroMassObject = true; } steve.SetElement((SimHashes)((int)mat_packet["element"])); steve.SetMassTemperature((float)mat_packet["mass"], (float)mat_packet["temperature"]); string reason = conduitType == ConduitType.Liquid ? "Storage.AddLiquid" : "Storage.AddGasChunk"; steve.ModifyDiseaseCount(-steve.DiseaseCount, reason); if (germ_packet != null) { steve.AddDisease((byte)germ_packet["id"], (int)germ_packet["count"], reason); } message = null; ret = steve; } } // Only ask for goodies when we are enabled if (!outstanding && ztransporter.is_enabled()) { // Send a message to the server asking for goodies message = Network.make_message("recv_packet", x, y); message.Add("phase", this.conduitType == ConduitType.Liquid ? "Liquid" : "Gas"); Z.net.send_message(message); outstanding = true; } return(ret); }
private GameObject CraftRecipe(Storage resource_storage, Ingredient[] ingredientTags) { SimUtil.DiseaseInfo a = SimUtil.DiseaseInfo.Invalid; float num = 0f; float num2 = 0f; foreach (Ingredient ingredient in ingredientTags) { GameObject gameObject = resource_storage.FindFirst(ingredient.tag); if ((UnityEngine.Object)gameObject != (UnityEngine.Object)null) { Edible component = gameObject.GetComponent <Edible>(); if ((bool)component) { ReportManager.Instance.ReportValue(ReportManager.ReportType.CaloriesCreated, 0f - component.Calories, StringFormatter.Replace(UI.ENDOFDAYREPORT.NOTES.CRAFTED_USED, "{0}", component.GetProperName()), UI.ENDOFDAYREPORT.NOTES.CRAFTED_CONTEXT); } } resource_storage.ConsumeAndGetDisease(ingredient, out SimUtil.DiseaseInfo disease_info, out float temperature); a = SimUtil.CalculateFinalDiseaseInfo(a, disease_info); num = SimUtil.CalculateFinalTemperature(num2, num, ingredient.amount, temperature); num2 += ingredient.amount; } GameObject prefab = Assets.GetPrefab(Result); GameObject gameObject2 = null; if ((UnityEngine.Object)prefab != (UnityEngine.Object)null) { gameObject2 = GameUtil.KInstantiate(prefab, Grid.SceneLayer.Ore, null, 0); PrimaryElement component2 = gameObject2.GetComponent <PrimaryElement>(); gameObject2.GetComponent <KSelectable>().entityName = Name; if ((UnityEngine.Object)component2 != (UnityEngine.Object)null) { gameObject2.GetComponent <KPrefabID>().RemoveTag(TagManager.Create("Vacuum")); if (ResultElementOverride != 0) { if ((UnityEngine.Object)component2.GetComponent <ElementChunk>() != (UnityEngine.Object)null) { component2.SetElement(ResultElementOverride); } else { component2.ElementID = ResultElementOverride; } } component2.Temperature = num; component2.Units = OutputUnits; } Edible component3 = gameObject2.GetComponent <Edible>(); if ((bool)component3) { ReportManager.Instance.ReportValue(ReportManager.ReportType.CaloriesCreated, component3.Calories, StringFormatter.Replace(UI.ENDOFDAYREPORT.NOTES.CRAFTED, "{0}", component3.GetProperName()), UI.ENDOFDAYREPORT.NOTES.CRAFTED_CONTEXT); } gameObject2.SetActive(true); if ((UnityEngine.Object)component2 != (UnityEngine.Object)null) { component2.AddDisease(a.idx, a.count, "Recipe.CraftRecipe"); } gameObject2.GetComponent <KMonoBehaviour>().Trigger(748399584, null); } return(gameObject2); }