Merge pull request #340 from MihailRis/warnings

Warnings
This commit is contained in:
MihailRis 2024-11-02 13:30:11 +03:00 committed by GitHub
commit 316de42cca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 22 additions and 0 deletions

View File

@ -11,6 +11,13 @@
gravity="bottom-left"
></textbox>
</container>
<panel id="problemsLog"
color="#00000010"
position-func="gui.get_viewport()[1]-350,0"
size-func="351,gui.get_viewport()[2]-40"
padding="5,15,5,15">
<label>@Problems</label>
</panel>
<textbox id='prompt'
consumer='submit'
margin='0'

View File

@ -1,6 +1,14 @@
history = session.get_entry("commands_history")
history_pointer = #history
local warning_id = 0
events.on("core:warning", function (wtype, text)
document.problemsLog:add(gui.template("problem", {
type="warning", text=wtype..": "..text, id=tostring(warning_id)
}))
warning_id = warning_id + 1
end)
function setup_variables()
local pid = hud.get_player()
local x,y,z = player.get_pos(pid)

View File

@ -0,0 +1,6 @@
<container id="%{id}" size="32" tooltip="%{text}">
<image src="gui/%{type}" size="32"/>
<label pos="36,2">%{text}</label>
<image src="gui/cross" interactive="true" size="16" gravity="top-right"
onclick="document['%{id}']:destruct()"></image>
</container>

View File

@ -238,6 +238,7 @@ function on_deprecated_call(name, alternatives)
return
end
__warnings_hidden[name] = true
events.emit("core:warning", "deprecated call", name)
if alternatives then
debug.warning("deprecated function called ("..name.."), use "..
alternatives.." instead\n"..debug.traceback())