Exemple #1
0
        public Instance(IStateMachineTarget master, Vector3 offset)
            : base(master)
        {
            KBatchedAnimController kBatchedAnimController = FXHelpers.CreateEffect("recentlyhealed_fx_kanim", master.gameObject.transform.GetPosition() + offset, master.gameObject.transform, true, Grid.SceneLayer.Front, false);

            base.sm.fx.Set(kBatchedAnimController.gameObject, base.smi);
        }
            public Instance(IStateMachineTarget master, Def def) : base(master, def)
            {
                // костыль. так как оно не сохраняется в сейф, то генерируем случайно от 0 до 10% между интервалами.
                float time = Mathf.Lerp(def.timeFromLastMinInterval, def.timeFromLastMaxInterval, 0.1f);

                sm.timeFromLastMelancholy.Set(Random.Range(0, time), smi);
            }
 public EatChore(IStateMachineTarget master)
     : base(Db.Get().ChoreTypes.Eat, master, master.GetComponent <ChoreProvider>(), false, (Action <Chore>)null, (Action <Chore>)null, (Action <Chore>)null, PriorityScreen.PriorityClass.personalNeeds, 5, false, true, 0, false, ReportManager.ReportType.PersonalTime)
 {
     base.smi = new StatesInstance(this);
     showAvailabilityInHoverText = false;
     AddPrecondition(ChorePreconditions.instance.IsNotRedAlert, null);
     AddPrecondition(EdibleIsNotNull, null);
 }
Exemple #4
0
 public MournChore(IStateMachineTarget master)
     : base(Db.Get().ChoreTypes.Mourn, master, master.GetComponent <ChoreProvider>(), false, (Action <Chore>)null, (Action <Chore>)null, (Action <Chore>)null, PriorityScreen.PriorityClass.high, 5, false, true, 0, false, ReportManager.ReportType.WorkTime)
 {
     base.smi = new StatesInstance(this);
     AddPrecondition(ChorePreconditions.instance.IsNotRedAlert, null);
     AddPrecondition(ChorePreconditions.instance.NoDeadBodies, null);
     AddPrecondition(HasValidMournLocation, master);
 }
 public RescueIncapacitatedChore(IStateMachineTarget master, GameObject incapacitatedDuplicant)
     : base(Db.Get().ChoreTypes.RescueIncapacitated, master, (ChoreProvider)null, false, (Action <Chore>)null, (Action <Chore>)null, (Action <Chore>)null, PriorityScreen.PriorityClass.personalNeeds, 5, false, true, 0, false, ReportManager.ReportType.WorkTime)
 {
     base.smi = new StatesInstance(this);
     base.runUntilComplete = true;
     AddPrecondition(ChorePreconditions.instance.NotChoreCreator, incapacitatedDuplicant.gameObject);
     AddPrecondition(CanReachIncapacitated, incapacitatedDuplicant);
 }
Exemple #6
0
 public Instance(IStateMachineTarget master, Def def)
     : base(master, def)
 {
     alignment             = master.GetComponent <FactionAlignment>();
     navigator             = master.GetComponent <Navigator>();
     choreDriver           = master.GetComponent <ChoreDriver>();
     refreshThreatDelegate = RefreshThreat;
 }
 public Instance(IStateMachineTarget master, Disease disease, float decompositionRate = 0.000833333354f, bool spawnRotMonsters = true)
     : base(master)
 {
     base.gameObject.AddComponent <DecorProvider>();
     this.decompositionRate = decompositionRate;
     this.disease           = disease;
     spawnsRotMonsters      = spawnRotMonsters;
 }
Exemple #8
0
 public Instance(IStateMachineTarget master)
     : base(master)
 {
     breath    = Db.Get().Amounts.Breath.Lookup(master.gameObject);
     query     = new SafetyQuery(Game.Instance.safetyConditions.RecoverBreathChecker, GetComponent <KMonoBehaviour>(), 2147483647);
     navigator = GetComponent <Navigator>();
     breather  = GetComponent <OxygenBreather>();
 }
