mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 04:30:44 +01:00
## About The Pull Request just macro-izes all the usages of verbs in the codebase as a pre-requisite to my follow up pr that serializes all the verbs arguments so we can tgui-ify the command bar, so we can then put it on the onscreen map. this also basically does the same as #94487 so can easily be integrated into the verb queueing stuff... but does not actually do any verb queueing by itself. basically im just trying to be https://github.com/tgstation/tgstation/labels/Atomic ## Why It's Good For The Game it doesn't really do anything by itself but it does let us do more stuff ## Changelog 🆑 code: the backend to all verbs in the game has been played with, please report any issues to github /🆑 --------- Co-authored-by: harryob <55142896+harryob@users.noreply.github.com>
109 lines
4.1 KiB
Plaintext
109 lines
4.1 KiB
Plaintext
/datum/getrev
|
|
var/commit // git rev-parse HEAD
|
|
var/date
|
|
var/originmastercommit // git rev-parse origin/master
|
|
var/list/testmerge = list()
|
|
|
|
/datum/getrev/New()
|
|
commit = rustg_git_revparse("HEAD")
|
|
if(commit)
|
|
date = rustg_git_commit_date(commit)
|
|
originmastercommit = rustg_git_revparse("origin/master")
|
|
|
|
/datum/getrev/proc/load_tgs_info()
|
|
testmerge = world.TgsTestMerges()
|
|
var/datum/tgs_revision_information/revinfo = world.TgsRevision()
|
|
if(revinfo)
|
|
commit = revinfo.commit
|
|
originmastercommit = revinfo.origin_commit
|
|
date = revinfo.timestamp || rustg_git_commit_date(commit)
|
|
|
|
// goes to DD log and config_error.txt
|
|
log_world(get_log_message())
|
|
|
|
/datum/getrev/proc/get_log_message()
|
|
var/list/msg = list()
|
|
msg += "Running /tg/ revision: [date]"
|
|
if(originmastercommit)
|
|
msg += "origin/master: [originmastercommit]"
|
|
|
|
for(var/line in testmerge)
|
|
var/datum/tgs_revision_information/test_merge/tm = line
|
|
msg += "Test merge active of PR #[tm.number] commit [tm.head_commit]"
|
|
SSblackbox.record_feedback("associative", "testmerged_prs", 1, list("number" = "[tm.number]", "commit" = "[tm.head_commit]", "title" = "[tm.title]", "author" = "[tm.author]"))
|
|
|
|
if(commit && commit != originmastercommit)
|
|
msg += "HEAD: [commit]"
|
|
else if(!originmastercommit)
|
|
msg += "No commit information"
|
|
|
|
msg += "Running rust-g version [rustg_get_version()]"
|
|
|
|
return msg.Join("\n")
|
|
|
|
/datum/getrev/proc/GetDatabaseCommitSha()
|
|
. = originmastercommit
|
|
if (commit == .)
|
|
return .
|
|
|
|
var/gh_url = CONFIG_GET(string/githuburl)
|
|
if(!gh_url)
|
|
return .
|
|
|
|
var/datum/http_request/request = new()
|
|
request.prepare(RUSTG_HTTP_METHOD_GET, "[gh_url]/commit/[commit]", "", "")
|
|
request.begin_async()
|
|
UNTIL(request.is_complete())
|
|
var/datum/http_response/response = request.into_response()
|
|
|
|
if (response.status_code >= 200 && response.status_code < 300)
|
|
return commit
|
|
|
|
return .
|
|
|
|
/datum/getrev/proc/GetTestMergeInfo(header = TRUE)
|
|
if(!testmerge.len)
|
|
return ""
|
|
. = header ? "The following pull requests are currently test merged:<br>" : ""
|
|
for(var/line in testmerge)
|
|
var/datum/tgs_revision_information/test_merge/tm = line
|
|
var/cm = tm.head_commit
|
|
var/details = ": '" + html_encode(tm.title) + "' by " + html_encode(tm.author) + " at commit " + html_encode(copytext_char(cm, 1, 11))
|
|
. += "<a href=\"[CONFIG_GET(string/githuburl)]/pull/[tm.number]\">#[tm.number][details]</a><br>"
|
|
|
|
GAME_VERB_DESC(/client, showrevinfo, "Show Server Revision", "Check the current server code revision", "OOC")
|
|
|
|
var/list/msg = list()
|
|
// Round ID
|
|
if(GLOB.round_id)
|
|
msg += "<b>Round ID:</b> [GLOB.round_id]"
|
|
|
|
msg += "<b>BYOND Version:</b> [world.byond_version].[world.byond_build]"
|
|
if(DM_VERSION != world.byond_version || DM_BUILD != world.byond_build)
|
|
msg += "<b>Compiled with BYOND Version:</b> [DM_VERSION].[DM_BUILD]"
|
|
|
|
// Revision information
|
|
var/datum/getrev/revdata = GLOB.revdata
|
|
msg += "<b>Server revision compiled on:</b> [revdata.date]"
|
|
var/pc = revdata.originmastercommit
|
|
if(pc)
|
|
msg += "<b>Master commit:</b> <a href=\"[CONFIG_GET(string/githuburl)]/commit/[pc]\">[pc]</a>"
|
|
if(length(revdata.testmerge))
|
|
msg += revdata.GetTestMergeInfo()
|
|
if(revdata.commit && revdata.commit != revdata.originmastercommit)
|
|
msg += "<b>Local commit:</b> [revdata.commit]"
|
|
else if(!pc)
|
|
msg += "No commit information"
|
|
if(world.TgsAvailable())
|
|
var/datum/tgs_version/version = world.TgsVersion()
|
|
msg += "<b>TGS version</b>: [version.raw_parameter]"
|
|
msg += "<b>DMAPI version</b>: [TGS_DMAPI_VERSION]"
|
|
|
|
// Game mode odds
|
|
msg += "<br><b>Current Informational Settings:</b>"
|
|
msg += "<b>Protect Authority Roles From Traitor:</b> [CONFIG_GET(flag/protect_roles_from_antagonist) ? "Yes" : "No"]"
|
|
msg += "<b>Protect Assistant Role From Traitor:</b> [CONFIG_GET(flag/protect_assistant_from_antagonist) ? "Yes" : "No"]"
|
|
msg += "<b>Enforce Human Authority:</b> [CONFIG_GET(string/human_authority) ? "Yes" : "No"]"
|
|
msg += "<b>Allow Latejoin Antagonists:</b> [CONFIG_GET(flag/allow_latejoin_antagonists) ? "Yes" : "No"]"
|
|
to_chat(src, fieldset_block("Server Revision Info", span_infoplain(jointext(msg, "<br>")), "boxed_message"), type = MESSAGE_TYPE_INFO)
|