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 -- - screenshots at every frame
-- - frame skipping -- - frame skipping
-- - waiting for input -- - waiting for input
hack_human_mode = false hack_human_mode = true
-- If true, disable screensake -- If true, disable screensake
hack_no_shake = true hack_no_shake = true
@ -286,11 +286,11 @@ player =
this.djump-=1 this.djump-=1
this.dash_time=4 this.dash_time=4
has_dashed=true has_dashed=true
-- HACK: fast-forward dashes -- HACK: fast-forward dashes
hack_frame_foward_bonus = 10 hack_frame_foward_bonus = 10
hack_can_dash = false hack_can_dash = false
this.dash_effect_time=10 this.dash_effect_time=10
local v_input=(btn(k_up) and -1 or (btn(k_down) and 1 or 0)) local v_input=(btn(k_up) and -1 or (btn(k_down) and 1 or 0))
if input!=0 then if input!=0 then
@ -1211,9 +1211,38 @@ function load_room(x,y)
end end
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 -- _update runs at 30 fps
-- _update60 does 60 fps -- _update60 does 60 fps
@ -1221,6 +1250,7 @@ end
function _update() function _update()
if hack_human_mode then if hack_human_mode then
old_update() old_update()
hack_send_state()
return return
end end
@ -1287,32 +1317,7 @@ function _update()
hack_has_sent_first_message = true hack_has_sent_first_message = true
out_string = "dc:" .. tostr(deaths) .. ";" hack_send_state()
-- 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)
end end
-- Called at the same rate as _update, -- Called at the same rate as _update,