def walk_to(item_id): # now get the walk_to for this item s = Script(uid='_main') # if you own the item, no need to walk if item_id in mopy.monkey.engine.data.globals.inventory: return s item = sc.get_item(item_id) pos = item.get('walk_to') wdir = item.get('wdir', None) s.add_action(Walk(pos, 'player')) if wdir: s.add_action(Turn(wdir, 'player')) return s
def wti(args, s, current, sa): # if you own the item, no need to walk # you can override the item via 2nd argument item_id = args[0] if len(args) >= 1 else sa[0] if item_id in mopy.monkey.engine.data.globals.inventory: iid = s.add_action(NoOp()) return iid item = sc.get_item(item_id) pos = item.get('walk_to') wdir = item.get('wdir', None) iid = s.add_action(Walk(pos, 'player')) if wdir: iid = s.add_action(Turn(wdir, 'player'), after=[iid]) return iid
def _select__walkdoor(args): door_id = sc.get_item(args[0])['door'] if getattr(doors, door_id) == 'open': return 1 return 0
def clo(args, s, current, sa): item_id = args[0] if len(args) > 0 else sa[0] door_id = sc.get_item(item_id)['door'] iid = s.add_action(close_door(item_id, door_id)) return iid