110 lines
1.9 KiB
Markdown
110 lines
1.9 KiB
Markdown
# IScriptEntity.unlockRotation
|
|
|
|
[← IScriptEntity](index.md) · [← Master](../../wiki.md)
|
|
|
|
Parça 3/17 · [önceki](unlockRotation-2.md) · [sonraki](unlockRotation-4.md)
|
|
|
|
var s = c.getSubject();
|
|
|
|
c.send("This entity's eye height is: " + s.getEyeHeight());
|
|
|
|
|
|
getWidth
|
|
|
|
float getWidth()
|
|
|
|
Get entity's current hitbox width (and depth, it's the same number).
|
|
|
|
getHeight
|
|
|
|
|
|
|
|
float getHeight()
|
|
|
|
Get entity's current hitbox height.
|
|
|
|
getHp
|
|
|
|
float getHp()
|
|
|
|
Get health points of this entity (20 is the max default for players).
|
|
|
|
var subject = c.getSubject();
|
|
|
|
if (subject.getHp() < 10)
|
|
{
|
|
subject.send("Man, you need to replenish your health!");
|
|
}
|
|
|
|
|
|
setHp
|
|
|
|
void setHp(float hp)
|
|
|
|
Set entity's health points. Given value that is more than max HP will get limited to max HP.
|
|
|
|
// If entity's health goes below 5 hearts, restore to max
|
|
var subject = c.getSubject();
|
|
|
|
if (subject.getHp() < 10)
|
|
{
|
|
subject.setHp(subject.getMaxHp());
|
|
}
|
|
|
|
|
|
getMaxHp
|
|
|
|
float getMaxHp()
|
|
|
|
Get maximum health points this entity can have.
|
|
|
|
var subject = c.getSubject();
|
|
|
|
subject.send(subject.getName() + " can have up to " + subject.getMaxHp() + " HP!");
|
|
|
|
|
|
setMaxHp
|
|
|
|
void setMaxHp(float hp)
|
|
|
|
Set entity's maximum health points.
|
|
|
|
var subject = c.getSubject();
|
|
subject.setMaxHp(100);
|
|
subject.send(subject.getName() + " can have up to " + subject.getMaxHp() + " HP!");
|
|
|
|
|
|
isInWater
|
|
|
|
boolean isInWater()
|
|
|
|
Check whether this entity is in water.
|
|
|
|
var subject = c.getSubject();
|
|
|
|
c.send("Is the entity in water? " + subject.isInWater());
|
|
|
|
|
|
isInLava
|
|
|
|
boolean isInLava()
|
|
|
|
Check whether this entity is in lava.
|
|
|
|
var subject = c.getSubject();
|
|
|
|
c.send("Is the entity in lava? " + subject.isInLava());
|
|
|
|
|
|
isBurning
|
|
|
|
boolean isBurning()
|
|
|
|
Check whether this entity is on fire.
|
|
|
|
var subject = c.getSubject();
|
|
|
|
// Extinguish the entity if it's on fire
|
|
if (subject.isBurning())
|
|
{
|