Search in sources :

Example 1 with Command

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.";
}
Also used : BrokenBoneComponent(org.terasology.anatomy.AnatomySkeleton.component.BrokenBoneComponent) BoneComponent(org.terasology.anatomy.AnatomySkeleton.component.BoneComponent) PartSkeletalDetails(org.terasology.anatomy.component.PartSkeletalDetails) EntityRef(org.terasology.entitySystem.entity.EntityRef) ClientComponent(org.terasology.network.ClientComponent) HashMap(java.util.HashMap) Map(java.util.Map) Command(org.terasology.logic.console.commandSystem.annotations.Command)

Example 2 with Command

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;
}
Also used : BrokenBoneComponent(org.terasology.anatomy.AnatomySkeleton.component.BrokenBoneComponent) BoneComponent(org.terasology.anatomy.AnatomySkeleton.component.BoneComponent) PartSkeletalDetails(org.terasology.anatomy.component.PartSkeletalDetails) EntityRef(org.terasology.entitySystem.entity.EntityRef) ClientComponent(org.terasology.network.ClientComponent) HashMap(java.util.HashMap) Map(java.util.Map) Command(org.terasology.logic.console.commandSystem.annotations.Command)

Example 3 with Command

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));
        }
    }
}
Also used : AnatomyPartTag(org.terasology.anatomy.component.AnatomyPartTag) AnatomyComponent(org.terasology.anatomy.component.AnatomyComponent) EntityRef(org.terasology.entitySystem.entity.EntityRef) AnatomyPartImpactedEvent(org.terasology.anatomy.event.AnatomyPartImpactedEvent) Command(org.terasology.logic.console.commandSystem.annotations.Command)

Example 4 with Command

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;
}
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)

Example 5 with Command

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);
}
Also used : DeferredMainLightNode(org.terasology.rendering.dag.nodes.DeferredMainLightNode) PrePostCompositeNode(org.terasology.rendering.dag.nodes.PrePostCompositeNode) ShadowMapNode(org.terasology.rendering.dag.nodes.ShadowMapNode) OutlineNode(org.terasology.rendering.dag.nodes.OutlineNode) InitialPostProcessingNode(org.terasology.rendering.dag.nodes.InitialPostProcessingNode) BlurredAmbientOcclusionNode(org.terasology.rendering.dag.nodes.BlurredAmbientOcclusionNode) OpaqueBlocksNode(org.terasology.rendering.dag.nodes.OpaqueBlocksNode) AmbientOcclusionNode(org.terasology.rendering.dag.nodes.AmbientOcclusionNode) FinalPostProcessingNode(org.terasology.rendering.dag.nodes.FinalPostProcessingNode) UpdateExposureNode(org.terasology.rendering.dag.nodes.UpdateExposureNode) LightShaftsNode(org.terasology.rendering.dag.nodes.LightShaftsNode) AlphaRejectBlocksNode(org.terasology.rendering.dag.nodes.AlphaRejectBlocksNode) Node(org.terasology.rendering.dag.Node) DeferredPointLightsNode(org.terasology.rendering.dag.nodes.DeferredPointLightsNode) WorldReflectionNode(org.terasology.rendering.dag.nodes.WorldReflectionNode) ToneMappingNode(org.terasology.rendering.dag.nodes.ToneMappingNode) BufferClearingNode(org.terasology.rendering.dag.nodes.BufferClearingNode) HighPassNode(org.terasology.rendering.dag.nodes.HighPassNode) BloomBlurNode(org.terasology.rendering.dag.nodes.BloomBlurNode) OpaqueObjectsNode(org.terasology.rendering.dag.nodes.OpaqueObjectsNode) OutputToHMDNode(org.terasology.rendering.dag.nodes.OutputToHMDNode) LateBlurNode(org.terasology.rendering.dag.nodes.LateBlurNode) ApplyDeferredLightingNode(org.terasology.rendering.dag.nodes.ApplyDeferredLightingNode) BackdropReflectionNode(org.terasology.rendering.dag.nodes.BackdropReflectionNode) DownSamplerForExposureNode(org.terasology.rendering.dag.nodes.DownSamplerForExposureNode) HazeNode(org.terasology.rendering.dag.nodes.HazeNode) RefractiveReflectiveBlocksNode(org.terasology.rendering.dag.nodes.RefractiveReflectiveBlocksNode) SimpleBlendMaterialsNode(org.terasology.rendering.dag.nodes.SimpleBlendMaterialsNode) OutputToScreenNode(org.terasology.rendering.dag.nodes.OutputToScreenNode) BackdropNode(org.terasology.rendering.dag.nodes.BackdropNode) OverlaysNode(org.terasology.rendering.dag.nodes.OverlaysNode) MethodCommand(org.terasology.logic.console.commandSystem.MethodCommand) Command(org.terasology.logic.console.commandSystem.annotations.Command)

Aggregations

Command (org.terasology.logic.console.commandSystem.annotations.Command)76 ClientComponent (org.terasology.network.ClientComponent)48 EntityRef (org.terasology.entitySystem.entity.EntityRef)28 ConsoleCommand (org.terasology.logic.console.commandSystem.ConsoleCommand)16 Vector3f (org.terasology.math.geom.Vector3f)14 CharacterMovementComponent (org.terasology.logic.characters.CharacterMovementComponent)11 LocationComponent (org.terasology.logic.location.LocationComponent)10 DisplayNameComponent (org.terasology.logic.common.DisplayNameComponent)9 ResourceUrn (org.terasology.assets.ResourceUrn)8 Prefab (org.terasology.entitySystem.prefab.Prefab)6 CharacterTeleportEvent (org.terasology.logic.characters.CharacterTeleportEvent)6 SimpleUri (org.terasology.engine.SimpleUri)5 BlockFamily (org.terasology.world.block.family.BlockFamily)4 Map (java.util.Map)3 AnatomyComponent (org.terasology.anatomy.component.AnatomyComponent)3 SetMovementModeEvent (org.terasology.logic.characters.events.SetMovementModeEvent)3 DropItemEvent (org.terasology.logic.inventory.events.DropItemEvent)3 Method (java.lang.reflect.Method)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2