Skip to main content

PickupBasedSkillModifier

An abstract class in Root.Township, the global namespace.

Base for a skill that changes how a held tool's skill works while active, for example a charged attack. Registers with the player's PlayerToolBasedSkillHelper when learnt and syncs its status (charging, charged, consumed, cancelled) to other clients.

Constructors​

MemberWhat it is
protected PickupBasedSkillModifier()Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets.

Fields​

MemberWhat it is
protected uint pickupIdentifierEntity identifier of the pickup in the last status message.
protected ToolBasedSkillStatus statusThe status in the last message.
3 private and internal fields
MemberWhat it is
private SkillInputStructure inputStructureInput needed to trigger the modifier.
private bool isExclusiveWhen true, activating this modifier turns off the other modifiers on the held pickup.
private PickupBasedSkill modifiedSkillThe pickup based skill this modifier changes.

Properties​

MemberWhat it is
PickupBasedSkill ModifiedSkill { get; }The pickup skill this modifier changes.
2 private and internal properties
MemberWhat it is
private SkillInputStructure IInputBasedSkill.InputStructure { get; }Returns inputStructure.
private ProfessionSkill IInputBasedSkill.Skill { get; }Returns this skill.

Methods​

MemberWhat it is
virtual void Deregister(ISkillInputMethod input)Hook for when the modifier is removed from a held pickup. Does nothing by default.
virtual void ExecuteWithHit(HeldPickupHandler handler, ImpactHitWithTool hitWithTool, bool hasHit)Hook for when the tool hits something while modified. Does nothing by default.
virtual void InputChangedState(bool isActive, ISkillInputMethod input)When the input turns on: marks it charged, applies Modify, turns off other modifiers if exclusive, and syncs.
override void Lock(PlayerProgressionManager targetPlayer)Removes the skill and deregisters it from the tool skill helper when its level drops to 0.
virtual void Register(ISkillInputMethod input)Hook for when the modifier is added to a held pickup. Does nothing by default.
void RequiredSetActive(bool isActive, ISkillInputMethod input)Turns the input on next frame, or cancels the skill, syncs and deregisters it.
void SendCancelled(NetworkEntity entity, Player player)Marks the skill cancelled for a pickup and syncs it.
void SendChargingStarted(NetworkEntity entity, Player player)Marks the skill as charging for a pickup and syncs it.
void SendConsumed(NetworkEntity entity, Player player)Marks the skill used up for a pickup, syncs it and executes the skill for the player.
override void SendSerializedMessage(IPlayer player, Stream stream)Writes or reads the pickup and status. Clients then play or release the tool effect.
override void Unlock(PlayerProgressionManager targetPlayer)Adds the skill and registers it with the tool skill helper at level 1.
virtual bool ValidateExecutionHit(ProgressionPath path, ImpactHitWithTool hitWithTool)Whether a hit counts as executing this skill. False by default.
virtual bool ValidatePickup(HeldPickupHandler pickupHandler)Whether the skill can apply to a held pickup. True by default.
protected virtual void ActivatedOnRemote()Hook run on other clients when the skill's status message arrives.
protected virtual uint GetIdentifier(ISkillInputMethod input)Entity identifier of the pickup the skill applies to; by default the held pickup.
protected virtual void HandleSkillStatus(IPlayer player, NetworkEntity entity, ToolBasedSkillStatus status)Hook run on clients with the synced status and pickup entity.
protected abstract void Modify(ISkillInputMethod input)Applies the change to the held pickup's skill. Implement in subclasses.

Used in​

Members of other types that take, return or hold a PickupBasedSkillModifier: