use of org.terasology.engine.logic.console.commandSystem.annotations.Command in project Anatomy by Terasology.
the class CirculatorySystem method healAllCirculation.
@Command(shortDescription = "Heal all circulatory system parts to full health")
public String healAllCirculation(@Sender EntityRef client) {
EntityRef character = client.getComponent(ClientComponent.class).character;
InjuredCirculatoryComponent injuredCirculatoryComponent = character.getComponent(InjuredCirculatoryComponent.class);
if (injuredCirculatoryComponent != null) {
for (Map.Entry<String, PartHealthDetails> partHealthDetailsEntry : injuredCirculatoryComponent.partHealths.entrySet()) {
partHealthDetailsEntry.getValue().health = partHealthDetailsEntry.getValue().maxHealth;
character.send(new PartCirculatoryHealthChangedEvent(partHealthDetailsEntry.getKey()));
}
}
return "Circulatory healths fully restored.";
}
use of org.terasology.engine.logic.console.commandSystem.annotations.Command in project Anatomy by Terasology.
the class AnatomySystem method dmgAnatomyPartAll.
/**
* Console command - Damages all anatomy parts for a given amount.
*/
@Command(shortDescription = "Damage ALL Anatomy parts for amount")
public String dmgAnatomyPartAll(@Sender EntityRef entityRef, @CommandParam("amount") int amount) {
EntityRef clientEntity = entityRef.getComponent(ClientComponent.class).character;
AnatomyComponent anatomyComponent = clientEntity.getComponent(AnatomyComponent.class);
List<String> keys = new ArrayList<>(anatomyComponent.parts.keySet());
String result = "";
for (String key : keys) {
result += "Inflicted " + amount + " damage to " + getAnatomyNameFromID(key, anatomyComponent) + "\n";
AnatomyPartTag partTag = anatomyComponent.parts.get(key);
clientEntity.send(new AnatomyPartImpactedEvent(amount, partTag));
}
return result;
}
Aggregations