-
Notifications
You must be signed in to change notification settings - Fork 6
Code Other Functions
Writes the data stored in the saveData
table to the savefile.
Instructs the game to recreate the respawn tables used for respawning entities.
Plays a Giant Book animation.
Takes the sprite's filename, the name of the animation that should be played and optionally the name of a anm2 file (uses giantbook.anm2
if it's not specified).
All files that are used need to be in /resources/gfx/ui/giantbook/
. If they are in a different folder that is in that directory, it needs to be specifies in the argument.
For Example:
Agony:AnimGiantBook("examplefolder/examplefile.png", "example", "custom.anm2")
This will play the example
animation from /resources/gfx/ui/giantbook/custom.anm2
with /resources/gfx/ui/giantbook/examplefolder/examplefile.png
as the sprite.
Typically called in a MC_POST_PLAYER_UPDATE
callback.
Takes the player
, the trans
table containing the costumeID
, hasItem
, requireditems
and Items
variables, the data
table which contains the saveData
table and a boolean value hasCostume
.
If more than 2 items from the trans.requireditems
table are in the player
's possession, it'll spawn a poof effect and add a NullCostume
with the id from trans.costumeID
to the player
, unless hasCostume
equals false
.
hasCostume
is used in case the code is already done, but the costume doesn't exists yet to avoid errors.
Takes an entity, which should have an id like 5.100.x
or else it wouldn't be a pedestal, and a Type
.
The Type
equals to the frame of the the Alternates
animation that will be played from gfx/Items/Pick Ups/Pedestals/animation.anm2
. For easier readable code, the enum Agony.Pedestals
has entries for these.
The optional arguments are a table that'll get written to the pedestal's EntityData
and an index
that can be given if you need to target a specific entry in the pedestalsToRender
table.
The Pedestal
, its EntityData
and it's type
are added to the pedestalsToRender
table to reload the custom animation if it gets unloaded e.g. when a different item is placed on it by the player.
Because nicalis failed to make EntityNPC::FireProjectiles()
work, we had to write a custom collision detection for EntityTear
objects and use those as enemy projectiles.
Returns a table with the following values:
t.TearFlags = 0
t.SpawnerEntity = nil
t.Height = -23 --default height
t.FallingAcceleration = 0
t.FallingSpeed = 0
t.Color = Color(1,1,1,1,0,0,0)
t.Data = {} --entity data
t.Scale = 1 --goes in 1/6 steps for the bigger tearsprite
t.Functions = {} --supported functions are onDeath, onUpdate and onHit
Takes a tear variant var
, tear subtype sub
, a firing position pos
, a velocity vel
and a tearConf
table containing other tear parameters.
Spawns a tearProj according to the passed parameters.
Takes the same arguments as Agony:fireTearProj()
with addition to an int num
, an RNG object rng
and optionally an overrideConf
table.
Spawns num
tearProjectiles with randomly rotated velocities, sizes and fallingspeeds. Randomized using the passed rng
.
overrideConf
can be used to override the default values of a monstro-like shot.
Takes the same arguments as Agony:fireTearProj()
and an optional overrideConf
table.
Spawns an explosive Ipecac tearProj.
overrideConf
can be used to override the default values of a ipecac-like shot.
Takes the same arguments as Agony:fireTearProj()
and an optional overrideConf
table.
Spawns a homing tearProj. Homes to the nearest player from the tear's position.
overrideConf
can be used to override the default values of a homing shot.
Spawns a circle of effects of the variant var
at the position pos
. size
determines the size of the circle.
ent
can be specified as the the spawner.
This is the most useful if var
is the variant of a creep effect.
!Do NOT make size
too high!
Copies all variables from originData
to targetData
.
Returns a Vector
pointing from sourcePos
to targetPos
with a length of multiplier
.
Takes the ent
whose velocity should be updated, a target
which the ent
will try to go to and a mul
that is the speed of the ent
.
Unlike Agony:calcTearVel()
this function makes sure that knockback and the fear status effect work.
Returns a the velocity as a Vector
.
Adds flags
to flagSource
and returns the value.
Checks if flagSource
has flags
.
Removes flags
from flagSource
and returns the value.