Exemplo n.º 1
0
        void IInteractableProtoStaticWorldObject.ServerOnMenuClosed(ICharacter who, IStaticWorldObject worldObject)
        {
            var area = LandClaimSystem.ServerGetLandClaimArea(worldObject);

            if (area == null)
            {
                // area could be null in the Editor for the land claim without owners
                return;
            }

            var areasGroup = LandClaimArea.GetPublicState(area).LandClaimAreasGroup;

            if (CreativeModeSystem.SharedIsInCreativeMode(who) &&
                !LandClaimSystem.ServerIsOwnedArea(area, who))
            {
                Server.World.ExitPrivateScope(who, area);
            }

            Server.World.ExitPrivateScope(who, areasGroup);
        }
Exemplo n.º 2
0
        public override void ServerApplyDecay(IStaticWorldObject worldObject, double deltaTime)
        {
            var publicState = GetPublicState(worldObject);

            if (publicState.StructurePointsCurrent <= 0)
            {
                // already awaiting destruction
                return;
            }

            base.ServerApplyDecay(worldObject, deltaTime);

            if (publicState.StructurePointsCurrent > 0)
            {
                return;
            }

            // decayed to the point of starting the destroy timer
            var area             = publicState.LandClaimAreaObject;
            var areaPrivateState = LandClaimArea.GetPrivateState(area);

            areaPrivateState.IsDestroyedByPlayers = false;

            var areasGroup = LandClaimSystem.SharedGetLandClaimAreasGroup(area);

            if (areasGroup is null)
            {
                return;
            }

            var faction = LandClaimAreasGroup.GetPublicState(areasGroup).ServerFaction;

            if (faction is null)
            {
                return;
            }

            var centerTilePosition = LandClaimArea.GetPublicState(area).LandClaimCenterTilePosition;

            FactionSystem.ServerOnLandClaimDecayed(faction, centerTilePosition);
        }
Exemplo n.º 3
0
        void IInteractableProtoWorldObject.ServerOnClientInteract(ICharacter who, IWorldObject worldObject)
        {
            var area = LandClaimSystem.ServerGetLandClaimArea((IStaticWorldObject)worldObject);

            if (area == null)
            {
                // area could be null in the Editor for the land claim without owners
                return;
            }

            var areasGroup = LandClaimArea.GetPublicState(area).LandClaimAreasGroup;

            if (!LandClaimSystem.ServerIsOwnedArea(area, who) &&
                (PlayerCharacterSpectator.SharedIsSpectator(who) ||
                 CreativeModeSystem.SharedIsInCreativeMode(who)))
            {
                Server.World.EnterPrivateScope(who, area);
            }

            Server.World.EnterPrivateScope(who, areasGroup);
        }