use of org.terasology.logic.console.commandSystem.annotations.Command in project Anatomy by Terasology.
the class SkeletalSystem method healAllBones.
@Command(shortDescription = "Heal all bone parts to full health")
public String healAllBones(@Sender EntityRef client) {
EntityRef character = client.getComponent(ClientComponent.class).character;
BoneComponent boneComponent = character.getComponent(BoneComponent.class);
if (boneComponent != null) {
for (Map.Entry<String, PartSkeletalDetails> partSkeletalDetails : boneComponent.parts.entrySet()) {
partSkeletalDetails.getValue().health = partSkeletalDetails.getValue().maxHealth;
}
}
return "Healths fully restored.";
}
use of org.terasology.logic.console.commandSystem.annotations.Command in project Anatomy by Terasology.
the class SkeletalSystem method showBoneHealths.
@Command(shortDescription = "Show bone healths of all parts")
public String showBoneHealths(@Sender EntityRef client) {
EntityRef character = client.getComponent(ClientComponent.class).character;
BoneComponent boneComponent = character.getComponent(BoneComponent.class);
String result = "Bone healths :\n";
if (boneComponent != null) {
for (Map.Entry<String, PartSkeletalDetails> partSkeletalDetails : boneComponent.parts.entrySet()) {
result += partSkeletalDetails.getKey() + " :" + partSkeletalDetails.getValue().health + "/" + partSkeletalDetails.getValue().maxHealth + "\n";
}
}
return result;
}
use of org.terasology.logic.console.commandSystem.annotations.Command in project Anatomy by Terasology.
the class AnatomySystem method dmgAnatomyPart.
@Command(shortDescription = "Damage Anatomy part for amount")
public void dmgAnatomyPart(@CommandParam("name") String partName, @CommandParam("amount") int amount) {
for (EntityRef clientEntity : entityManager.getEntitiesWith(AnatomyComponent.class)) {
AnatomyComponent anatomyComponent = clientEntity.getComponent(AnatomyComponent.class);
AnatomyPartTag partTag = anatomyComponent.parts.get(partName);
if (partTag != null) {
clientEntity.send(new AnatomyPartImpactedEvent(amount, partTag));
}
}
}
use of org.terasology.logic.console.commandSystem.annotations.Command in project Anatomy by Terasology.
the class AnatomySystem method showAnatomyEffects.
@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;
}
use of org.terasology.logic.console.commandSystem.annotations.Command in project Terasology by MovingBlocks.
the class WorldRendererImpl method dagNodeCommand.
/**
* Acts as an interface between the console and the Nodes. All parameters passed to command are redirected to the
* concerned Nodes, which in turn take care of executing them.
*
* Usage:
* dagCommandNode <nodeUri> <command> <parameters>
*
* Example:
* dagNodeCommand engine:outputToScreenNode setFbo engine:fbo.ssao
*/
@Command(shortDescription = "Debugging command for DAG.", requiredPermission = PermissionManager.NO_PERMISSION)
public void dagNodeCommand(@CommandParam("nodeUri") final String nodeUri, @CommandParam("command") final String command, @CommandParam(value = "arguments") final String... arguments) {
Node node = renderGraph.findNode(nodeUri);
if (node == null) {
throw new RuntimeException(("No node is associated with URI '" + nodeUri + "'"));
}
node.handleCommand(command, arguments);
}
Aggregations