public static void drawAggro(EntityWorld entityWorld, int entity, int targetEntity) { if (entityWorld.hasAllComponents(entity, AutoAttackComponent.class, IsAliveComponent.class)) { if (entityWorld.hasComponent(entity, AttackMoveComponent.class) || (!entityWorld.hasComponent(entity, MovementComponent.class))) { entityWorld.setComponent(entity, new AggroTargetComponent(targetEntity)); } } }
@Override public void execute( String optionString, EntityWorld entityWorld, Game game, GamePlayer gamePlayer) { try { String[] parameters = optionString.split(" "); if (parameters.length == 2) { float initialDuration = Float.parseFloat(parameters[0]); float deltaDurationPerTime = Float.parseFloat(parameters[1]); if ((initialDuration >= 0) && (deltaDurationPerTime >= 0)) { int playerDeathRulesEntity = entityWorld .getComponent(game.getMap().getEntity(), PlayerDeathRulesComponent.class) .getRulesEntity(); entityWorld.setComponent( playerDeathRulesEntity, new RespawnTimerComponent(initialDuration, deltaDurationPerTime)); } else { setResponseMessage("No negative death timers allowed"); } } } catch (NumberFormatException ex) { } }