Search in sources :

Example 36 with Command

use of org.terasology.logic.console.commandSystem.annotations.Command in project Terasology by MovingBlocks.

the class BindCommands method dvorak.

@Command(shortDescription = "Switches to typical keybinds for DVORAK", requiredPermission = PermissionManager.NO_PERMISSION)
public String dvorak() {
    bindsManager.linkBindButtonToKey(Keyboard.KeyId.COMMA, new SimpleUri("engine:forwards"));
    bindsManager.linkBindButtonToKey(Keyboard.KeyId.A, new SimpleUri("engine:left"));
    bindsManager.linkBindButtonToKey(Keyboard.KeyId.O, new SimpleUri("engine:backwards"));
    bindsManager.linkBindButtonToKey(Keyboard.KeyId.E, new SimpleUri("engine:right"));
    bindsManager.linkBindButtonToKey(Keyboard.KeyId.C, new SimpleUri("engine:inventory"));
    bindsManager.linkBindButtonToKey(Keyboard.KeyId.PERIOD, new SimpleUri("engine:useItem"));
    return "Changed key bindings to DVORAK keyboard layout.";
}
Also used : SimpleUri(org.terasology.engine.SimpleUri) Command(org.terasology.logic.console.commandSystem.annotations.Command)

Example 37 with Command

use of org.terasology.logic.console.commandSystem.annotations.Command in project Terasology by MovingBlocks.

the class BindCommands method neo.

@Command(shortDescription = "Switches to typical key binds for NEO 2 keyboard layout", requiredPermission = PermissionManager.NO_PERMISSION)
public String neo() {
    bindsManager.linkBindButtonToKey(Keyboard.KeyId.V, new SimpleUri("engine:forwards"));
    bindsManager.linkBindButtonToKey(Keyboard.KeyId.I, new SimpleUri("engine:backwards"));
    bindsManager.linkBindButtonToKey(Keyboard.KeyId.U, new SimpleUri("engine:left"));
    bindsManager.linkBindButtonToKey(Keyboard.KeyId.A, new SimpleUri("engine:right"));
    bindsManager.linkBindButtonToKey(Keyboard.KeyId.L, new SimpleUri("engine:useItem"));
    bindsManager.linkBindButtonToKey(Keyboard.KeyId.G, new SimpleUri("engine:inventory"));
    return "Changed key bindings to NEO 2 keyboard layout.";
}
Also used : SimpleUri(org.terasology.engine.SimpleUri) Command(org.terasology.logic.console.commandSystem.annotations.Command)

Example 38 with Command

use of org.terasology.logic.console.commandSystem.annotations.Command in project Terasology by MovingBlocks.

the class BindCommands method azerty.

@Command(shortDescription = "Switches to typical key binds for AZERTY", requiredPermission = PermissionManager.NO_PERMISSION)
public String azerty() {
    bindsManager.linkBindButtonToKey(Keyboard.KeyId.Z, new SimpleUri("engine:forwards"));
    bindsManager.linkBindButtonToKey(Keyboard.KeyId.S, new SimpleUri("engine:backwards"));
    bindsManager.linkBindButtonToKey(Keyboard.KeyId.Q, new SimpleUri("engine:left"));
    return "Changed key bindings to AZERTY keyboard layout.";
}
Also used : SimpleUri(org.terasology.engine.SimpleUri) Command(org.terasology.logic.console.commandSystem.annotations.Command)

Example 39 with Command

use of org.terasology.logic.console.commandSystem.annotations.Command in project Terasology by MovingBlocks.

the class AICommands method destroyAI.

/**
 * Destroys all entities with attached SimpleAIComponent or HierarchicalAIComponent in the world
 * @return String string containing number of simple AIs and hierarchical AIs destroyed
 */
@Command(runOnServer = true, shortDescription = "Destroys all AIs in the world")
public String destroyAI() {
    int simpleAI = 0;
    for (EntityRef ref : entityManager.getEntitiesWith(SimpleAIComponent.class)) {
        ref.destroy();
        simpleAI++;
    }
    int hierarchicalAI = 0;
    for (EntityRef ref : entityManager.getEntitiesWith(HierarchicalAIComponent.class)) {
        ref.destroy();
        hierarchicalAI++;
    }
    return "Simple AIs (" + simpleAI + ") Destroyed, Hierarchical AIs (" + hierarchicalAI + ") Destroyed ";
}
Also used : EntityRef(org.terasology.entitySystem.entity.EntityRef) Command(org.terasology.logic.console.commandSystem.annotations.Command)

Example 40 with Command

use of org.terasology.logic.console.commandSystem.annotations.Command in project Anatomy by Terasology.

the class AnatomySystem method dmgAnatomyPartAll.

@Command(shortDescription = "Damage ALL Anatomy parts for amount")
public void dmgAnatomyPartAll(@CommandParam("amount") int amount) {
    for (EntityRef clientEntity : entityManager.getEntitiesWith(AnatomyComponent.class)) {
        AnatomyComponent anatomyComponent = clientEntity.getComponent(AnatomyComponent.class);
        List<String> keys = new ArrayList<>(anatomyComponent.parts.keySet());
        for (String key : keys) {
            AnatomyPartTag partTag = anatomyComponent.parts.get(key);
            clientEntity.send(new AnatomyPartImpactedEvent(amount, partTag));
        }
    }
}
Also used : AnatomyPartTag(org.terasology.anatomy.component.AnatomyPartTag) AnatomyComponent(org.terasology.anatomy.component.AnatomyComponent) ArrayList(java.util.ArrayList) EntityRef(org.terasology.entitySystem.entity.EntityRef) AnatomyPartImpactedEvent(org.terasology.anatomy.event.AnatomyPartImpactedEvent) 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