7 [AttributeUsage(AttributeTargets.Property)]
12 this.conditionType = conditionType;
13 this.onlyInEditors = onlyInEditors;
17 private readonly
bool onlyInEditors;
23 AllowLinkingWifiToChat,
29 OnlyByStatusEffectsAndNetwork,
31 IsToggleableController,
33 DeteriorateUnderStress
38 if (onlyInEditors && Screen.Selected is { IsEditor: false }) {
return false; }
40 return conditionType
switch
45 => entity is Item item && item.Prefab.SwappableItem !=
null,
47 => (entity is Item item && (item.body ==
null || item.body.BodyType == FarseerPhysics.BodyType.Static) && item.Prefab.AllowRotatingInEditor)
48 || (entity is Structure structure && structure.Prefab.AllowRotatingInEditor),
50 => GetComponent<Holdable>(entity) is
Holdable { Attachable:
true },
52 => entity is Structure { HasBody:
true } or Item { body: not
null },
54 => entity is Item item && item.GetComponent<
Pickable>() !=
null,
56 => GameMain.NetworkMember is { IsServer:
true },
58 => GetComponent<Door>(entity) is { HasIntegratedButtons:
true },
60 => GetComponent<Controller>(entity) is
Controller { IsToggle:
true } controller &&
63 => GetComponent<ConnectionPanel>(entity) !=
null,
70 static T GetComponent<T>(ISerializableEntity e) where T :
ItemComponent
72 if (e is T t) {
return t; }
75 return item.GetComponent<T>();
79 return ic.
Item.GetComponent<T>();
The base class for components holding the different functionalities of the item
bool AllowLinkingWifiToChat
bool IsEditable(ISerializableEntity entity)
ConditionallyEditable(ConditionType conditionType, bool onlyInEditors=true)