Class TrinketTinkerCompanion
- Namespace
- TrinketTinker.Companions
- Assembly
- TrinketTinker.dll
Main companion class for trinket tinker.
public class TrinketTinkerCompanion : Companion, INetObject<NetFields>
- Inheritance
-
CompanionTrinketTinkerCompanion
- Implements
-
INetObject<NetFields>
- Inherited Members
-
Companion.directionCompanion._positionCompanion._ownerCompanion.whichVariantCompanion.lerpCompanion.startPositionCompanion.endPositionCompanion.heightCompanion.gravityCompanion.hopEventCompanion.NetFieldsCompanion.OwnerCompanion.PositionCompanion.OwnerPositionCompanion.IsLocal
Constructors
TrinketTinkerCompanion()
Argumentless constructor for netcode deserialization.
public TrinketTinkerCompanion()
TrinketTinkerCompanion(string, int)
Construct new companion using companion ID.
public TrinketTinkerCompanion(string companionId, int variant)
Parameters
Fields
_id
NetField for ID
protected readonly NetString _id
Field Value
- NetString
Properties
Anchor
Position the companion should follow.
public Vector2 Anchor { get; set; }
Property Value
- Vector2
BoundingBox
Bounding box of companion
public Rectangle BoundingBox { get; }
Property Value
- Rectangle
CompanionMoving
Whether companion is moving
public bool CompanionMoving { get; }
Property Value
CurrAnchorTarget
Getter and setter for override key
public AnchorTarget CurrAnchorTarget { get; set; }
Property Value
ID
Companion ID. Companion is (re)loaded when this is changed.
public string ID { get; }
Property Value
Motion
Motion class that controls how the companion moves.
public IMotion? Motion { get; }
Property Value
Offset
Current motion offset
public Vector2 Offset { get; }
Property Value
- Vector2
OneshotKey
Getter and setter for oneshot key
public string? OneshotKey { get; set; }
Property Value
OverrideKey
Getter and setter for override key
public string? OverrideKey { get; set; }
Property Value
OwnerMoving
Whether owner is moving and not using a tool
public bool OwnerMoving { get; }
Property Value
Speaker
public ChatterSpeaker? Speaker { get; }
Property Value
Methods
CleanupCompanion()
Cleanup Motion class.
public override void CleanupCompanion()
Draw(SpriteBatch)
Draw using Motion.
public override void Draw(SpriteBatch b)
Parameters
b
SpriteBatchSpriteBatch
Hop(float)
Vanilla hop event handler, not using.
public override void Hop(float amount)
Parameters
amount
float
InitNetFields()
Setup net fields.
public override void InitNetFields()
InitializeCompanion(Farmer)
Initialize Motion class.
public override void InitializeCompanion(Farmer farmer)
Parameters
farmer
Farmer
OnOwnerWarp()
Reset position and display status on warp
public override void OnOwnerWarp()
SetActiveAnchors(IEnumerable<string>)
Set active anchors list, based on ability types
public void SetActiveAnchors(IEnumerable<string> abilityTypes)
Parameters
abilityTypes
IEnumerable<string>
SetSpeechBubble(string?)
Set speech bubble key
public void SetSpeechBubble(string? speechBubbleKey)
Parameters
speechBubbleKey
string
Update(GameTime, GameLocation)
Do updates in Motion. The client of the player with the trinket is responsible for calculating position direction rotation. All clients must update animation frame.
public override void Update(GameTime time, GameLocation location)
Parameters
time
GameTimeGame time
location
GameLocationCurrent map location