3 using Microsoft.Xna.Framework;
5 using System.Collections.Generic;
16 private float pickTimer;
49 string[] slotCombinations = slotString.Split(
',');
50 foreach (
string slotCombination
in slotCombinations)
52 string[] slots = slotCombination.Split(
'+');
54 foreach (
string slot
in slots)
56 switch (slot.ToLowerInvariant())
75 if (pickTimer > 0.0f) {
return false; }
76 if (
PickingTime >=
float.MaxValue) {
return false; }
93 abilityPickingTime.Value /= 1 + heldItem.Prefab.AddedPickingSpeedMultiplier;
104 item.CreateServerEvent(
this);
106 pickingCoroutine = CoroutineManager.StartCoroutine(WaitForPick(
picker, abilityPickingTime.Value));
127 bool alreadyEquipped =
false;
135 alreadyEquipped =
true;
140 if (alreadyEquipped) {
return false; }
162 if (pickDroppedStack)
164 foreach (var droppedItem
in droppedStack)
166 if (droppedItem ==
item) {
continue; }
180 private IEnumerable<CoroutineStatus> WaitForPick(
Character picker,
float requiredTime)
187 if (!CoroutineManager.Paused)
208 pickTimer / requiredTime,
209 GUIStyle.Red, GUIStyle.Green,
210 !
string.IsNullOrWhiteSpace(
PickingMsg) ?
PickingMsg :
this is Door ?
"progressbar.opening" :
"progressbar.deattaching");
214 pickTimer += CoroutineManager.DeltaTime;
216 yield
return CoroutineStatus.Running;
222 bool isNotRemote =
true;
229 yield
return CoroutineStatus.Success;
239 if (pickingCoroutine !=
null)
241 CoroutineManager.StopCoroutines(pickingCoroutine);
242 pickingCoroutine =
null;
259 if (w ==
null)
continue;
271 Vector2 bodyDropPos = Vector2.Zero;
296 DebugConsole.ThrowError(
297 "Failed to drop the Pickable component of the item \"" +
item.
Name +
"\" (body has been removed"
298 + (
item.
Removed ?
", item has been removed)" :
")"));
void UpdateUseItem(bool allowMovement, Vector2 handWorldPos)
void CheckTalents(AbilityEffectType abilityEffectType, AbilityObject abilityObject)
bool CanInteractWith(Character c, float maxDist=200.0f, bool checkVisibility=true, bool skipDistanceCheck=false)
override Vector2? SimPosition
CharacterInventory Inventory
static Character? Controlled
bool IsKeyDown(InputType inputType)
bool IsAnySelectedItem(Item item)
Is the item either the primary or the secondary selected item?
HUDProgressBar UpdateHUDProgressBar(object linkedObject, Vector2 worldPosition, float progress, Color emptyColor, Color fullColor, string textTag="")
Creates a progress bar that's "linked" to the specified object (or updates an existing one if there's...
readonly AnimController AnimController
IEnumerable< Item >?? HeldItems
Items the character has in their hand slots. Doesn't return nulls and only returns items held in both...
bool IsRemotePlayer
Is the character controlled by another human player (should always be false in single player)
bool AccessibleWhenAlive
Can the inventory be accessed when the character is still alive
InvSlotType[] SlotTypes
Slot type for each inventory slot. Vanilla package has one type for each slot, although it is technic...
bool AccessibleByOwner
Can the inventory be accessed by the character itself when the character is still alive (only has an ...
override void RemoveItem(Item item)
bool TryPutItemWithAutoEquipCheck(Item item, Character user, IEnumerable< InvSlotType > allowedSlots=null, bool createNetworkEvent=true)
If there is no room in the generic inventory (InvSlotType.Any), check if the item can be auto-equippe...
string? GetAttributeString(string key, string? def)
static CoroutineStatus Success
virtual Vector2 SimPosition
static Entity FindEntityByID(ushort ID)
Find an entity based on the ID
static SubEditorScreen SubEditorScreen
IEnumerable< Item > GetItemsAt(int index)
Get all the item stored in the specified inventory slot. Can return more than one item if the slot co...
override Vector2? SimPosition
void Drop(Character dropper, bool createNetworkEvent=true, bool setTransform=true)
Inventory ParentInventory
void SetTransform(Vector2 simPosition, float rotation, bool findNewHull=true, bool setPrevTransform=true)
IEnumerable< Item > DroppedStack
override string Name
Note that this is not a LocalizedString instance, just the current name of the item as a string....
AbilityItemPickingTime(float pickingTime, ItemPrefab itemPrefab)
IReadOnlyCollection< Wire > Wires
readonly List< Connection > Connections
readonly HashSet< Wire > DisconnectedWires
Wires that have been disconnected from the panel, but not removed completely (visible at the bottom o...
The base class for components holding the different functionalities of the item
void ApplyStatusEffects(ActionType type, float deltaTime, Character character=null, Limb targetLimb=null, Entity useTarget=null, Character user=null, Vector2? worldPosition=null, float afflictionMultiplier=1.0f)
void PlaySound(ActionType type, Character user=null)
Dictionary< RelatedItem.RelationType, List< RelatedItem > > RequiredItems
virtual void ServerEventWrite(IWriteMessage msg, Client c, NetEntityEvent.IData extraData=null)
virtual void ClientEventRead(IReadMessage msg, float sendingTime)
override void Drop(Character dropper, bool setTransform=true)
a Character has dropped the item
Pickable(Item item, ContentXElement element)
List< InvSlotType > AllowedSlots
List< InvSlotType > allowedSlots
virtual bool OnPicked(Character picker, bool pickDroppedStack)
override bool Pick(Character picker)
a Character has picked the item
void StopPicking(Character picker)
virtual bool OnPicked(Character picker)
void DropConnectedWires(Character character)
readonly List< MapEntity > linkedTo
Interface for entities that the server can send events to the clients
void WriteUInt16(UInt16 val)
ActionType
ActionTypes define when a StatusEffect is executed.