private static bool GridVisibility_Validate(object value) { GridVisibility x = (GridVisibility)value; return(x == GridVisibility.ALLTICKS || x == GridVisibility.LONGTICKS || x == GridVisibility.HIDDEN); }
public GameObject CreatePrefab() { string name = DUPLICANTS.MODIFIERS.BASEDUPLICANT.NAME; GameObject gameObject = EntityTemplates.CreateEntity(ID, name, true); gameObject.AddOrGet <StateMachineController>(); MinionModifiers modifiers = gameObject.AddOrGet <MinionModifiers>(); AddMinionAmounts(modifiers); AddMinionTraits(name, modifiers); gameObject.AddOrGet <MinionBrain>(); gameObject.AddOrGet <KPrefabID>().AddTag(GameTags.DupeBrain, false); gameObject.AddOrGet <Worker>(); gameObject.AddOrGet <ChoreConsumer>(); Storage storage = gameObject.AddOrGet <Storage>(); storage.fxPrefix = Storage.FXPrefix.PickedUp; storage.dropOnLoad = true; storage.SetDefaultStoredItemModifiers(new List <Storage.StoredItemModifier> { Storage.StoredItemModifier.Preserve, Storage.StoredItemModifier.Seal }); gameObject.AddOrGet <Health>(); OxygenBreather oxygenBreather = gameObject.AddOrGet <OxygenBreather>(); oxygenBreather.O2toCO2conversion = 0.02f; oxygenBreather.lowOxygenThreshold = 0.52f; oxygenBreather.noOxygenThreshold = 0.05f; oxygenBreather.mouthOffset = new Vector2f(0.25f, 0.7f); oxygenBreather.minCO2ToEmit = 0.02f; oxygenBreather.breathableCells = new CellOffset[6] { new CellOffset(0, 0), new CellOffset(0, 1), new CellOffset(1, 1), new CellOffset(-1, 1), new CellOffset(1, 0), new CellOffset(-1, 0) }; gameObject.AddOrGet <WarmBlooded>(); gameObject.AddOrGet <MinionIdentity>(); GridVisibility gridVisibility = gameObject.AddOrGet <GridVisibility>(); gridVisibility.radius = 30f; gridVisibility.innerRadius = 20f; gameObject.AddOrGet <MiningSounds>(); gameObject.AddOrGet <SaveLoadRoot>(); gameObject.AddOrGet <AntiCluster>(); Navigator navigator = gameObject.AddOrGet <Navigator>(); navigator.NavGridName = "MinionNavGrid"; navigator.CurrentNavType = NavType.Floor; KBatchedAnimController kBatchedAnimController = gameObject.AddOrGet <KBatchedAnimController>(); kBatchedAnimController.isMovable = true; kBatchedAnimController.sceneLayer = Grid.SceneLayer.Move; kBatchedAnimController.AnimFiles = new KAnimFile[8] { Assets.GetAnim("body_comp_default_kanim"), Assets.GetAnim("anim_construction_default_kanim"), Assets.GetAnim("anim_idles_default_kanim"), Assets.GetAnim("anim_loco_firepole_kanim"), Assets.GetAnim("anim_loco_new_kanim"), Assets.GetAnim("anim_loco_tube_kanim"), Assets.GetAnim("anim_construction_firepole_kanim"), Assets.GetAnim("anim_construction_jetsuit_kanim") }; KBoxCollider2D kBoxCollider2D = gameObject.AddOrGet <KBoxCollider2D>(); kBoxCollider2D.offset = new Vector2(0f, 0.8f); kBoxCollider2D.size = new Vector2(1f, 1.5f); SnapOn snapOn = gameObject.AddOrGet <SnapOn>(); snapOn.snapPoints = new List <SnapOn.SnapPoint>(new SnapOn.SnapPoint[17] { new SnapOn.SnapPoint { pointName = "dig", automatic = false, context = (HashedString)"dig", buildFile = Assets.GetAnim("excavator_kanim"), overrideSymbol = (HashedString)"snapTo_rgtHand" }, new SnapOn.SnapPoint { pointName = "dig", automatic = false, context = (HashedString)"build", buildFile = Assets.GetAnim("constructor_gun_kanim"), overrideSymbol = (HashedString)"snapTo_rgtHand" }, new SnapOn.SnapPoint { pointName = "dig", automatic = false, context = (HashedString)"fetchliquid", buildFile = Assets.GetAnim("water_gun_kanim"), overrideSymbol = (HashedString)"snapTo_rgtHand" }, new SnapOn.SnapPoint { pointName = "dig", automatic = false, context = (HashedString)"paint", buildFile = Assets.GetAnim("painting_gun_kanim"), overrideSymbol = (HashedString)"snapTo_rgtHand" }, new SnapOn.SnapPoint { pointName = "dig", automatic = false, context = (HashedString)"harvest", buildFile = Assets.GetAnim("plant_harvester_gun_kanim"), overrideSymbol = (HashedString)"snapTo_rgtHand" }, new SnapOn.SnapPoint { pointName = "dig", automatic = false, context = (HashedString)"capture", buildFile = Assets.GetAnim("net_gun_kanim"), overrideSymbol = (HashedString)"snapTo_rgtHand" }, new SnapOn.SnapPoint { pointName = "dig", automatic = false, context = (HashedString)"attack", buildFile = Assets.GetAnim("attack_gun_kanim"), overrideSymbol = (HashedString)"snapTo_rgtHand" }, new SnapOn.SnapPoint { pointName = "dig", automatic = false, context = (HashedString)"pickup", buildFile = Assets.GetAnim("pickupdrop_gun_kanim"), overrideSymbol = (HashedString)"snapTo_rgtHand" }, new SnapOn.SnapPoint { pointName = "dig", automatic = false, context = (HashedString)"store", buildFile = Assets.GetAnim("pickupdrop_gun_kanim"), overrideSymbol = (HashedString)"snapTo_rgtHand" }, new SnapOn.SnapPoint { pointName = "dig", automatic = false, context = (HashedString)"disinfect", buildFile = Assets.GetAnim("plant_spray_gun_kanim"), overrideSymbol = (HashedString)"snapTo_rgtHand" }, new SnapOn.SnapPoint { pointName = "dig", automatic = false, context = (HashedString)"tend", buildFile = Assets.GetAnim("plant_harvester_gun_kanim"), overrideSymbol = (HashedString)"snapTo_rgtHand" }, new SnapOn.SnapPoint { pointName = "carry", automatic = false, context = (HashedString)string.Empty, buildFile = null, overrideSymbol = (HashedString)"snapTo_chest" }, new SnapOn.SnapPoint { pointName = "build", automatic = false, context = (HashedString)string.Empty, buildFile = null, overrideSymbol = (HashedString)"snapTo_rgtHand" }, new SnapOn.SnapPoint { pointName = "remote", automatic = false, context = (HashedString)string.Empty, buildFile = null, overrideSymbol = (HashedString)"snapTo_rgtHand" }, new SnapOn.SnapPoint { pointName = "snapTo_neck", automatic = false, context = (HashedString)string.Empty, buildFile = Assets.GetAnim("helm_oxygen_kanim"), overrideSymbol = (HashedString)"snapTo_neck" }, new SnapOn.SnapPoint { pointName = "dig", automatic = false, context = (HashedString)"powertinker", buildFile = Assets.GetAnim("electrician_gun_kanim"), overrideSymbol = (HashedString)"snapTo_rgtHand" }, new SnapOn.SnapPoint { pointName = "dig", automatic = false, context = (HashedString)"specialistdig", buildFile = Assets.GetAnim("excavator_kanim"), overrideSymbol = (HashedString)"snapTo_rgtHand" } }); gameObject.AddOrGet <Effects>(); gameObject.AddOrGet <Traits>(); gameObject.AddOrGet <AttributeLevels>(); gameObject.AddOrGet <AttributeConverters>(); PrimaryElement primaryElement = gameObject.AddOrGet <PrimaryElement>(); primaryElement.InternalTemperature = 310.15f; primaryElement.MassPerUnit = 30f; primaryElement.ElementID = SimHashes.Creature; gameObject.AddOrGet <ChoreProvider>(); gameObject.AddOrGetDef <DebugGoToMonitor.Def>(); gameObject.AddOrGetDef <SpeechMonitor.Def>(); gameObject.AddOrGetDef <BlinkMonitor.Def>(); gameObject.AddOrGetDef <ConversationMonitor.Def>(); gameObject.AddOrGet <Sensors>(); gameObject.AddOrGet <Chattable>(); gameObject.AddOrGet <FaceGraph>(); gameObject.AddOrGet <Accessorizer>(); gameObject.AddOrGet <Schedulable>(); LoopingSounds loopingSounds = gameObject.AddOrGet <LoopingSounds>(); loopingSounds.updatePosition = true; gameObject.AddOrGet <AnimEventHandler>(); FactionAlignment factionAlignment = gameObject.AddOrGet <FactionAlignment>(); factionAlignment.Alignment = FactionManager.FactionID.Duplicant; gameObject.AddOrGet <Weapon>(); gameObject.AddOrGet <RangedAttackable>(); gameObject.AddOrGet <CharacterOverlay>(); OccupyArea occupyArea = gameObject.AddOrGet <OccupyArea>(); occupyArea.objectLayers = new ObjectLayer[1]; occupyArea.ApplyToCells = false; occupyArea.OccupiedCellsOffsets = new CellOffset[2] { new CellOffset(0, 0), new CellOffset(0, 1) }; gameObject.AddOrGet <Pickupable>(); CreatureSimTemperatureTransfer creatureSimTemperatureTransfer = gameObject.AddOrGet <CreatureSimTemperatureTransfer>(); creatureSimTemperatureTransfer.SurfaceArea = 10f; creatureSimTemperatureTransfer.Thickness = 0.01f; gameObject.AddOrGet <SicknessTrigger>(); gameObject.AddOrGet <ClothingWearer>(); gameObject.AddOrGet <SuitEquipper>(); DecorProvider decorProvider = gameObject.AddOrGet <DecorProvider>(); decorProvider.baseRadius = 3f; decorProvider.isMovable = true; gameObject.AddOrGet <ConsumableConsumer>(); gameObject.AddOrGet <NoiseListener>(); gameObject.AddOrGet <MinionResume>(); DuplicantNoiseLevels.SetupNoiseLevels(); SetupLaserEffects(gameObject); SymbolOverrideController symbolOverrideController = SymbolOverrideControllerUtil.AddToPrefab(gameObject); symbolOverrideController.applySymbolOverridesEveryFrame = true; ConfigureSymbols(gameObject); return(gameObject); }