Exemple #9
0
            public AttributeModifier baseHeartAttackChance; // базовый шанс

            public Instance(IStateMachineTarget master) : base(master)
            {
                minionIdentity        = master.GetComponent <MinionIdentity>();
                effects               = master.GetComponent <Effects>();
                sicknesses            = master.gameObject.GetSicknesses();
                health                = master.GetComponent <Health>();
                baseHeartAttackChance = new AttributeModifier(ATTRIBUTE_ID, 0, STRINGS.DUPLICANTS.ATTRIBUTES.HEARTATTACKSUSCEPTIBILITY.AGE_MODIFIER, false, false, false);
            }
        public Instance(IStateMachineTarget master)
            : base(master)
        {
            ChoreConsumer component = GetComponent <ChoreConsumer>();

            component.AddUrge(Db.Get().Urges.EmoteHighPriority);
            component.AddUrge(Db.Get().Urges.EmoteIdle);
        }
        public Instance(IStateMachineTarget master, Def def)
            : base(master, def)
        {
            KBoxCollider2D component = master.GetComponent <KBoxCollider2D>();

            originalColliderSize   = component.size;
            originalColliderOffset = component.offset;
        }
Exemple #12
0
 public FleeChore(IStateMachineTarget target, GameObject enemy)
     : base(Db.Get().ChoreTypes.Flee, target, target.GetComponent <ChoreProvider>(), false, (Action <Chore>)null, (Action <Chore>)null, (Action <Chore>)null, PriorityScreen.PriorityClass.compulsory, 5, false, true, 0, false, ReportManager.ReportType.WorkTime)
 {
     base.smi = new StatesInstance(this);
     base.smi.sm.self.Set(gameObject, base.smi);
     nav = gameObject.GetComponent <Navigator>();
     base.smi.sm.fleeFromTarget.Set(enemy, base.smi);
 }
 public Instance(IStateMachineTarget master, Def def)
     : base(master, def)
 {
     age = Db.Get().Amounts.Age.Lookup(base.gameObject);
     Subscribe(1119167081, delegate
     {
         RandomizeAge();
     });
 }
Exemple #14
0
        public Instance(IStateMachineTarget master, Def def)
            : base(master, def)
        {
            World instance = World.Instance;

            instance.OnSolidChanged = (Action <int>)Delegate.Combine(instance.OnSolidChanged, new Action <int>(OnSolidChanged));
            master.Subscribe(387220196, OnDestinationReached);
            master.Subscribe(-766531887, OnDestinationReached);
        }
Exemple #15
0
 public ReactEmoteChore(IStateMachineTarget target, ChoreType chore_type, EmoteReactable reactable, HashedString emote_kanim, HashedString[] emote_anims, KAnim.PlayMode play_mode, Func <StatusItem> get_status_item)
     : base(chore_type, target, target.GetComponent <ChoreProvider>(), false, (Action <Chore>)null, (Action <Chore>)null, (Action <Chore>)null, PriorityScreen.PriorityClass.basic, 5, false, true, 0, false, ReportManager.ReportType.WorkTime)
 {
     AddPrecondition(ChorePreconditions.instance.IsMoving, null);
     AddPrecondition(ChorePreconditions.instance.IsOffLadder, null);
     AddPrecondition(ChorePreconditions.instance.NotInTube, null);
     AddPrecondition(ChorePreconditions.instance.IsAwake, null);
     getStatusItem = get_status_item;
     base.smi      = new StatesInstance(this, target.gameObject, reactable, emote_kanim, emote_anims, play_mode);
 }
 public MingleChore(IStateMachineTarget target)
     : base(Db.Get().ChoreTypes.Relax, target, target.GetComponent <ChoreProvider>(), false, (Action <Chore>)null, (Action <Chore>)null, (Action <Chore>)null, PriorityScreen.PriorityClass.high, 5, false, true, 0, false, ReportManager.ReportType.PersonalTime)
 {
     showAvailabilityInHoverText = false;
     base.smi = new StatesInstance(this, target.gameObject);
     AddPrecondition(HasMingleCell, this);
     AddPrecondition(ChorePreconditions.instance.IsNotRedAlert, null);
     AddPrecondition(ChorePreconditions.instance.IsScheduledTime, Db.Get().ScheduleBlockTypes.Recreation);
     AddPrecondition(ChorePreconditions.instance.CanDoWorkerPrioritizable, this);
 }
