don't dupe player on rename

This commit is contained in:
Waylon Walker 2023-07-01 13:57:46 -05:00
parent 85be664107
commit a665e1e31c
No known key found for this signature in database
GPG key ID: 66E2BF2B4190EFE4
2 changed files with 3 additions and 3 deletions

View file

@ -51,16 +51,15 @@ class Player:
self.joysticks = {}
def rename_hero(self):
old_hero = self.hero
hero = HeroFactory().build(
size=self.hero.size,
x=self.hero.x,
y=self.hero.y,
id=old_hero.id,
id=self.hero.id,
flashlight_strength=self.hero.flashlight_strength,
lanturn_strength=self.hero.lanturn_strength,
)
self.hero = HeroCreate(**hero.dict()).post()
self.hero = HeroUpdate(**hero.dict()).update()
def quit(self):
try:

View file

@ -89,6 +89,7 @@ class HeroUpdate(HeroBase):
)
if r.status_code != 200:
raise RuntimeError(f"{r.status_code}:\n {r.text}")
return Hero.parse_obj(r.json())
class HeroDelete(BaseModel):