-
Notifications
You must be signed in to change notification settings - Fork 1
CustomSkills
/skill <name>
/skill learn <name>
/skill list [category]
/skill info <name>
/skill cancel
{
"Version": 0.1,
"Metadata": {
"Authors": "Autogenerated by CustomSkills plugin.",
"Remarks": "This file format is under active development. Do not rely on any properties being available in future versions."
},
"Data": [
{
"Category": "uncategorized",
"Skills": [
{
"Name": "TestSkill",
"Description": "This skill is just for testing!",
"PermissionsToLearn": ["derpy.mcderp"],
"PermissionsToUse": ["foo.bar"],
"TriggerWords" : ["tester"],
"NotifyUserOnCooldown": true,
"CooldownNotification": "",
"Levels": [
{
"ScriptPath": "TestSkill.boo",
"CastingCost": null,
"CastingDuration": "00:00:01",
"CastingCooldown": "00:00:01",
"ChargingCost": null,
"ChargingDuration": "00:00:03",
"ChargingCostInterval": "00:00:01",
"IsLongRunning": false,
"CanInterrupt": true,
"CanCasterMove": true,
"DamageRangeEstimate": "",
"UsesToLevelUp": 0
}
]
}
{
"Name": "RocketMan",
"Description": "Fires rockets in random modes.",
"PermissionsToLearn": [],
"PermissionsToUse": [],
"TriggerWords" : ["fire","rockets"],
"NotifyUserOnCooldown": true,
"CooldownNotification": "Rocket Launcher Online.",
"Levels": [
{
"ScriptPath": "RocketMan1.boo",
"CastingCost": {
"Hp" : 0,
"Mp" : 0,
"Exp": 10,
"Currency": "1Dollar,2Quarter"
},
"CastingDuration": "00:00:01",
"CastingCooldown": "00:00:03",
"ChargingCost": null,
"ChargingDuration": "00:00:05",
"ChargingCostInterval": "00:00:01",
"IsLongRunning": false,
"CanInterrupt": false,
"CanCasterMove": true,
"DamageRangeEstimate": "",
"UsesToLevelUp": 0
}
]
},void OnLevelUp(TSPlayer player) //called when the player advances his skill to this level or when he learns this skill.
void OnCancelled(TSPlayer player, SkillState state) //called when execution of the skill is cancelled in some way.
bool OnCast(TSPlayer player, SkillState state) //called continually while the skill is in the casting phase. This is a good place to initialize. Return true to continue, or false to cancel.
bool OnCharge(TSPlayer player, SkillState state) //called continually while the skill in the charging phase. This hook acts differently, depending on whether IsLongRunning is set. If IsLongRunning is false, returning false immediately cancels the skill usage. If IsLongRunning is true, returning false advances the skill to the firing phase, and true keeps the skill in OnCharge().
void OnFire(TSPlayer player, SkillState state) //called once when the skill reaches the fire phase. SkillState objects track the progress of a skill currently being used by a player. They can set and get user defined variables, and also maintain a list of EntityEmitters in use. SkillStates are only used for a single run, and do not get recycled between skill usages.
float Progress { get; } //gets the completion percentage of the current phase.
TimeSpan ElapsedTime { get; }//gets the elapsed time of the current phase.
List<EntityEmitter> Emitters { get; set; } //gets the list of attached EntityEmitters.
bool HasVariable(string variableName) //gets whether this SkillState has a user variable declared with the given name.
EntityEmitter AddEmitter() //adds a new Emitter, with the player using the skill as the parent.
EntityEmitter AddEmitter(TSPlayer player) //adds a new emitter, with the given player as the parent.
EntityEmitter AddEmitter(Entity entity) //adds a new emitter, with the given Entity(aka Player,NPC,Projectile,Item) as the parent.EntityEmitter objects are typically used to spawn projectiles at specified intervals, while handling position and/or targeting. However, they are more general purpose than just spawning projectiles and can run arbitrary code in the Emit event.
Note: Currently, EntityEmitters will stop once the skill has stopped running. However, in the future, emitters may optionally continue after the skill is stopped( for lingering spells, and effects ). Some plumbing is already in place, and shouldn't be too hard to enable.
Terraria.Entity Parent { get; set; } //the parent Player, NPC, Projectile, or Item.
Vector2 Position //the 'world' position of the emitter. If UseRelativePositioning is enabled, this position is calculated in Update() and should not be modified by your code.
Vector2 RelativePosition //an offset vector from Parent's position, if UseRelativePositioning is enabled.
/// <summary>
/// A vector representing the intended target.
/// </summary>
Vector2 Target
///<summary>
/// An optional offset vector from Position, which can be used during Emit.
/// </summary>
Vector2 EmitOffset
/// <summary>
/// An optional scalar for that can be multiplied against Direction, for a final velocity vector.
/// </summary>
float EmitVelocity
/// <summary>
/// Gets or sets whether this EntityEmitter's position is automatically moved relative to its Parent.
/// </summary>
bool UseRelativePositioning { get; set; }
/// <summary>
/// Gets or sets whether this EntityEmitter's target is relative or absolute.
/// </summary>
bool UseRelativeTarget { get; set; }
/// <summary>
/// Gets or sets if this emitter will continue to function with no parent, or if parent is no longer active.
/// </summary>
bool CanOutliveParent { get; set; } //Allows an Emitter to continue if its Parent is null or not active. Not fully implemented yet.
bool IsActive { get; } //If this Emitter is still working. Note that once an emitter is done, its done for good.
TimeSpan Lifetime //How long this Emitter will stay active.
TimeSpan Cooldown //time between Emit's
DateTime LastEmitTime
DateTime CreationTime
/// <summary>
/// Gets or sets an optional string for identification. This is only for user convenience, and not used by any code.
/// </summary>
string Name { get; set; }
void Destroy() //Currently, this disables the emitter, but DOES NOT delete or remove the emitter in anyway.
void Update() //this must be called each tick, for emitters to work. Here they manage their lifetime, positioning and spawning.
void SetTarget(float x, float y, bool relativeTarget) //sets the target vector the emitter aims for. If relativeTarget is true, this vector will be an offset from the Emitter's final position and act as if its attached to the emitter. If false, the target is in world coords, and the emitter will continually aim towards it.
void SetAngle(float angleDegrees) //sets a relative target vector pointing in the specified direction.
void FaceUp() // same as SetTarget(0, -1, true)
void FaceDown() // => SetTarget(0, 1, true)
void FaceRight() // => SetTarget(1, 0, true)
void FaceLeft() // => SetTarget(-1, 0, true)
void FaceTopLeft() // => SetTarget(-1, -1, true)
void FaceTopRight() // => SetTarget(1, -1, true)
void FaceBottomRight() // => SetTarget(1, 1, true)
void FaceBottomLeft() // => SetTarget(-1, 1, true)
event Action<EntityEmitter> Emit //event that is fired periodically to spawn projectiles, or run other code.A number of extensions methods (will) exist that make working with collections of EntityEmitters easier.
CustomProjectile EntityEmitter.SpawnCustomProjectile(string projectileName) //attempts to spawn a CustomProjectile, using the emitters parameters.
IEnumerable<EntityEmitter>.Update() //updates a collection of emitters in one call.Proposed extension methods:
CreateEmitterArray(columns,rows) //creates a uniform grid of emitters
CreateEmitterCircle(xRadius,yRadius,count) //creates an ellipse composed of emitters
SetTarget() //set target for collections
FaceXXX() //face direction for collections
Rotate() //rotate collection of emitters... in example, rotate a grid of emitters by an angle
Orbit() //orbit the parent