Skip to content

Commit

Permalink
tweaked naming
Browse files Browse the repository at this point in the history
  • Loading branch information
Marx Mustermann committed Jun 15, 2024
1 parent 9aaf30c commit 3e94e25
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
8 changes: 4 additions & 4 deletions src/itemFolder/military/shockTower.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ def showTargetingHud(self,params):
if key in ("enter","esc","lESC","rESC"):
return
if key == "w":
pos = self.Constrain_Within_Room((pos[0],pos[1]-1,0))
pos = self.constrain_within_room((pos[0],pos[1]-1,0))
if key == "a":
pos = self.Constrain_Within_Room((pos[0]-1,pos[1],0))
pos = self.constrain_within_room((pos[0]-1,pos[1],0))
if key == "s":
pos = self.Constrain_Within_Room((pos[0],pos[1]+1,0))
pos = self.constrain_within_room((pos[0],pos[1]+1,0))
if key == "d":
pos = self.Constrain_Within_Room((pos[0]+1,pos[1],0))
pos = self.constrain_within_room((pos[0]+1,pos[1],0))
if key == "r":
extraText = self.loadNearbyAmmo()
if key == ".":
Expand Down
15 changes: 8 additions & 7 deletions src/items.py
Original file line number Diff line number Diff line change
Expand Up @@ -984,15 +984,16 @@ def destroy(self, generateScrap=True):

# place scrap
container.addItems([(newItem,pos)])
def Constrain_Within_Room(self, pos):
def clamp(n, min, max):
if n < min:

def constrain_within_room(self, pos):
def clamp(n, min, max):
if n < min:
return min
elif n > max:
elif n > max:
return max
else:
return n
else:
return n

x = clamp(pos[0],1,11)
y = clamp(pos[1],1,11)
return x,y,pos[2]
Expand Down

0 comments on commit 3e94e25

Please sign in to comment.