Esempio n. 1
0
        public override bool SharedCanInteract(ICharacter character, IStaticWorldObject worldObject, bool writeToLog)
        {
            if (!base.SharedCanInteract(character, worldObject, writeToLog))
            {
                return(false);
            }

            if (IsClient)
            {
                // cannot perform further checks on client side
                return(true);
            }

            if (PlayerCharacterSpectator.SharedIsSpectator(character) ||
                CreativeModeSystem.SharedIsInCreativeMode(character))
            {
                return(true);
            }

            var publicState = GetPublicState(worldObject);
            var areasGroup  = LandClaimSystem.SharedGetLandClaimAreasGroup(worldObject);

            if (areasGroup is not null &&
                LandClaimAreasGroup.GetPublicState(areasGroup).FactionClanTag is var claimFactionClanTag &&
                !string.IsNullOrEmpty(claimFactionClanTag))
            {
                // the land claim is owned by faction - verify permission
                if (claimFactionClanTag == FactionSystem.SharedGetClanTag(character) &&
                    FactionSystem.SharedHasAccessRight(character, FactionMemberAccessRights.LandClaimManagement))
                {
                    return(true);
                }
            }
Esempio n. 2
0
        public IEnumerable <string> ServerGetLandOwners()
        {
            var area       = (ILogicObject)this.GameObject;
            var areasGroup = LandClaimSystem.SharedGetLandClaimAreasGroup(area);

            if (areasGroup is null)
            {
                // perhaps a new area
                return(this.DirectLandOwners);
            }

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

            return(faction is null
                       ? this.DirectLandOwners
                       : FactionSystem.ServerGetFactionMemberNames(faction));
        }
Esempio n. 3
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);
        }