public static bool TryFetchFunctionMarker(LG_Zone zone, ZonePlacementWeights weight, ExpeditionFunction function, out LG_DistributeItem distItem, out AIG_CourseNode distNode, bool createNew = true)
        {
            float rand  = RandomUtil.Value("LG_Distribute_WardenObjective");
            var   exist = LG_DistributionJobUtils.TryGetExistingZoneFunctionDistribution(zone, function, rand, weight, out distItem, out distNode);

            if (!exist && createNew)
            {
                PushFunctionMarker(zone, weight, function, out distItem, out distNode);
                return(true);
            }

            return(exist);
        }
Example #2
0
        //Pre-Build Method
        public override void OnSetup()
        {
            return;

            //Get Zone from Builder Context
            Builder.TryGetZone(eLocalZoneIndex.Zone_0, out var zone);

            //Or you can also do this!
            var placements = Builder.PickPlacementsStandard(LayerData.ObjectiveData.ZonePlacementDatas, 4);

            //Builder.PickPlacements(LayerData.ObjectiveData.ZonePlacementDatas, PickMode.Random, PickMode.Random, 4);

            foreach (var place in placements)
            {
                if (Builder.TryGetZone(place.LocalIndex, out var placementZone))
                {
                    Logger.Log("Found zone from placement data: {0}", placementZone.Alias);
                }
            }

            //Create Empty PlacementWeights Data
            var weight = new ZonePlacementWeights()
            {
                Start = 0.0f, Middle = 0.0f, End = 0.0f
            };

            //Spawn regular Disinfection Station
            Builder.PlaceDisinfectStation(zone, weight);

            //Place 5 Terminal but With custom logs!
            for (int i = 0; i < 5; i++)
            {
                Builder.PlaceTerminal(zone, weight, (terminal) =>
                {
                    terminal.AddLocalLog(new TerminalLogFileData()
                    {
                        FileName    = "HelloWorld.log",
                        FileContent = "UwU\nCuddle me hard senpai~"
                    });
                });
            }

            //Add Sign using PlaceFunction, And Modify the Text too
            for (int i = 0; i < 4; i++)
            {
                Builder.PlaceFunction <LG_Sign>(zone, weight, ExpeditionFunction.Sign, (sign) =>
                {
                    sign.m_text.text = "Poggers";
                });
            }
        }
        public static void PushFunctionMarker(LG_Zone zone, ZonePlacementWeights weight, ExpeditionFunction function, out LG_DistributeItem distItem, out AIG_CourseNode distNode)
        {
            var randNode    = LG_DistributionJobUtils.GetRandomNodeFromZoneForFunction(zone, function, Builder.BuildSeedRandom.Value("FindFunctionMarker"), 1f);
            var newDistItem = new LG_DistributeItem()
            {
                m_function     = function,
                m_amount       = 1.0f,
                m_assignedNode = randNode
            };

            randNode.m_zone.DistributionData.GenericFunctionItems.Enqueue(newDistItem);

            distItem = newDistItem;
            distNode = randNode;
        }
 public static LG_DistributeItem PushFunctionMarker(LG_Zone zone, ZonePlacementWeights weight, ExpeditionFunction function)
 {
     PushFunctionMarker(zone, weight, function, out var distItem, out _);
     return(distItem);
 }
 public static bool TryFetchFunctionMarker(LG_Zone zone, ZonePlacementWeights weight, ExpeditionFunction function, out LG_DistributeItem distItem)
 {
     return(TryFetchFunctionMarker(zone, weight, function, out distItem, out _));
 }
 public static bool TryGetRandomPlaceSingleZone(CustomExpHandlerBase handlerContext, out LG_Zone zone, out ZonePlacementWeights weight)
 {
     return(LG_DistributionJobUtils.TryGetRandomPlacementZone(handlerContext.Layer, handlerContext.LayerData.ObjectiveData.ZonePlacementDatas, out zone, out weight));
 }