Merge pull request #4402 from CHOMPStation2/upstream-merge-13139

[MIRROR] Changed TGUI fallback behavior
This commit is contained in:
Nadyr
2022-06-23 01:19:29 -04:00
committed by GitHub
9 changed files with 75 additions and 16 deletions

View File

@@ -1,7 +1,7 @@
---
name: Bug report
name: General Bug report
about: Create a report to help us improve
title: ''
title: '[GENERAL] '
labels: 'Type: Bug'
assignees: ''

35
.github/ISSUE_TEMPLATE/ui_report.md vendored Normal file
View File

@@ -0,0 +1,35 @@
---
name: UI Bug report
about: Create a report, specific to any UI related things.
title: '[UI] '
labels: 'Type: Bug'
assignees: ''
---
<!-- Please DO NOT report 'suggestions' on GitHub. If your issue consists of an opinion about how something should be, it doesn't belong here. -->
<!-- If your issue consists of something not operating as intended, please report it below by filling out the template. -->
<!-- These directions will not appear in the issue, when submitted. -->
<!--Please provide a clear and concise description of what the bug is.-->
#### Brief description of the bug
<!--What normally happens when this occurs? Keep in mind that behavior may be different on other servers.-->
#### What you expected to happen
<!--Please use as much detail as possible when describing the bug behavior, including any context (things you did before) that might be relevant.-->
#### What actually happened
<!-- Same here, please include any context that might have contributed, such as actions taken right before.-->
#### Steps to reproduce
- (Step 1)
- (Step 2)
- (and so on)
<!--Optional, you may remove this section.-->
#### Code Revision
- (Found using the "Show Server Revision" verb under the OOC tab.)
<!--Optional, you may remove this section.-->
#### Anything else you may wish to add:
- (Location if it's a mapping issue, screenshots, sprites, etc.)

View File

@@ -42,8 +42,10 @@
#define COMSIG_PARENT_QDELETING "parent_qdeleting"
/// generic topic handler (usr, href_list)
#define COMSIG_TOPIC "handle_topic"
/// from datum ui_act (usr, action)
/// from datum tgui_act (usr, action)
#define COMSIG_UI_ACT "COMSIG_UI_ACT"
/// from datum tgui_fallback (payload)
#define COMSIG_UI_FALLBACK "COMSIG_UI_FALLBACK"
/// fires on the target datum when an element is attached to it (/datum/element)

View File

@@ -344,7 +344,8 @@ Turf and target are seperate in case you want to teleport some distance from a t
var/newname
for(var/i=1,i<=3,i++) //we get 3 attempts to pick a suitable name.
newname = tgui_input_text(src,"You are \a [role]. Would you like to change your name to something else?", "Name change",oldname)
//newname = tgui_input_text(src,"You are \a [role]. Would you like to change your name to something else?", "Name change",oldname)
newname = input(src,"You are \a [role]. Would you like to change your name to something else?", "Name change",oldname)
if((world.time-time_passed)>3000)
return //took too long
newname = sanitizeName(newname, ,allow_numbers) //returns null if the name doesn't meet some basic requirements. Tidies up a few other things like bad-characters.

View File

@@ -82,6 +82,17 @@
if(!ui || ui.status != STATUS_INTERACTIVE)
return TRUE
/**
* public
*
* Called on a UI when the UI crashed.
*
* required payload list A list of the payload supposed to be set on the regular UI.
*/
/datum/proc/tgui_fallback(list/payload)
SHOULD_CALL_PARENT(TRUE)
SEND_SIGNAL(src, COMSIG_UI_FALLBACK, usr)
/**
* public
*

View File

@@ -54,15 +54,17 @@
/datum/tgui_module/player_notes/tgui_state(mob/user)
return GLOB.tgui_admin_state
/datum/tgui_module/player_notes/tgui_fallback(payload)
if(..())
return TRUE
open_legacy()
/datum/tgui_module/player_notes/tgui_act(action, params, datum/tgui/ui)
if(..())
return TRUE
switch(action)
if("__fallback")
log_runtime(EXCEPTION("TGUI Fallback Triggered: \"[ui.user]\" tried to use/open \"[ui.title]/[ui.interface]\"! Trying to open legacy UI!"))
open_legacy()
if("show_player_info")
var/datum/tgui_module/player_notes_info/A = new(src)
A.key = params["name"]
@@ -107,15 +109,18 @@
/datum/tgui_module/player_notes_info/tgui_state(mob/user)
return GLOB.tgui_admin_state
/datum/tgui_module/player_notes_info/tgui_fallback(payload)
if(..())
return TRUE
var/datum/admins/A = admin_datums[usr.ckey]
A.show_player_info_legacy(key)
/datum/tgui_module/player_notes_info/tgui_act(action, params, datum/tgui/ui)
if(..())
return TRUE
switch(action)
if("__fallback")
var/datum/admins/A = admin_datums[usr.ckey]
A.show_player_info_legacy(key)
if("add_player_info")
var/key = params["ckey"]
var/add = tgui_input_text(usr, "Write your comment below.", "Add Player Info", multiline = TRUE, prevent_enter = TRUE)

View File

@@ -343,3 +343,8 @@
LAZYINITLIST(src_object.tgui_shared_states)
src_object.tgui_shared_states[href_list["key"]] = href_list["value"]
SStgui.update_uis(src_object)
if("fallback")
#ifdef TGUI_DEBUGGING
log_tgui(user, "Fallback Triggered: [href_list["payload"]], Window: [window.id], Source: [src_object]")
#endif
src_object.tgui_fallback(payload)

View File

@@ -26,9 +26,9 @@
else
return
// A gentle nudge - you should not be using TGUI alert for anything other than a simple message.
if(length(buttons) > 3)
log_tgui(user, "Error: TGUI Alert initiated with too many buttons. Use a list.", "TguiAlert")
return tgui_input_list(user, message, title, buttons, timeout, autofocus)
//if(length(buttons) > 3)
// log_tgui(user, "Error: TGUI Alert initiated with too many buttons. Use a list.", "TguiAlert")
// return tgui_input_list(user, message, title, buttons, timeout, autofocus)
// Client does NOT have tgui_input on: Returns regular input
if(!usr.client.prefs.tgui_input_mode || strict_byond)

View File

@@ -368,7 +368,7 @@ window.onerror = function (msg, url, line, col, error) {
Byond.topic({
tgui: 1,
window_id: window.__windowId__,
type: 'act/__fallback',
type: 'fallback',
});
// Proper stacktrace
var stack = error && error.stack;