Skip to content

Commit

Permalink
actually save time
Browse files Browse the repository at this point in the history
fix assertions
  • Loading branch information
neph1 committed Jun 23, 2024
1 parent b781c57 commit 50db483
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions tale/llm/llm_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import os
import random
import shutil
from typing import List
from tale import parse_utils
from tale.base import Item, Living, Location
from tale.coord import Coord
Expand Down Expand Up @@ -61,13 +62,13 @@ def add_location(self, location: Location, zone: str = '') -> bool:
for zone in self._zones:
return self._zones[zone].add_location(location)

def races_for_zone(self, zone: str) -> [str]:
def races_for_zone(self, zone: str) -> List[str]:
return self._zones[zone].races

def items_for_zone(self, zone: str) -> [str]:
def items_for_zone(self, zone: str) -> List[str]:
return self._zones[zone].items

def zone_info(self, zone_name: str = '', location: str = '') -> dict():
def zone_info(self, zone_name: str = '', location: str = '') -> dict:
if not zone_name and location:
zone = self.find_zone(location)
else:
Expand Down Expand Up @@ -125,6 +126,8 @@ def save(self, save_name: str = '') -> None:
with open(os.path.join(save_path, 'world.json'), "w") as fp:
json.dump(story , fp, indent=4)

if self.driver:
self.config.epoch = self.driver.game_clock.clock.timestamp()
with open(os.path.join(save_path, 'story_config.json'), "w") as fp:
json.dump(parse_utils.save_story_config(self.config), fp, indent=4)

Expand Down Expand Up @@ -277,10 +280,10 @@ def add_creature(self, creature: dict) -> bool:
self._creatures.append(creature)
return True

def get_creatures(self) -> []:
def get_creatures(self) -> List[dict]:
return self._creatures

def get_items(self) -> []:
def get_items(self) -> List[dict]:
return self._items

def get_item(self, name: str) -> dict:
Expand Down
2 changes: 1 addition & 1 deletion tale/parse_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ def save_story_config(config: StoryConfig) -> dict:
json_file['context'] = config.context
json_file['custom_resources'] = config.custom_resources
json_file['image_gen'] = config.image_gen
json_file['epoch'] = config.epoch.timestamp() if config.epoch else None
json_file['epoch'] = config.epoch
json_file['day_night'] = config.day_night
return json_file

Expand Down

0 comments on commit 50db483

Please sign in to comment.