use of org.terasology.engine.entitySystem.entity.EntityRef in project Anatomy by Terasology.
the class CirculatorySystem method showCirculatoryHealths.
@Command(shortDescription = "Show circulatory healths of all injured parts")
public String showCirculatoryHealths(@Sender EntityRef client) {
EntityRef character = client.getComponent(ClientComponent.class).character;
InjuredCirculatoryComponent injuredCirculatoryComponent = character.getComponent(InjuredCirculatoryComponent.class);
String result = "";
if (injuredCirculatoryComponent != null) {
result += "Blood level : ";
result += injuredCirculatoryComponent.bloodLevel + "/" + injuredCirculatoryComponent.maxBloodLevel + " Blood regen rate: " + injuredCirculatoryComponent.bloodRegenRate + "\n";
result += "Circulatory system healths :\n";
for (Map.Entry<String, PartHealthDetails> partHealthDetailsEntry : injuredCirculatoryComponent.partHealths.entrySet()) {
result += partHealthDetailsEntry.getKey() + " :" + partHealthDetailsEntry.getValue().health + "/" + partHealthDetailsEntry.getValue().maxHealth + "\n";
}
} else {
result += "Circulatory system healthy.\n";
}
return result;
}
use of org.terasology.engine.entitySystem.entity.EntityRef in project Anatomy by Terasology.
the class SkeletalSystem method healAllBones.
/**
* Console command - Heals all parts' skeletal healths to max.
*/
@Command(shortDescription = "Heal all bone parts to full health")
public String healAllBones(@Sender EntityRef client) {
EntityRef character = client.getComponent(ClientComponent.class).character;
InjuredBoneComponent injuredBoneComponent = character.getComponent(InjuredBoneComponent.class);
if (injuredBoneComponent != null) {
for (Map.Entry<String, PartHealthDetails> partHealthDetailsEntry : injuredBoneComponent.partHealths.entrySet()) {
partHealthDetailsEntry.getValue().health = partHealthDetailsEntry.getValue().maxHealth;
character.send(new BoneHealthChangedEvent(partHealthDetailsEntry.getKey()));
}
}
return "Skeletal healths fully restored.";
}
use of org.terasology.engine.entitySystem.entity.EntityRef in project Anatomy by Terasology.
the class SkeletalSystem method showBoneHealths.
/**
* Console command - Shows the skeletal healths of injured parts.
*/
@Command(shortDescription = "Show bone healths of all injured parts")
public String showBoneHealths(@Sender EntityRef client) {
EntityRef character = client.getComponent(ClientComponent.class).character;
InjuredBoneComponent injuredBoneComponent = character.getComponent(InjuredBoneComponent.class);
String result = "";
if (injuredBoneComponent != null) {
result += "Bone healths :\n";
for (Map.Entry<String, PartHealthDetails> partHealthDetailsEntry : injuredBoneComponent.partHealths.entrySet()) {
result += partHealthDetailsEntry.getKey() + " :" + partHealthDetailsEntry.getValue().health + "/" + partHealthDetailsEntry.getValue().maxHealth + "\n";
}
} else {
result += "Skeletal system healthy.\n";
}
return result;
}
use of org.terasology.engine.entitySystem.entity.EntityRef in project Anatomy by Terasology.
the class AnatomySystem method dmgAnatomyPart.
/**
* Console command - Damages a particular anatomy part for a given amount.
*/
@Command(shortDescription = "Damage Anatomy part for amount")
public String dmgAnatomyPart(@Sender EntityRef entityRef, @CommandParam("name") String partName, @CommandParam("amount") int amount) {
EntityRef clientEntity = entityRef.getComponent(ClientComponent.class).character;
AnatomyComponent anatomyComponent = clientEntity.getComponent(AnatomyComponent.class);
AnatomyPartTag partTag = anatomyComponent.parts.get(partName);
if (partTag != null) {
clientEntity.send(new AnatomyPartImpactedEvent(amount, partTag));
return "Inflicted " + amount + " damage to " + getAnatomyNameFromID(partTag.id, anatomyComponent);
} else {
return "No such part found.";
}
}
use of org.terasology.engine.entitySystem.entity.EntityRef in project Anatomy by Terasology.
the class AnatomySystem method showAnatomyEffects.
/**
* Console command - Shows a list of anatomy effects on each part.
*/
@Command(shortDescription = "Lists anatomy effects on all parts")
public String showAnatomyEffects(@Sender EntityRef client) {
EntityRef character = client.getComponent(ClientComponent.class).character;
String result = "Anatomy effects:\n";
AnatomyStatusGatheringEvent event = new AnatomyStatusGatheringEvent();
character.send(event);
Map<String, List<String>> partEffects = event.getEffectsMap();
for (Map.Entry<String, List<String>> partEntry : partEffects.entrySet()) {
result += getAnatomyNameFromID(partEntry.getKey(), character.getComponent(AnatomyComponent.class)) + ": ";
for (String partEffect : partEntry.getValue()) {
result += partEffect + ", ";
}
result += "\n";
}
return result;
}
Aggregations