add 'core:warning' event
This commit is contained in:
parent
9ede50045b
commit
e51c6bed78
@ -11,6 +11,13 @@
|
|||||||
gravity="bottom-left"
|
gravity="bottom-left"
|
||||||
></textbox>
|
></textbox>
|
||||||
</container>
|
</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'
|
<textbox id='prompt'
|
||||||
consumer='submit'
|
consumer='submit'
|
||||||
margin='0'
|
margin='0'
|
||||||
@ -19,11 +26,4 @@
|
|||||||
onup="on_history_up()"
|
onup="on_history_up()"
|
||||||
ondown="on_history_down()">
|
ondown="on_history_down()">
|
||||||
</textbox>
|
</textbox>
|
||||||
<panel id="problems-log"
|
|
||||||
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>
|
|
||||||
</container>
|
</container>
|
||||||
|
|||||||
@ -1,6 +1,12 @@
|
|||||||
history = session.get_entry("commands_history")
|
history = session.get_entry("commands_history")
|
||||||
history_pointer = #history
|
history_pointer = #history
|
||||||
|
|
||||||
|
events.on("core:warning", function (wtype, text)
|
||||||
|
document.problemsLog:add(gui.template("problem", {
|
||||||
|
type="warning", text=wtype..": "..text, id=tostring(math.random())
|
||||||
|
}))
|
||||||
|
end)
|
||||||
|
|
||||||
function setup_variables()
|
function setup_variables()
|
||||||
local pid = hud.get_player()
|
local pid = hud.get_player()
|
||||||
local x,y,z = player.get_pos(pid)
|
local x,y,z = player.get_pos(pid)
|
||||||
|
|||||||
6
res/layouts/templates/problem.xml
Normal file
6
res/layouts/templates/problem.xml
Normal 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>
|
||||||
@ -238,6 +238,7 @@ function on_deprecated_call(name, alternatives)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
__warnings_hidden[name] = true
|
__warnings_hidden[name] = true
|
||||||
|
events.emit("core:warning", "deprecated call", name)
|
||||||
if alternatives then
|
if alternatives then
|
||||||
debug.warning("deprecated function called ("..name.."), use "..
|
debug.warning("deprecated function called ("..name.."), use "..
|
||||||
alternatives.." instead\n"..debug.traceback())
|
alternatives.." instead\n"..debug.traceback())
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user