public override bool CanAddItem(CanAddItemContext context) { if (context.ByCharacter is null) { // server can place here anything return(true); } var protoItem = context.Item.ProtoItem; if (protoItem is not ItemReactorFuelRod && protoItem is not ProtoItemReactorModule) { // player can place here only specific items if (IsClient && !context.IsExploratoryCheck) { NotificationSystem.ClientShowNotification(Notification_ErrorIncompatibleItem_Title, Notification_ErrorIncompatibleItem_Message, NotificationColor.Bad, icon: protoItem.Icon); } return(false); } return(ServerCanPlayerInteract(context.Container, allowClientNotifications: !context.IsExploratoryCheck)); }
public static bool SharedCanAddItem(CanAddItemContext context) { if (!context.SlotId.HasValue) { return(true); } var slotIdValue = context.SlotId.Value; if (slotIdValue < (byte)EquipmentType.Device || slotIdValue > (byte)EquipmentType.Device + 4) { return(true); } IItem itemAtSlot = context.Container.GetItemAtSlot(slotIdValue); if (itemAtSlot is not null && itemAtSlot.ProtoItem is ProtoItemBackpack backpack) { return(backpack.SharedCanRemoveItem(itemAtSlot, context.ByCharacter, true)); } if (context.Item.ProtoItem is ProtoItemBackpack && context.ByCharacter is not null) { var countE = context.ByCharacter.SharedGetPlayerContainerEquipment().GetItemsOfProto <ProtoItemBackpack>().ToList().Count; if (countE >= 1) { return(false); } } return(true); }
public override bool CanAddItem(CanAddItemContext context) { var protoItem = context.Item.ProtoItem; return(protoItem is IProtoItemLiquidStorage || protoItem is ItemCanisterEmpty || protoItem is ItemBottleEmpty); }
public override bool CanAddItem(CanAddItemContext context) { //MOD if (!ProtoItemStorageFridge.SharedCanAddItem(context)) { return(false); } // allow everything return(true); }
public override bool CanAddItem(CanAddItemContext context) { var obj = context.Item.ProtoGameObject; var proto = context.Item.ProtoItem; if (obj is IProtoItemStorage) return false; if (obj is IProtoItemBackpack) return false; return obj is IProtoItemFood || obj is IProtoItemMedical || proto is ItemCoinShiny || proto is ItemCoinPenny; }
public override bool CanAddItem(CanAddItemContext context) { var character = context.ByCharacter; if (character is null) { return(true); } return(context.Item.ProtoItem is IProtoItemWithDurability protoItemWithDurability && protoItemWithDurability.DurabilityMax > 0 && protoItemWithDurability.IsRepairable); }
public override bool CanAddItem(CanAddItemContext context) { if (context.ByCharacter is null) { // server can place here anything // (necessary for placing the broken solar panels) return(true); } // player can place here only solar panels var protoItem = context.Item.ProtoItem; return(protoItem is IProtoItemSolarPanel); }
public override bool CanAddItem(CanAddItemContext context) { var character = context.ByCharacter; if (character is null) { return(true); } var item = context.Item; if (item.ProtoItem is not IProtoItemWithDurability { DurabilityMax : > 0, IsRepairable : true })
public override bool CanAddItem(CanAddItemContext context) { var protoItem = context.Item.ProtoItem; if (protoItem is IProtoItemFuelCell) { return(true); } if (IsServer) { // server can place anything here return(true); } return(false); }
public static bool SharedCanAddItem(CanAddItemContext context) { if (context.Item.ProtoItem is ProtoItemStorageFridge) { List <IItem> listI = context.Container.OwnerAsCharacter.SharedGetPlayerContainerInventory().GetItemsOfProto <ProtoItemStorageFridge>().ToList(); listI.Remove(context.Item); List <IItem> listH = context.Container.OwnerAsCharacter.SharedGetPlayerContainerHotbar().GetItemsOfProto <ProtoItemStorageFridge>().ToList(); listH.Remove(context.Item); if (listI.Count + listH.Count >= 1) { return(false); } } return(true); }
public override bool CanAddItem(CanAddItemContext context) { var character = context.ByCharacter; if (character is null) { return(true); } if (!LandClaimSystem.ValidateIsNotUnderRaidblock(context.Container.OwnerAsStaticObject, character)) { // don't allow to place anything in tinker table while the area is under raid return(false); } return(ItemDisassemblySystem.SharedCanDisassemble(context.Item.ProtoItem)); }
public override bool CanAddItem(CanAddItemContext context) { var character = context.ByCharacter; if (character is null) { return(true); } if (!LandClaimSystem.ValidateIsNotUnderRaidblock(context.Container.OwnerAsStaticObject, character)) { // don't allow to place anything in a trash can while the area is under raid return(false); } // allow everything return(true); }
public override bool CanAddItem(CanAddItemContext context) { var obj = context.Item.ProtoGameObject; var proto = context.Item.ProtoItem; if (obj is IProtoItemStorage) { return(false); } if (!this.IsTradingStation(context.Container.Owner.ProtoGameObject)) { if (obj is IProtoItemBackpack) { return(false); } } return(true); }
public override bool CanAddItem(CanAddItemContext context) { if (context.ByCharacter is null || isCompactingNow) { return(true); } // prohibit adding items to this container by any character if its capacity is exceeded if (context.Container.SlotsCount > RatePvPSafeStorageCapacity.SharedValue) { return(false); } if (!SharedIsAllowedItemProto(context.Item.ProtoItem)) { return(false); } return(true); }
public override bool CanAddItem(CanAddItemContext context) { if (!context.SlotId.HasValue) { return(false); } if (context.ByCharacter is null) { // perhaps the server is placing destroyed weapon's ammo there return(true); } var allowedSlotsIds = this.GetAllowedSlotsIds(context.Item.ProtoItem); if (allowedSlotsIds is null) { return(false); } return(allowedSlotsIds.Contains(context.SlotId.Value)); }
public override bool CanAddItem(CanAddItemContext context) { if (context.ByCharacter == null || isCompactingNow) { return(true); } // prohibit adding items to this container by any character if its capacity is exceeded if (context.Container.SlotsCount > (IsServer ? ServerSafeItemsSlotsCapacity : ClientSafeItemsSlotsCapacity)) { return(false); } if (!SharedIsAllowedItemProto(context.Item.ProtoItem)) { return(false); } return(true); }
///// <summary> ///// By default, add new items to the end of the container ///// </summary> //public override bool IsAddItemsToBeginning => false; public override bool CanAddItem(CanAddItemContext context) { // allow everything return(true); }
public override bool CanAddItem(CanAddItemContext context) { if (context.Item.ProtoItem is not IProtoItemEquipment protoItemEquipment) { // not an equipment - cannot be placed here return(false); } if (!context.SlotId.HasValue) { // no specific slot provided - so answer "true" because any equipment item could be added here return(true); } var slotIdValue = (EquipmentType)context.SlotId.Value; var itemEquipmentType = protoItemEquipment.EquipmentType; if (!context.IsExploratoryCheck && (itemEquipmentType == EquipmentType.Armor || itemEquipmentType == EquipmentType.FullBody) && !StatusEffectPeredozinApplication.SharedCheckCanEquipArmor(context.Container.OwnerAsCharacter, clientShowNotification: true)) { // don't allow equipping armor while peredozin is applying return(false); } if (itemEquipmentType == EquipmentType.FullBody) { if (slotIdValue != EquipmentType.Armor) { // cannot place full body armor in another slots return(false); } if (context.IsExploratoryCheck) { // no more checks return(true); } // It's actual operation, perform more checks! // Need to verify that head is an empty slot // Please note: can equip full body when there is an armor without the head item - will swap items. var container = context.Container; if (IsSlotEmpty(container, EquipmentType.Head)) { // can place here return(true); } // head and legs are not empty if (IsClient) { NotificationSystem.ClientShowNotification( NotificationCannotEquip, NotificationRemoveOtherEquipment, NotificationColor.Bad, protoItemEquipment.Icon); } return(false); } var isValidSlot = protoItemEquipment.CompatibleContainerSlotsIds.Contains((byte)slotIdValue); if (!isValidSlot) { // the selected slot doesn't match the equipment return(false); } if (itemEquipmentType == EquipmentType.Implant) { // implant item if (context.ByCharacter is null || CreativeModeSystem.SharedIsInCreativeMode(context.ByCharacter)) { // Allowed to add/remove implant item by the game only (via medical station). // But allow to characters in the creative mode to do this directly. return(true); } if (IsClient && !context.IsExploratoryCheck && protoItemEquipment is not ItemImplantBroken) { NotificationSystem.ClientShowNotification( NotificationUseStationToInstallImplant_Title, NotificationUseStationToInstallImplant_Message, NotificationColor.Bad, protoItemEquipment.Icon); } return(false); } if (!context.IsExploratoryCheck && itemEquipmentType == EquipmentType.Head) { // Regular equipment - can equip head ONLY if there is no full body armor. // Please note: can equip regular armor (without the helmet) even if there is full body armor - will swap items. if (IsHasFullBodyArmor(context.Container)) { // has full body armor - cannot equip this item if (IsClient) { NotificationSystem.ClientShowNotification( NotificationCannotEquip, NotificationRemoveFullBody, NotificationColor.Bad, protoItemEquipment.Icon); } return(false); } } return(true); }
public sealed override bool CanAddItem(CanAddItemContext context) { return(context.Item.ProtoItem is TProtoItem); }
public override bool CanAddItem(CanAddItemContext context) { return(context.Item.ProtoGameObject is IProtoItemAmmo protoItemAmmo && this.ProtoWeapon.CompatibleAmmoProtos.Contains(protoItemAmmo)); }
public override bool CanAddItem(CanAddItemContext context) { // prohibit adding items to this container by any character return(context.ByCharacter == null); }
public override bool CanAddItem(CanAddItemContext context) { return(context.Item.ProtoItem is IProtoItemWithDurablity protoItemWithDurablity && protoItemWithDurablity.IsRepairable); }
public override bool CanAddItem(CanAddItemContext context) { return(context.Item.ProtoItem is IProtoItemPowerBank || (context.Item.ProtoItem is IProtoItemWithFuel protoItemWithFuel && protoItemWithFuel.ItemFuelConfig.IsElectricity)); }
public override bool CanAddItem(CanAddItemContext context) { return(context.Item.ProtoItem is IProtoItemOrganic protoItemOrganic && protoItemOrganic.OrganicValue > 0); }
public override bool CanAddItem(CanAddItemContext context) { var protoItem = context.Item.ProtoItem; return(protoItem is IProtoItemSolarPanel); }
public override bool CanAddItem(CanAddItemContext context) { return(context.Item.ProtoItem is not IProtoItemFuelSolid); }