<s> import math <EOL> from pycraft . objects . character import Character <EOL> class Player ( Character ) : <EOL> def __init__ ( self , config ) : <EOL> super ( Player , self ) . __init__ ( config ) <EOL> self . dy = <NUM_LIT:0> <EOL> self . items = { <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : <NUM_LIT:10> <EOL> } , <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : <NUM_LIT:20> <EOL> } , <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : <NUM_LIT:5> <EOL> } , <EOL> "<STR_LIT>" : { <EOL> "<STR_LIT>" : <NUM_LIT:15> <EOL> } <EOL> } <EOL> self . inventory = list ( self . items . keys ( ) ) <EOL> self . block = self . inventory [ <NUM_LIT:0> ] <EOL> def switch_inventory ( self , index ) : <EOL> """<STR_LIT>""" <EOL> if len ( self . inventory ) : <EOL> self . block = self . inventory [ index % len ( self . inventory ) ] <EOL> def adjust_inventory ( self , item , qty = <NUM_LIT:1> ) : <EOL> """<STR_LIT>""" <EOL> self . items [ item ] [ "<STR_LIT>" ] -= qty <EOL> if self . items [ item ] [ "<STR_LIT>" ] == <NUM_LIT:0> : <EOL> self . inventory . remove ( item ) <EOL> del self . items [ item ] <EOL> if self . block == item : <EOL> self . block = self . inventory [ <NUM_LIT:0> ] if len ( self . inventory ) else None <EOL> def get_sight_vector ( self ) : <EOL> """<STR_LIT>""" <EOL> x , y = self . rotation <EOL> m = math . cos ( math . radians ( y ) ) <EOL> dy = math . sin ( math . radians ( y ) ) <EOL> dx = math . cos ( math . radians ( x - <NUM_LIT> ) ) * m <EOL> dz = math . sin ( math . radians ( x - <NUM_LIT> ) ) * m <EOL> return dx , dy , dz </s>
