Beispiel #1
0
        private void Conditional_ForceEquipmentUse(On.RoR2.CharacterAI.BaseAI.orig_UpdateBodyInputs orig, BaseAI self)
        {
            var component = self.gameObject.GetComponent <BEDUComponent>();

            if (component)
            {
                BaseAIState baseAIState;
                if ((baseAIState = (self.stateMachine.state as BaseAIState)) != null)
                {
                    self.bodyInputs = baseAIState.GenerateBodyInputs(self.bodyInputs);
                }
                if (self.bodyInputBank)
                {
                    bool freeUseEquipment = component.freeUse && self.bodyInputs.pressActivateEquipment;
                    bool useEquipment     = component.useEquipment || freeUseEquipment;
                    bool shouldJump       = component.droneMode == DroneMode.Evade ? component.shouldJump : self.bodyInputs.pressJump;

                    self.bodyInputBank.skill1.PushState(self.bodyInputs.pressSkill1);
                    self.bodyInputBank.skill2.PushState(self.bodyInputs.pressSkill2);
                    self.bodyInputBank.skill3.PushState(self.bodyInputs.pressSkill3);
                    self.bodyInputBank.skill4.PushState(self.bodyInputs.pressSkill4);
                    self.bodyInputBank.jump.PushState(shouldJump);
                    self.bodyInputBank.sprint.PushState(true); //self.bodyInputs.pressSprint

                    component.shouldJump = false;

                    if (component.droneMode == DroneMode.Recycle)
                    {
                        GenericPickupController pickupController = self.body.equipmentSlot.currentTarget.pickupController;
                        if (pickupController && !pickupController.Recycled)
                        {
                            //_logger.LogMessage($"Equipment Drone is currently looking at {PickupCatalog.GetPickupDef(pickupController.pickupIndex).internalName}");
                            PickupIndex initialPickupIndex = pickupController.pickupIndex;
                            if (allowedPickupIndices.Contains(initialPickupIndex))
                            {
                                useEquipment = true;
                            }
                        }
                    }
                    self.bodyInputBank.activateEquipment.PushState(useEquipment);
                    self.bodyInputBank.moveVector = self.bodyInputs.moveVector;
                }
            }
            else
            {
                orig(self);
            }
        }
        private void BaseAI_UpdateBodyInputs(On.RoR2.CharacterAI.BaseAI.orig_UpdateBodyInputs orig, RoR2.CharacterAI.BaseAI self)
        {
            orig(self);
            if (!self.body || self.leader == null)
            {
                return;
            }
            var cpt = self.body.GetComponent <WranglerReceiverComponent>();

            if (cpt && cpt.isWrangled && self.leader.characterBody)
            {
                var fireEverything = self.leader.characterBody.inputBank.skill1.down;
                self.bodyInputBank.skill1.PushState(fireEverything);
                self.bodyInputBank.skill2.PushState(fireEverything);
                self.bodyInputBank.skill3.PushState(fireEverything);
                self.bodyInputBank.skill4.PushState(fireEverything);
                self.bodyInputBank.activateEquipment.PushState(fireEverything);
            }
        }