예제 #1
0
        public static IStaticWorldObject SharedFindNearbyStationOfTypes(
            IReadOnlyStationsList stationTypes,
            ICharacter character)
        {
            using var objectsInCharacterInteractionArea =
                      InteractionCheckerSystem.SharedGetTempObjectsInCharacterInteractionArea(character);
            if (objectsInCharacterInteractionArea is null)
            {
                return(null);
            }

            foreach (var testResult in objectsInCharacterInteractionArea.AsList())
            {
                var worldObject = testResult.PhysicsBody.AssociatedWorldObject as IStaticWorldObject;
                if (worldObject is null ||
                    !stationTypes.Contains(worldObject.ProtoWorldObject))
                {
                    continue;
                }

                if (!worldObject.ProtoWorldObject.SharedCanInteract(character, worldObject, writeToLog: false))
                {
                    continue;
                }

                // found station with which player can interact
                return(worldObject);
            }

            return(null);
        }
예제 #2
0
            protected sealed override void SetupRecipe(
                out TimeSpan duration,
                InputItems inputItems,
                OutputItems outputItems)
            {
                var stationTypes = new StationsList();

                this.SetupRecipe(stationTypes, out duration, inputItems, outputItems);
                this.StationTypes = stationTypes;

                this.ValidateRecipe();
            }