@@ -579,8 +579,28 @@ local function iterate()
579579 end
580580
581581 for _ , mobj in pairs (Globals .mobjs :readbulk ()) do
582- local type = mobj .type
582+ local type = mobj .type
583+ local index = mobj .index
583584 local radius_color , text_color = get_mobj_color (mobj , type )
585+
586+ if # TrackedThings > 0 then
587+ local id = TrackedThings [# TrackedThings ]
588+
589+ if id == index then
590+ texts .thing = string.format (
591+ " THING %d (%s)\n x: %.5f\n y: %.5f\n z: %.2f" ..
592+ " rad: %.0f\n tics: %d hp: %d\n rt: %d thre: %d" ,
593+ mobj .index , MobjType [type ],
594+ mobj .x / FRACUNIT ,
595+ mobj .y / FRACUNIT ,
596+ mobj .z / FRACUNIT ,
597+ mobj .radius / FRACUNIT ,
598+ mobj .tics ,
599+ mobj .health ,
600+ mobj .reactiontime ,
601+ mobj .threshold )
602+ end
603+ end
584604
585605 if radius_color or text_color then -- not hidden
586606 local pos = tuple_to_vertex (game_to_screen (mobj .x , mobj .y ))
@@ -591,7 +611,6 @@ local function iterate()
591611 local type = mobj .type
592612 local radius = mobj .radius
593613 local screen_radius = math.floor ((radius / FRACUNIT ) * Zoom )
594- local index = mobj .index
595614
596615 if in_range (mousePos .x , pos .x - screen_radius , pos .x + screen_radius )
597616 and in_range (mousePos .y , pos .y - screen_radius , pos .y + screen_radius )
@@ -600,7 +619,7 @@ local function iterate()
600619 radius_color = " white"
601620 text_color = " white"
602621
603- texts .thing = string.format (
622+ texts .thing = texts . thing or string.format (
604623 " THING %d (%s)\n x: %.5f\n y: %.5f\n z: %.2f" ..
605624 " rad: %.0f\n tics: %d hp: %d\n rt: %d thre: %d" ,
606625 mobj .index , MobjType [type ],
@@ -641,6 +660,8 @@ local function iterate()
641660 if texts .line then text (10 , 320 , texts .line , 0xffff8800 ) end
642661 if texts .sector then text (10 , 370 , texts .sector , 0xff00ffff ) end
643662
663+ texts .thing = nil
664+
644665-- text(50,10,shortest_dist/FRACUNIT)
645666end
646667
@@ -798,7 +819,7 @@ local function input_prompt()
798819 elseif input .Backspace and not LastInput .Backspace and value ~= " " then
799820 value = value :sub (1 , - 2 )
800821 elseif input .Enter and not LastInput .Enter and value ~= " " then
801- CurrentPrompt .value = tonumber (value )
822+ CurrentPrompt .fun ( tonumber (value ) )
802823 CurrentPrompt = nil
803824 return
804825 elseif input [" Number0" ] and not LastInput [" Number0" ] and value ~= " " then value = value .. " 0"
@@ -848,10 +869,12 @@ local function add_thing()
848869 msg =
849870 " Enter thing ID from\n level editor.\n\n " ..
850871 " Hit \" Enter\" to send,\n\" Backspace\" to erase,\n or \" Escape\" to cancel." ,
851- fun = func ,
872+ fun = function (id )
873+ table.insert (TrackedThings , id )
874+ print (TrackedThings )
875+ end ,
852876 value = nil
853877 }
854- -- table.insert(TrackedThings
855878end
856879
857880local function add_line ()
0 commit comments