Beispiel #1
0
def create_item_potion(scene: Scene, hp: int = 100) -> Entity:
    entity: Entity = Entity()
    renderings: List[ComponentDialogRender] = [
        ComponentDialogRender(
            system_type=SystemPotion,
            entity_id=entity.get_uuid(),
            component=ComponentDialog,
            next_dialog=entity.get_uuid()
        )
    ]
    entity.add_component(ComponentItem(
        name=f"Зелье воставноления жизней {hp}",
        system_type=SystemPotion
    ))
    entity.add_component(ComponentDialog(renderings=renderings))
    entity.add_component(ComponentPotion(hp=hp))
    scene.add_entity(entity=entity)
    return entity
Beispiel #2
0
def new_entity_items(scene: Scene, player: Entity) -> UUID:
    entity: Entity = Entity(
        tags=["Items"]
    )
    renderings: List[ComponentDialogRender] = [
        ComponentDialogRender(
            system_type=SystemItem,
            entity_id=player.get_uuid(),
            component=ComponentInventory,
            next_dialog=player.get_uuid()
        ),
    ]
    dialog: ComponentDialog = ComponentDialog(
        renderings=renderings
    )
    entity.add_component(dialog)
    scene.add_entity(entity=entity)
    return entity.get_uuid()