Exemple #17
0
        public Instance(IStateMachineTarget master)
            : base(master)
        {
            AttributeInstance attributeInstance = Db.Get().Attributes.Sneezyness.Lookup(master.gameObject);

            OnSneezyChange();
            AttributeInstance attributeInstance2 = attributeInstance;

            attributeInstance2.OnDirty = (System.Action)Delegate.Combine(attributeInstance2.OnDirty, new System.Action(OnSneezyChange));
        }
 public Instance(IStateMachineTarget master, Def def)
     : base(master)
 {
     recentTopics    = new Queue <string>();
     favouriteTopics = new List <string>
     {
         randomTopics[Random.Range(0, randomTopics.Count)]
     };
     personalTopics = new List <string>();
 }
Exemple #19
0
 public EquipChore(IStateMachineTarget equippable)
     : base(Db.Get().ChoreTypes.Equip, equippable, (ChoreProvider)null, false, (Action <Chore>)null, (Action <Chore>)null, (Action <Chore>)null, PriorityScreen.PriorityClass.personalNeeds, 5, false, true, 0, false, ReportManager.ReportType.WorkTime)
 {
     base.smi = new StatesInstance(this);
     base.smi.sm.equippable_source.Set(equippable.gameObject, base.smi);
     base.smi.sm.requested_units.Set(1f, base.smi);
     showAvailabilityInHoverText = false;
     AddPrecondition(ChorePreconditions.instance.IsAssignedtoMe, equippable.GetComponent <Assignable>());
     AddPrecondition(ChorePreconditions.instance.CanPickup, equippable.GetComponent <Pickupable>());
 }
Exemple #20
0
 public Instance(IStateMachineTarget master, string kanim_file, string anim, KAnim.PlayMode mode, Vector3 offset, Color32 tint_colour)
     : base(master)
 {
     animController = FXHelpers.CreateEffect(kanim_file, base.smi.master.transform.GetPosition() + offset, base.smi.master.transform, false, Grid.SceneLayer.Front, false);
     animController.gameObject.Subscribe(-1061186183, OnAnimQueueComplete);
     animController.TintColour = tint_colour;
     base.sm.fx.Set(animController.gameObject, base.smi);
     this.anim = anim;
     this.mode = mode;
 }
 public Instance(IStateMachineTarget master, Def def)
     : base(master, def)
 {
     calories       = Db.Get().Amounts.Calories.Lookup(base.gameObject);
     calories.value = calories.GetMax() * 0.9f;
     stomach        = new Stomach(def.diet, master.gameObject, def.minPoopSizeInCalories);
     metabolism     = base.gameObject.GetAttributes().Add(Db.Get().CritterAttributes.Metabolism);
     deltaCalorieMetabolismModifier = new AttributeModifier(Db.Get().Amounts.Calories.deltaAttribute.Id, 1f, DUPLICANTS.MODIFIERS.METABOLISM_CALORIE_MODIFIER.NAME, true, false, false);
     calories.deltaAttribute.Add(deltaCalorieMetabolismModifier);
 }
