Search in sources :

Example 1 with AnatomyStatusGatheringEvent

use of org.terasology.anatomy.event.AnatomyStatusGatheringEvent 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;
}
Also used : AnatomyStatusGatheringEvent(org.terasology.anatomy.event.AnatomyStatusGatheringEvent) AnatomyComponent(org.terasology.anatomy.component.AnatomyComponent) ArrayList(java.util.ArrayList) List(java.util.List) EntityRef(org.terasology.entitySystem.entity.EntityRef) ClientComponent(org.terasology.network.ClientComponent) Map(java.util.Map) Command(org.terasology.logic.console.commandSystem.annotations.Command)

Aggregations

ArrayList (java.util.ArrayList)1 List (java.util.List)1 Map (java.util.Map)1 AnatomyComponent (org.terasology.anatomy.component.AnatomyComponent)1 AnatomyStatusGatheringEvent (org.terasology.anatomy.event.AnatomyStatusGatheringEvent)1 EntityRef (org.terasology.entitySystem.entity.EntityRef)1 Command (org.terasology.logic.console.commandSystem.annotations.Command)1 ClientComponent (org.terasology.network.ClientComponent)1