Initial commit
This commit is contained in:
1 parent
afe548e9f8
commit
e4184b7cde
7 files changed
+213
-17
No files matched your search
@@ -0,0 +1,33 @@
|
||||
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
|
||||
Reference in new issue
Block a user