summaryrefslogtreecommitdiff
path: root/asciifarm/client
diff options
context:
space:
mode:
Diffstat (limited to 'asciifarm/client')
-rw-r--r--asciifarm/client/display/fieldpad.py4
-rw-r--r--asciifarm/client/display/healthpad.py8
-rw-r--r--asciifarm/client/display/infopad.py4
-rw-r--r--asciifarm/client/display/inventorypad.py4
-rw-r--r--asciifarm/client/display/messagepad.py4
5 files changed, 14 insertions, 10 deletions
diff --git a/asciifarm/client/display/fieldpad.py b/asciifarm/client/display/fieldpad.py
index 3196eff..01bf6e4 100644
--- a/asciifarm/client/display/fieldpad.py
+++ b/asciifarm/client/display/fieldpad.py
@@ -35,8 +35,8 @@ class FieldPad:
def getHeight(self):
return self.size[1]
- def update(self, screen, x, y, xmax, ymax):
- if not self.changed and (x, y, xmax, ymax) == self.lastView or xmax <= x or ymax <= y:
+ def update(self, screen, x, y, xmax, ymax, force=False):
+ if not self.changed and (x, y, xmax, ymax) == self.lastView or xmax <= x or ymax <= y and not force:
return
self.lastView = (x, y, xmax, ymax)
self.changed = False
diff --git a/asciifarm/client/display/healthpad.py b/asciifarm/client/display/healthpad.py
index d4ee3f8..502559a 100644
--- a/asciifarm/client/display/healthpad.py
+++ b/asciifarm/client/display/healthpad.py
@@ -15,6 +15,10 @@ class HealthPad:
self.maxHealth = 0
def setHealth(self, health, maxHealth):
+ self.health = health
+ self.maxHealth = maxHealth
+
+
self.pad.erase()
barEnd = round(health/maxHealth * self.width)
self.pad.addstr(0,0,"Health: {}/{}".format(health, maxHealth)[:self.width])
@@ -30,8 +34,8 @@ class HealthPad:
def getHeight(self):
return 2
- def update(self, screen, x, y, xmax, ymax):
- if not self.changed and (x, y, xmax, ymax) == self.lastView or xmax <= x or ymax <= y:
+ def update(self, screen, x, y, xmax, ymax, force=False):
+ if not self.changed and (x, y, xmax, ymax) == self.lastView or xmax <= x or ymax <= y and not force:
return
self.lastView = (x, y, xmax, ymax)
self.changed = False
diff --git a/asciifarm/client/display/infopad.py b/asciifarm/client/display/infopad.py
index b3d900e..564d6d4 100644
--- a/asciifarm/client/display/infopad.py
+++ b/asciifarm/client/display/infopad.py
@@ -18,8 +18,8 @@ class InfoPad:
self.pad.addstr(0,0,string)
self.changed = True
- def update(self, screen, x, y, xmax, ymax):
- if not self.changed and (x, y, xmax, ymax) == self.lastView or xmax <= x or ymax <= y:
+ def update(self, screen, x, y, xmax, ymax, force=False):
+ if not self.changed and (x, y, xmax, ymax) == self.lastView or xmax <= x or ymax <= y and not force:
return
self.lastView = (x, y, xmax, ymax)
self.changed = False
diff --git a/asciifarm/client/display/inventorypad.py b/asciifarm/client/display/inventorypad.py
index e81f9de..f10b138 100644
--- a/asciifarm/client/display/inventorypad.py
+++ b/asciifarm/client/display/inventorypad.py
@@ -22,8 +22,8 @@ class InventoryPad:
def getHeight(self):
return self.maxItems+2
- def update(self, screen, x, y, xmax, ymax):
- if not self.changed and (x, y, xmax, ymax) == self.lastView or xmax <= x or ymax <= y:
+ def update(self, screen, x, y, xmax, ymax, force=False):
+ if not self.changed and (x, y, xmax, ymax) == self.lastView or xmax <= x or ymax <= y and not force:
return
self.lastView = (x, y, xmax, ymax)
self.changed = False
diff --git a/asciifarm/client/display/messagepad.py b/asciifarm/client/display/messagepad.py
index ab3afab..7d22f2f 100644
--- a/asciifarm/client/display/messagepad.py
+++ b/asciifarm/client/display/messagepad.py
@@ -18,8 +18,8 @@ class MessagePad():
def getHeight(self):
return self.maxLines
- def update(self, screen, x, y, xmax, ymax):
- if not self.changed and (x, y, xmax, ymax) == self.lastView or xmax <= x or ymax <= y:
+ def update(self, screen, x, y, xmax, ymax, force=False):
+ if not self.changed and (x, y, xmax, ymax) == self.lastView or xmax <= x or ymax <= y and not force:
return
width = xmax - x
height = ymax - y # should equal self.getHeight()