QcProjectileDefinition Struct
A kind of projectile (decision E-425), from projectiles/<name>.json; server side only. More...
| Header: | #include <common/content/items/QcProjectileDefinition.h> |
Public Functions
Public Variables
| double | damage |
| double | despawnSeconds |
| double | drag |
| double | flightSeconds |
| bool | floats |
| double | gravity |
| QString | hitSound |
| QString | item |
| QString | name |
| QList<QcHitEffect> | onHit |
| double | size |
| QString | stickSound |
| bool | sticks |
| double | waterDrag |
Static Public Members
| const double | damageSpeed |
| const double | maxSpeed |
Detailed Description
Its flight is ballistic: gravity pulls it down and drag takes a share of its speed every second (more in water). A hit on a body does the effects of onHit (decision E-427; the arrow: damage per 20 m/s of speed, the reference's one block per tick, rounded up, and knockback); a hit on a block sticks it there when sticks and it does not break, where a player can pick it up again as its item until it despawns.
Member Function Documentation
bool QcProjectileDefinition::breaks() const
Returns whether it goes at a hit instead of bouncing off a body or sticking in a block; one that teleports its thrower (decision E-460) or splashes (decision E-624) always goes where it lands.
const QcHitEffect *QcProjectileDefinition::effect(const char *type) const
Returns the first effect of type in onHit, if any.
Member Variable Documentation
double QcProjectileDefinition::damage
Health points per damageSpeed of speed: the sum of the damage effects of onHit (0 without one).
const double QcProjectileDefinition::damageSpeed
The speed a hit of damage is measured at.
double QcProjectileDefinition::despawnSeconds
Seconds it stays stuck in a block before it goes ("despawnSeconds", 0 to 3600).
double QcProjectileDefinition::drag
Share of the speed lost per second in air, as the rate of an exponential decay (0.2: about 1 % per tick like the reference's arrows; "drag", 0 to 50).
double QcProjectileDefinition::flightSeconds
Seconds it may fly at most before it goes ("flightSeconds", 1 to 3600).
bool QcProjectileDefinition::floats
Rises to the surface of a liquid and rests there instead of sinking (a fishing rod's bobber, decision E-503; QcProjectileFlight::floatHeight).
double QcProjectileDefinition::gravity
m/s² downwards.
QString QcProjectileDefinition::hitSound
Sound key played when it hits a body ("hitSound"); empty for none.
QString QcProjectileDefinition::item
The item it is shot from (ammunition), drawn as and given back when picked up; also the look the client draws (QcMsg::EntitySpawn::item).
const double QcProjectileDefinition::maxSpeed
Fastest launch any launcher may give (m/s); the flight's sub-steps are sized for it.
QString QcProjectileDefinition::name
Qualified name ("name", required).
QList<QcHitEffect> QcProjectileDefinition::onHit
What a hit does, in order (decision E-427). Without "onHit" in the file: damage (damage) and knockback, the arrow's.
double QcProjectileDefinition::size
Edge of the box that hits bodies (m); blocks stop its centre.
QString QcProjectileDefinition::stickSound
Sound key played when it sticks in a block ("stickSound"); empty for none.
bool QcProjectileDefinition::sticks
Whether a hit on a block sticks it there ("sticks").
double QcProjectileDefinition::waterDrag
The same as drag while it is in a liquid ("waterDrag", 0 to 50).