Example #1
0
   def try_transform_miner_full(world, entity):
       new_entity = entities.MinerNotFull(
          entities.get_name(entity), entities.get_resource_limit(entity),
          entities.get_position(entity), entities.get_rate(entity),
          entities.get_images(entity), entities.get_animation_rate(entity))

       return new_entity
Example #2
0
    def action(current_ticks):
        entities.remove_pending_action(entity, action)

        entity_pt = entities.get_position(entity)
        vein = worldmodel.find_nearest(world, entity_pt, entities.Vein)
        (tiles, found) = blob_to_vein(world, entity, vein)

        next_time = current_ticks + entities.get_rate(entity)
        if found:
            quake = create_quake(world, tiles[0], current_ticks, i_store)
            worldmodel.add_entity(world, quake)
            next_time = current_ticks + entities.get_rate(entity) * 2

        schedule_action(world, entity,
                        create_ore_blob_action(world, entity, i_store),
                        next_time)

        return tiles
Example #3
0
       def action(current_ticks):
          entities.remove_pending_action(entity, action)

          entity_pt = entities.get_position(entity)
          vein = find_nearest(world, entity_pt, entities.Vein)
          (tiles, found) = entity.blob_to_vein(world, entity, vein)

          next_time = current_ticks + entities.get_rate(entity)
          if found:
             quake = world.create_quake(world, tiles[0], current_ticks, i_store)
             add_entity(world, quake)
             next_time = current_ticks + entities.get_rate(entity) * 2

          schedule_action(world, entity,
             world.create_ore_blob_action(world, entity, i_store),
             next_time)

          return tiles
Example #4
0
    def try_transform_miner_full(world, entity):
        new_entity = entities.MinerNotFull(entities.get_name(entity),
                                           entities.get_resource_limit(entity),
                                           entities.get_position(entity),
                                           entities.get_rate(entity),
                                           entities.get_images(entity),
                                           entities.get_animation_rate(entity))

        return new_entity
Example #5
0
 def try_transform_miner_not_full(world, entity):
     if entity.resource_count < entity.resource_limit:
        return entity
     else:
        new_entity = entities.MinerFull(
           entities.get_name(entity), entities.get_resource_limit(entity),
           entities.get_position(entity), entities.get_rate(entity),
           entities.get_images(entity), entities.get_animation_rate(entity))
        return new_entity
Example #6
0
 def try_transform_miner_not_full(world, entity):
     if entity.resource_count < entity.resource_limit:
         return entity
     else:
         new_entity = entities.MinerFull(
             entities.get_name(entity), entities.get_resource_limit(entity),
             entities.get_position(entity), entities.get_rate(entity),
             entities.get_images(entity),
             entities.get_animation_rate(entity))
         return new_entity
Example #7
0
       def action(current_ticks):
          entities.remove_pending_action(entity, action)
          blob = world.create_blob(world, entities.get_name(entity) + " -- blob",
             entities.get_position(entity),
             entities.get_rate(entity),
             current_ticks, i_store)

          remove_entity(world, entity)
          add_entity(world, blob)

          return [entities.get_position(blob)]
Example #8
0
   def action(current_ticks):
      entities.remove_pending_action(entity, action)
      blob = create_blob(world, entities.get_name(entity) + " -- blob",
         entities.get_position(entity),
         entities.get_rate(entity) // BLOB_RATE_SCALE,
         current_ticks, i_store)

      remove_entity(world, entity)
      worldmodel.add_entity(world, blob)

      return [entities.get_position(blob)]
Example #9
0
    def action(current_ticks):
        entities.remove_pending_action(entity, action)
        blob = create_blob(world,
                           entities.get_name(entity) + " -- blob",
                           entities.get_position(entity),
                           entities.get_rate(entity) // BLOB_RATE_SCALE,
                           current_ticks, i_store)

        remove_entity(world, entity)
        worldmodel.add_entity(world, blob)

        return [entities.get_position(blob)]
Example #10
0
        def action(current_ticks):
            entities.remove_pending_action(entity, action)
            blob = world.create_blob(world,
                                     entities.get_name(entity) + " -- blob",
                                     entities.get_position(entity),
                                     entities.get_rate(entity), current_ticks,
                                     i_store)

            remove_entity(world, entity)
            add_entity(world, blob)

            return [entities.get_position(blob)]
Example #11
0
   def action(current_ticks):
      entities.remove_pending_action(entity, action)

      entity_pt = entities.get_position(entity)
      ore = worldmodel.find_nearest(world, entity_pt, entities.Ore)
      (tiles, found) = miner_to_ore(world, entity, ore)

      new_entity = entity
      if found:
         new_entity = try_transform_miner(world, entity,
            try_transform_miner_not_full)

      schedule_action(world, new_entity,
         create_miner_action(world, new_entity, i_store),
         current_ticks + entities.get_rate(new_entity))
      return tiles
