15
15
class Rpg :
16
16
_debug = False
17
17
18
- def __init__ (self , debug = False , renderMode = RENDER_TEXT ):
18
+ def __init__ (self , debug = False , renderMode = RENDER_TEXT , isInteractive = True ):
19
19
self ._player = None
20
20
self ._debug = debug
21
21
self ._renderMode = renderMode
22
22
self ._action = []
23
+ self ._isInteractive = isInteractive
23
24
24
25
def init (self , world , login , password , action = None ):
25
26
if world is None :
@@ -90,7 +91,7 @@ def run(self):
90
91
else ask the player to enter a command
91
92
'''
92
93
if len (self ._action ) > 0 :
93
- print (self ._runAction (isInteractive = False ))
94
+ print (self ._runAction ())
94
95
else :
95
96
c = ''
96
97
result = 0
@@ -106,7 +107,7 @@ def run(self):
106
107
107
108
if c != "" :
108
109
self ._action = self .parseTypedAction (c )
109
- result = self ._runAction (isInteractive = True )
110
+ result = self ._runAction ()
110
111
111
112
if result == command_factory .quit :
112
113
break
@@ -116,9 +117,9 @@ def run(self):
116
117
print (result )
117
118
print ("" )
118
119
119
- def _runAction (self , isInteractive ):
120
+ def _runAction (self ):
120
121
try :
121
- c = command_factory .factory .create (self ._player , self ._action , isInteractive )
122
+ c = command_factory .factory .create (self ._player , self ._action , self . _isInteractive )
122
123
123
124
if c == command_factory .quit :
124
125
return c
0 commit comments