Exemple #22
0
 public Instance(IStateMachineTarget master, string kanim_file, HashedString[] anims, KAnim.PlayMode mode, Vector3 offset, Color32 tint_colour)
     : base(master)
 {
     animController = FXHelpers.CreateEffect(kanim_file, smi.master.transform.GetPosition() + offset, smi.master.transform);
     //animController.gameObject.Subscribe(-1061186183, OnAnimQueueComplete);
     animController.TintColour = tint_colour;
     sm.fx.Set(animController.gameObject, smi);
     this.anims = anims;
     this.mode  = mode;
 }
        public Instance(IStateMachineTarget master)
            : base(master)
        {
            Health component = master.GetComponent <Health>();

            if ((bool)component)
            {
                component.CanBeIncapacitated = true;
            }
        }
 public Instance(IStateMachineTarget master)
     : base(master)
 {
     health     = GetComponent <Health>();
     occupyArea = GetComponent <OccupyArea>();
     internalTemperatureMonitor = base.gameObject.GetSMI <TemperatureMonitor.Instance>();
     internalTemperature        = Db.Get().Amounts.Temperature.Lookup(base.gameObject);
     temperatureTransferer      = base.gameObject.GetComponent <CreatureSimTemperatureTransfer>();
     primaryElement             = base.gameObject.GetComponent <PrimaryElement>();
     attributes = base.gameObject.GetAttributes();
 }
 public Instance(IStateMachineTarget master, Def def)
     : base(master, def)
 {
     detectorNetworkDef = new DetectorNetwork.Def();
     detectorNetworkDef.interferenceRadius = 15;
     detectorNetworkDef.worstWarningTime   = 1f;
     detectorNetworkDef.bestWarningTime    = 200f;
     detectorNetworkDef.bestNetworkSize    = 6;
     targetCraft = new Ref <LaunchConditionManager>();
     RerollAccuracy();
 }
 public DirtyVomitChore(
     ChoreType chore_type,
     IStateMachineTarget target,
     StatusItem status_item,
     Notification notification,
     SimUtil.DiseaseInfo diseaseInfo,
     Action <Chore> on_complete = null)
     : base(Db.Get().ChoreTypes.Vomit, target, target.GetComponent <ChoreProvider>(), true, on_complete,
            null, null, PriorityScreen.PriorityClass.compulsory)
 {
     smi = new StatesInstance(this, target.gameObject, status_item, notification, diseaseInfo);
 }
 // Idle Priority 9 puts it above Idle task but below the task the Dupe is finishing
 public FinishMingleChore(IStateMachineTarget target) : base(Db.Get().ChoreTypes.Relax,
                                                             target, target.GetComponent <ChoreProvider>(), false, null, null, null,
                                                             PriorityScreen.PriorityClass.idle, 9, false, true, 0, false,
                                                             ReportManager.ReportType.PersonalTime)
 {
     showAvailabilityInHoverText = false;
     smi = new StatesInstance(this, target.gameObject);
     AddPrecondition(HAS_MINGLE_CELL, this);
     AddPrecondition(ChorePreconditions.instance.IsNotRedAlert, null);
     AddPrecondition(ChorePreconditions.instance.IsScheduledTime, FinishTasksPatches.
                     FinishBlock);
     AddPrecondition(ChorePreconditions.instance.CanDoWorkerPrioritizable, this);
 }
    public void Apply(Chore.Precondition.Context context)
    {
        ChoreConsumer consumer = context.consumerState.consumer;

        if (targetChore != context.chore || !object.ReferenceEquals(context.chore.target, lastChoreTarget) || !(context.chore.masterPriority == lastPrioritySetting))
        {
            targetChore         = context.chore;
            lastChoreTarget     = context.chore.target;
            lastPrioritySetting = context.chore.masterPriority;
            string choreName = GameUtil.GetChoreName(context.chore, context.data);
            string text      = GameUtil.ChoreGroupsForChoreType(context.chore.choreType);
            string text2     = UI.UISIDESCREENS.MINIONTODOSIDESCREEN.CHORE_TARGET;
            text2 = text2.Replace("{Target}", (!((Object)context.chore.target.gameObject == (Object)consumer.gameObject)) ? context.chore.target.gameObject.GetProperName() : UI.UISIDESCREENS.MINIONTODOSIDESCREEN.SELF_LABEL.text);
            if (text != null)
            {
                text2 = text2.Replace("{Groups}", text);
            }
            string     text3      = (context.chore.masterPriority.priority_class != 0) ? string.Empty : context.chore.masterPriority.priority_value.ToString();
            Sprite     sprite     = (context.chore.masterPriority.priority_class != 0) ? null : prioritySprites[context.chore.masterPriority.priority_value - 1];
            ChoreGroup choreGroup = BestPriorityGroup(context, consumer);
            icon.sprite = ((choreGroup == null) ? null : Assets.GetSprite(choreGroup.sprite));
            label.SetText(choreName);
            subLabel.SetText(text2);
            priorityLabel.SetText(text3);
            priorityIcon.sprite = sprite;
            moreLabel.text      = string.Empty;
            GetComponent <ToolTip>().SetSimpleTooltip(TooltipForChore(context, consumer));
            KButton componentInChildren = GetComponentInChildren <KButton>();
            componentInChildren.ClearOnClick();
            if ((Object)componentInChildren.bgImage != (Object)null)
            {
                componentInChildren.bgImage.colorStyleSetting = ((!((Object)context.chore.driver == (Object)consumer.choreDriver)) ? buttonColorSettingStandard : buttonColorSettingCurrent);
                componentInChildren.bgImage.ApplyColorStyleSetting();
            }
            GameObject gameObject = context.chore.target.gameObject;
            componentInChildren.ClearOnPointerEvents();
            componentInChildren.GetComponentInChildren <KButton>().onClick += delegate
            {
                if (context.chore != null && !context.chore.target.isNull)
                {
                    Vector3 position  = context.chore.target.gameObject.transform.position;
                    float   x         = position.x;
                    Vector3 position2 = context.chore.target.gameObject.transform.position;
                    float   y         = position2.y + 1f;
                    Vector3 position3 = CameraController.Instance.transform.position;
                    Vector3 pos       = new Vector3(x, y, position3.z);
                    CameraController.Instance.SetTargetPos(pos, 10f, true);
                }
            };
        }
    }
        public Instance(IStateMachineTarget master, Def def)
            : base(master, def)
        {
            fertility = Db.Get().Amounts.Fertility.Lookup(base.gameObject);
            if (GenericGameSettings.instance.acceleratedLifecycle)
            {
                fertility.deltaAttribute.Add(new AttributeModifier(fertility.deltaAttribute.Id, 33.3333321f, "Accelerated Lifecycle", false, false, true));
            }
            float value = 100f / (def.baseFertileCycles * 600f);

            fertileEffect = new Effect("Fertile", CREATURES.MODIFIERS.BASE_FERTILITY.NAME, CREATURES.MODIFIERS.BASE_FERTILITY.TOOLTIP, 0f, false, false, false, null, 0f, null);
            fertileEffect.Add(new AttributeModifier(Db.Get().Amounts.Fertility.deltaAttribute.Id, value, CREATURES.MODIFIERS.BASE_FERTILITY.NAME, false, false, true));
            InitializeBreedingChances();
        }
Exemple #30
0
        public Instance(IStateMachineTarget master)
            : base(master)
        {
            sicknesses         = master.GetComponent <MinionModifiers>().sicknesses;
            primaryElement     = master.GetComponent <PrimaryElement>();
            traits             = master.GetComponent <Traits>();
            lastDiseaseSources = new Dictionary <HashedString, DiseaseSourceInfo>();
            lastExposureTime   = new Dictionary <HashedString, float>();
            inhaleExposureTick = new Dictionary <HashedString, InhaleTickInfo>();
            GameClock.Instance.Subscribe(-722330267, OnNightTime);
            OxygenBreather component = GetComponent <OxygenBreather>();

            component.onSimConsume = (Action <Sim.MassConsumedCallback>)Delegate.Combine(component.onSimConsume, new Action <Sim.MassConsumedCallback>(OnAirConsumed));
        }