Mark
/
celeste-ai
Archived
1
0
Fork 0

Fixed human mode

master
Mark 2023-02-26 12:26:01 -08:00
parent 24dd65ace8
commit 4171fefb00
Signed by: Mark
GPG Key ID: AD62BB059C2AAEE4
1 changed files with 36 additions and 31 deletions

View File

@ -38,7 +38,7 @@ k_dash=5
-- - screenshots at every frame
-- - frame skipping
-- - waiting for input
hack_human_mode = false
hack_human_mode = true
-- If true, disable screensake
hack_no_shake = true
@ -1211,9 +1211,38 @@ function load_room(x,y)
end
end
-- update function --
-----------------------
function hack_send_state()
out_string = "dc:" .. tostr(deaths) .. ";"
-- Dash status
if hack_can_dash then
out_string = out_string .. "ds:t;"
else
out_string = out_string .. "ds:f;"
end
-- Player state
for k, v in pairs(hack_player_state) do
out_string = out_string .. k ..":" .. v .. ";"
end
-- Fruit status
out_string = out_string .. "fr:"
for i = 0,29 do
if got_fruit[i] then
out_string = out_string .. "t"
else
out_string = out_string .. "f"
end
end
out_string = out_string .. ";"
printh(out_string)
end
-- update function --
----------------------
-- _update runs at 30 fps
-- _update60 does 60 fps
@ -1221,6 +1250,7 @@ end
function _update()
if hack_human_mode then
old_update()
hack_send_state()
return
end
@ -1287,32 +1317,7 @@ function _update()
hack_has_sent_first_message = true
out_string = "dc:" .. tostr(deaths) .. ";"
-- Dash status
if hack_can_dash then
out_string = out_string .. "ds:t;"
else
out_string = out_string .. "ds:f;"
end
-- Fruit status
out_string = out_string .. "fr:"
for i = 0,29 do
if got_fruit[i] then
out_string = out_string .. "t"
else
out_string = out_string .. "f"
end
end
out_string = out_string .. ";"
for k, v in pairs(hack_player_state) do
out_string = out_string .. k ..":" .. v .. ";"
end
printh(out_string)
hack_send_state()
end
-- Called at the same rate as _update,