protected override void OnPrefabInit()
    {
        base.OnPrefabInit();
        faceTargetWhenWorking         = true;
        synchronizeAnims              = false;
        workerStatusItem              = Db.Get().DuplicantStatusItems.Deconstructing;
        attributeConverter            = Db.Get().AttributeConverters.ConstructionSpeed;
        attributeExperienceMultiplier = DUPLICANTSTATS.ATTRIBUTE_LEVELING.MOST_DAY_EXPERIENCE;
        minimumAttributeMultiplier    = 0.75f;
        skillExperienceSkillGroup     = Db.Get().SkillGroups.Building.Id;
        skillExperienceMultiplier     = SKILLS.MOST_DAY_EXPERIENCE;
        multitoolContext              = "build";
        multitoolHitEffectTag         = EffectConfigs.BuildSplashId;
        workingPstComplete            = HashedString.Invalid;
        workingPstFailed              = HashedString.Invalid;
        Building component = GetComponent <Building>();

        CellOffset[][] table = OffsetGroups.InvertedStandardTable;
        if (component.Def.IsTilePiece)
        {
            table = OffsetGroups.InvertedStandardTableWithCorners;
        }
        CellOffset[][] offsetTable = OffsetGroups.BuildReachabilityTable(component.Def.PlacementOffsets, table, component.Def.ConstructionOffsetFilter);
        SetOffsetTable(offsetTable);
    }
Exemplo n.º 2
0
 protected override void OnPrefabInit()
 {
     base.OnPrefabInit();
     invalidLocation = new Notification(MISC.NOTIFICATIONS.INVALIDCONSTRUCTIONLOCATION.NAME, NotificationType.BadMinor, HashedString.Invalid, (List <Notification> notificationList, object data) => MISC.NOTIFICATIONS.INVALIDCONSTRUCTIONLOCATION.TOOLTIP + notificationList.ReduceMessages(false), null, true, 0f, null, null, null);
     CellOffset[][] table = OffsetGroups.InvertedStandardTable;
     if (building.Def.IsTilePiece)
     {
         table = OffsetGroups.InvertedStandardTableWithCorners;
     }
     CellOffset[][] offsetTable = OffsetGroups.BuildReachabilityTable(building.Def.PlacementOffsets, table, building.Def.ConstructionOffsetFilter);
     SetOffsetTable(offsetTable);
     storage.SetOffsetTable(offsetTable);
     faceTargetWhenWorking = true;
     Subscribe(-1432940121, OnReachableChangedDelegate);
     if ((UnityEngine.Object)rotatable == (UnityEngine.Object)null)
     {
         MarkArea();
     }
     workerStatusItem              = Db.Get().DuplicantStatusItems.Building;
     workingStatusItem             = null;
     attributeConverter            = Db.Get().AttributeConverters.ConstructionSpeed;
     attributeExperienceMultiplier = DUPLICANTSTATS.ATTRIBUTE_LEVELING.MOST_DAY_EXPERIENCE;
     minimumAttributeMultiplier    = 0.75f;
     skillExperienceSkillGroup     = Db.Get().SkillGroups.Building.Id;
     skillExperienceMultiplier     = SKILLS.MOST_DAY_EXPERIENCE;
     Prioritizable.AddRef(base.gameObject);
     synchronizeAnims      = false;
     multitoolContext      = "build";
     multitoolHitEffectTag = EffectConfigs.BuildSplashId;
     workingPstComplete    = HashedString.Invalid;
     workingPstFailed      = HashedString.Invalid;
 }
Exemplo n.º 3
0
        /// <summary>
        /// Rotates the building placement offsets before building the offset table for
        /// construction or deconstruction.
        /// </summary>
        /// <param name="areaOffsets">The current building placement offsets.</param>
        /// <param name="table">The offset table to use for calculations.</param>
        /// <param name="filter">The filter to apply.</param>
        /// <param name="building">The building which would be built or demolished.</param>
        /// <returns>The adjusted offset table.</returns>
        internal static CellOffset[][] RotateAndBuild(CellOffset[] areaOffsets,
                                                      CellOffset[][] table, CellOffset[] filter, KMonoBehaviour building)
        {
            var placementOffsets = areaOffsets;

            if (building != null && building.TryGetComponent(out Rotatable rotator))
            {
                int n = areaOffsets.Length;
                placementOffsets = new CellOffset[n];
                for (int i = 0; i < n; i++)
                {
                    placementOffsets[i] = rotator.GetRotatedCellOffset(areaOffsets[i]);
                }
            }
            return(OffsetGroups.BuildReachabilityTable(placementOffsets, table, filter));
        }