2 using Microsoft.Xna.Framework;
3 using Microsoft.Xna.Framework.Graphics;
5 using System.Diagnostics.Tracing;
9 partial class Holdable : IDrawableComponent
13 get {
return item.
Rect.Size.ToVector2(); }
16 public void Draw(SpriteBatch spriteBatch,
bool editing,
float itemDepth = -1, Color? overrideColor =
null)
25 Vector2 roundedGridPos =
new Vector2(
28 Vector2 attachPos = GetAttachPosition(
picker);
33 if (attachTarget !=
null)
58 sprite = containedSprite.
Sprite;
65 new Vector2(attachPos.X, -attachPos.Y),
70 GUI.DrawRectangle(spriteBatch,
new Vector2(attachPos.X - 2, -attachPos.Y - 2), Vector2.One * 5, GUIStyle.Red, thickness: 3);
74 => TryExtractEventData<EventData>(data, out _);
78 if (!attachable || body ==
null) {
return; }
80 var eventData = ExtractEventData<EventData>(extraData);
82 Vector2 attachPos = eventData.AttachPos;
89 base.ClientEventRead(msg, sendingTime);
92 if (!readAttachData) {
return; }
static Character? Controlled
bool IsKeyDown(InputType inputType)
override Vector2 Position
readonly bool UseWhenAttached
static Entity FindEntityByID(ushort ID)
Find an entity based on the ID
void SetTransform(Vector2 simPosition, float rotation, bool findNewHull=true, bool setPrevTransform=true)
ImmutableArray< ContainedItemSprite > ContainedSprites
bool CanBeAttached(Character user)
void ClientEventWrite(IWriteMessage msg, NetEntityEvent.IData extraData=null)
override bool ValidateEventData(NetEntityEvent.IData data)
void Draw(SpriteBatch spriteBatch, bool editing, float itemDepth=-1, Color? overrideColor=null)
override void ClientEventRead(IReadMessage msg, float sendingTime)
override void Drop(Character dropper, bool setTransform=true)
a Character has dropped the item
void DropConnectedWires(Character character)
void Draw(ISpriteBatch spriteBatch, Vector2 pos, float rotate=0.0f, float scale=1.0f, SpriteEffects spriteEffect=SpriteEffects.None)
static Structure GetAttachTarget(Vector2 worldPosition)
Checks if there's a structure items can be attached to at the given position and returns it.
static void DrawGrid(SpriteBatch spriteBatch, int gridCells, Vector2 gridCenter, Vector2 roundedGridCenter, float alpha=1.0f)
static readonly Vector2 GridSize
override Vector2? Position
void WriteSingle(Single val)