Allow user input to be modified from Lua

Also adds some handlers in the Lua code for when the game is not started
yet
This commit is contained in:
Gnome Ann
2021-12-12 20:44:03 -05:00
parent fbf3e7615b
commit 39bfb0862a
2 changed files with 28 additions and 13 deletions

View File

@@ -1746,9 +1746,9 @@ def actionsubmit(data, actionmode=0, force_submit=False):
if(not vars.gamestarted):
vars.submission = data
execute_inmod()
data = vars.submission
if(not force_submit and len(data.strip()) == 0):
set_aibusy(0)
return
assert False
# Start the game
vars.gamestarted = True
if(not vars.noai):
@@ -1776,13 +1776,14 @@ def actionsubmit(data, actionmode=0, force_submit=False):
set_aibusy(0)
emit('from_server', {'cmd': 'scrolldown', 'data': ''}, broadcast=True)
else:
# Apply input formatting & scripts before sending to tokenizer
if(vars.actionmode == 0):
data = applyinputformatting(data)
vars.submission = data
execute_inmod()
data = vars.submission
# Dont append submission if it's a blank/continue action
if(data != ""):
# Apply input formatting & scripts before sending to tokenizer
if(vars.actionmode == 0):
data = applyinputformatting(data)
vars.submission = data
execute_inmod()
# Store the result in the Action log
if(len(vars.prompt.strip()) == 0):
vars.prompt = data