Skip to content

Commit

Permalink
interact look and look_at unhackified
Browse files Browse the repository at this point in the history
interact.look now does what you expect it to do, if you pass it a pitch and yaw it will do what you tell it to no matter what. interact.look_at now handles being right on top of its target better
  • Loading branch information
Nick Gamberini committed Sep 28, 2015
1 parent 0e892e1 commit 61db94a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions spock/plugins/helpers/interact.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,7 @@ def look(self, yaw=0.0, pitch=0.0):
Turn the head. Both angles are in degrees.
"""
self.clientinfo.position.pitch = pitch
# do not turn the head if looking straight up/down
# TODO maybe this: if pitch not in (-90, 90) or (yaw, pitch) != (0, 0):
if pitch not in (-90, 90):
self.clientinfo.position.yaw = yaw
self.clientinfo.position.yaw = yaw

def look_rel(self, d_yaw=0.0, d_pitch=0.0):
self.look(self.clientinfo.position.yaw + d_yaw,
Expand All @@ -87,7 +84,10 @@ def look_at_rel(self, delta):
def look_at(self, pos):
delta = pos - self.clientinfo.position
delta.y -= constants.PLAYER_HEIGHT
self.look_at_rel(delta)
if delta.x or delta.z:
self.look_at_rel(delta)
else:
self.look(self.clientinfo.position.yaw, delta.yaw_pitch.pitch)

def _send_dig_block(self, status, pos=None, face=constants.FACE_Y_POS):
if status == constants.DIG_START:
Expand Down

0 comments on commit 61db94a

Please sign in to comment.