Files
tamagotchi-multiplayer/imp.py
T
2026-10-02 22:07:25 +03:00

34 lines
695 B
Python

from dataclasses import dataclass, field
from components import (
Health,
Satiety,
Location,
LocationType,
Name,
Hydration,
Hygiene,
Tags,
)
from ecs import World
def create_pet(world: World, name: str):
return world.spawn(
Name(name),
Health(100),
Satiety(80),
Hydration(80),
Hygiene(80),
Tags(),
)
def move_pet_to(world: World, pet_id, container_entity=None) -> bool:
component_map = world.get_components(pet_id, pop=True)
if component_map is None:
return False
component_map[Location].id = container_entity
component_map[Location].type = LocationType.PADDOCK
return True