Example #12
0
       def action(current_ticks):
          entities.remove_pending_action(entity, action)

          entity_pt = entities.get_position(entity)
          smith = find_nearest(world, entity_pt, entities.Blacksmith)
          (tiles, found) = entity.miner_to_smith(world, entity, smith)

          new_entity = entity
          if found:
             new_entity = world.try_transform_miner(world, entity,
                world.try_transform_miner_full)

          schedule_action(world, new_entity,
             world.create_miner_action(world, new_entity, i_store),
             current_ticks + entities.get_rate(new_entity))
          return tiles
Example #13
0
    def action(current_ticks):
        entities.remove_pending_action(entity, action)

        entity_pt = entities.get_position(entity)
        smith = worldmodel.find_nearest(world, entity_pt, entities.Blacksmith)
        (tiles, found) = miner_to_smith(world, entity, smith)

        new_entity = entity
        if found:
            new_entity = try_transform_miner(world, entity,
                                             try_transform_miner_full)

        schedule_action(world, new_entity,
                        create_miner_action(world, new_entity, i_store),
                        current_ticks + entities.get_rate(new_entity))
        return tiles
Example #14
0
        def action(current_ticks):
            entities.remove_pending_action(entity, action)

            entity_pt = entities.get_position(entity)
            ore = find_nearest(world, entity_pt, entities.Ore)
            (tiles, found) = entity.miner_to_ore(world, entity, ore)

            new_entity = entity
            if found:
                new_entity = world.try_transform_miner(
                    world, entity, world.try_transform_miner_not_full)

            schedule_action(
                world, new_entity,
                world.create_miner_action(world, new_entity, i_store),
                current_ticks + entities.get_rate(new_entity))
            return tiles
Example #15
0
    def action(current_ticks):
        entities.remove_pending_action(entity, action)

        open_pt = find_open_around(world, entities.get_position(entity),
                                   entities.get_resource_distance(entity))
        if open_pt:
            ore = create_ore(
                world, "ore - " + entities.get_name(entity) + " - " +
                str(current_ticks), open_pt, current_ticks, i_store)
            worldmodel.add_entity(world, ore)
            tiles = [open_pt]
        else:
            tiles = []

        schedule_action(world, entity,
                        create_vein_action(world, entity, i_store),
                        current_ticks + entities.get_rate(entity))
        return tiles
Example #16
0
       def action(current_ticks):
          entities.remove_pending_action(entity, action)

          open_pt = world.find_open_around(world, entities.get_position(entity),
             entities.get_resource_distance(entity))
          if open_pt:
             ore = world.create_ore(world,
                "ore - " + entities.get_name(entity) + " - " + str(current_ticks),
                open_pt, current_ticks, i_store)
             add_entity(world, ore)
             tiles = [open_pt]
          else:
             tiles = []

          schedule_action(world, entity,
             world.create_vein_action(world, entity, i_store),
             current_ticks + entities.get_rate(entity))
          return tiles
Example #17
0
 def schedule_miner(world, miner, ticks, i_store):
      schedule_action(world, miner, world.create_miner_action(world, miner, i_store),
      ticks + entities.get_rate(miner))
      miner.schedule_animation(world, miner)
Example #18
0
 def schedule_vein(world, vein, ticks, i_store):
     schedule_action(world, vein,
                     world.create_vein_action(world, vein, i_store),
                     ticks + entities.get_rate(vein))
Example #19
0
 def schedule_miner(world, miner, ticks, i_store):
     schedule_action(world, miner,
                     world.create_miner_action(world, miner, i_store),
                     ticks + entities.get_rate(miner))
     miner.schedule_animation(world, miner)
Example #20
0
 def schedule_ore(world, ore, ticks, i_store):
     schedule_action(world, ore,
                     world.create_ore_transform_action(world, ore, i_store),
                     ticks + entities.get_rate(ore))
Example #21
0
 def schedule_blob(world, blob, ticks, i_store):
     schedule_action(world, blob,
                     world.create_ore_blob_action(world, blob, i_store),
                     ticks + entities.get_rate(blob))
     blob.schedule_animation(world, blob)
Example #22
0
 def schedule_blob(world, blob, ticks, i_store):
      schedule_action(world, blob, world.create_ore_blob_action(world, blob, i_store),
      ticks + entities.get_rate(blob))
      blob.schedule_animation(world, blob)
Example #23
0
 def schedule_ore(world, ore, ticks, i_store):
     schedule_action(world, ore,
        world.create_ore_transform_action(world, ore, i_store),
        ticks + entities.get_rate(ore))
Example #24
0
 def schedule_vein(world, vein, ticks, i_store):
     schedule_action(world, vein, world.create_vein_action(world, vein, i_store),
        ticks + entities.get_rate(vein))