@@ -115,13 +115,22 @@ def test_activate_item(self):
115115 # TODO deactivate_item
116116
117117 def test_entity (self ):
118+ # interact entity should not swing arm
118119 entity = DataDict (eid = 234 , x = 2 , y = 2 + constants .PLAYER_EYE_HEIGHT , z = 4 )
119-
120120 self .plug .use_entity (entity )
121121 self .assertAlmostEqual (ClientInfoMock .position .yaw , - 45 )
122122 self .assertAlmostEqual (ClientInfoMock .position .pitch , 0 )
123- self .assertEqual (NetMock .datas [- 2 ].action , constants .INTERACT_ENTITY )
124- self .assertEqual (NetMock .datas [- 2 ].target , 234 )
123+ self .assertEqual (NetMock .datas [- 1 ].action , constants .INTERACT_ENTITY )
124+ self .assertEqual (NetMock .datas [- 1 ].target , 234 )
125+ self .assertEqual (len (NetMock .datas ), 1 )
126+
127+ # attack entity should swing arm
128+ entity = DataDict (eid = 235 , x = 2 , y = 2 + constants .PLAYER_EYE_HEIGHT , z = 4 )
129+ self .plug .use_entity (entity , action = constants .ATTACK_ENTITY )
130+ self .assertAlmostEqual (ClientInfoMock .position .yaw , - 45 )
131+ self .assertAlmostEqual (ClientInfoMock .position .pitch , 0 )
132+ self .assertEqual (NetMock .datas [- 2 ].action , constants .ATTACK_ENTITY )
133+ self .assertEqual (NetMock .datas [- 2 ].target , 235 )
125134 self .assertEqual (NetMock .idents [- 1 ], 'PLAY>Animation' )
126135
127136 self .plug .auto_look = False
0 commit comments