From 84379860b6302de2340e5efff9dfbcbe42e68f1b Mon Sep 17 00:00:00 2001 From: craftxbox Date: Wed, 26 Jun 2019 14:22:58 -0230 Subject: [PATCH 01/47] a cardinal sin amongst men: using webeditor. --- goon/browserassets/js/browserOutput.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/goon/browserassets/js/browserOutput.js b/goon/browserassets/js/browserOutput.js index 03eabaffeef..8239261b904 100644 --- a/goon/browserassets/js/browserOutput.js +++ b/goon/browserassets/js/browserOutput.js @@ -41,6 +41,7 @@ var opts = { 'suppressOptionsClose': false, //Whether or not we should be hiding the suboptions menu 'highlightTerms': [], 'highlightLimit': 5, + 'highlightEscapeRegex':true, 'highlightColor': '#FFFF00', //The color of the highlighted message 'pingDisabled': false, //Has the user disabled the ping counter @@ -159,7 +160,7 @@ function setHighlightColor(match) { function highlightTerms(el) { for (var i = 0; i < opts.highlightTerms.length; i++) { //Each highlight term if(opts.highlightTerms[i]) { - var rexp = new RegExp("("+opts.highlightTerms[i]+")","gmi") + var rexp = new RegExp("("+opts.highlightEscapeRegex?opts.highlightTerms[i].replace(new RegExp("([^a-zA-Z0-9])","gmi"),"\\$1"):opts.highlightTerms[i]+")","gmi") el.innerHTML = el.innerHTML.replace(rexp,"$1") } } @@ -606,6 +607,10 @@ $(function() { opts.highlightColor = savedConfig.shighlightColor; internalOutput('Loaded highlight color of: '+savedConfig.shighlightColor+'', 'internal'); } + if (savedConfig.shighlightEscapeRegex) { + opts.highlightEscapeRegex = savedConfig.shighlightEscapeRegex; + internalOutput('Loaded highlight regex enable of: '+savedConfig.shighlightEscapeRegex+'', 'internal'); + } if (savedConfig.shideSpam) { opts.hideSpam = $.parseJSON(savedConfig.shideSpam); internalOutput('Loaded hide spam preference of: ' + savedConfig.shideSpam + '', 'internal'); @@ -969,7 +974,9 @@ $(function() { } var popupContent = '
String Highlighting
' + '
' + - '
Choose up to '+opts.highlightLimit+' strings that will highlight the line when they appear in chat.
Regex compatible
See here for details
' + + '
Choose up to '+opts.highlightLimit+' strings that will highlight the line when they appear in chat.
'+ + 'Regex Enabled'+ + '
See here for details
' + '
' + termInputs + '
Date: Wed, 26 Jun 2019 22:42:35 -0230 Subject: [PATCH 02/47] regex enable/disable checkbox --- goon/browserassets/js/browserOutput.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/goon/browserassets/js/browserOutput.js b/goon/browserassets/js/browserOutput.js index 8239261b904..8d8e20d25e5 100644 --- a/goon/browserassets/js/browserOutput.js +++ b/goon/browserassets/js/browserOutput.js @@ -160,7 +160,10 @@ function setHighlightColor(match) { function highlightTerms(el) { for (var i = 0; i < opts.highlightTerms.length; i++) { //Each highlight term if(opts.highlightTerms[i]) { - var rexp = new RegExp("("+opts.highlightEscapeRegex?opts.highlightTerms[i].replace(new RegExp("([^a-zA-Z0-9])","gmi"),"\\$1"):opts.highlightTerms[i]+")","gmi") + var rexp = new RegExp("("+opts.highlightTerms[i]+")","gmi") + if(opts.highlightEscapeRegex){ + rexp = new RegExp("("+opts.highlightTerms[i].replace(new RegExp("([^a-zA-Z0-9])","gmi"),"\\$1")+")","gmi") + } el.innerHTML = el.innerHTML.replace(rexp,"$1") } } @@ -570,6 +573,7 @@ $(function() { 'spingDisabled': getCookie('pingdisabled'), 'shighlightTerms': getCookie('highlightterms'), 'shighlightColor': getCookie('highlightcolor'), + 'shighlightEscapeRegex': getCookie('highlightescaperegex'), 'shideSpam': getCookie('hidespam'), 'darkChat': getCookie('darkChat'), }; @@ -975,7 +979,7 @@ $(function() { var popupContent = '
String Highlighting
' + '
' + '
Choose up to '+opts.highlightLimit+' strings that will highlight the line when they appear in chat.
'+ - 'Regex Enabled'+ + 'Regex Enabled'+ '
See here for details
' + '' + termInputs + @@ -986,7 +990,6 @@ $(function() { '
'; createPopup(popupContent, 250); }); - $('body').on('keyup', '#highlightColor', function() { var color = $('#highlightColor').val(); color = color.trim(); @@ -1014,7 +1017,7 @@ $(function() { } var color = $('#highlightColor').val(); - opts.highlightEnableRegex = !($('#highlightRegexEnable').checked) + opts.highlightEscapeRegex = !(document.getElementById('highlightregexenable').checked) color = color.trim(); if (color == '' || color.charAt(0) != '#') { opts.highlightColor = '#FFFF00'; @@ -1024,6 +1027,7 @@ $(function() { var $popup = $('#highlightPopup').closest('.popup'); $popup.remove(); + setCookie('highlightescaperegex', opts.highlightEscapeRegex,365) setCookie('highlightterms', JSON.stringify(opts.highlightTerms), 365); setCookie('highlightcolor', opts.highlightColor, 365); }); From 4ccebc413371df189a8d3a4561d8fc1dc312df3a Mon Sep 17 00:00:00 2001 From: craftxbox Date: Thu, 15 Aug 2019 19:46:02 -0230 Subject: [PATCH 03/47] h --- goon/browserassets/js/browserOutput.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/goon/browserassets/js/browserOutput.js b/goon/browserassets/js/browserOutput.js index 8d8e20d25e5..962809eae68 100644 --- a/goon/browserassets/js/browserOutput.js +++ b/goon/browserassets/js/browserOutput.js @@ -41,7 +41,7 @@ var opts = { 'suppressOptionsClose': false, //Whether or not we should be hiding the suboptions menu 'highlightTerms': [], 'highlightLimit': 5, - 'highlightEscapeRegex':true, + 'highlightRegexEnable':false, 'highlightColor': '#FFFF00', //The color of the highlighted message 'pingDisabled': false, //Has the user disabled the ping counter @@ -161,7 +161,7 @@ function highlightTerms(el) { for (var i = 0; i < opts.highlightTerms.length; i++) { //Each highlight term if(opts.highlightTerms[i]) { var rexp = new RegExp("("+opts.highlightTerms[i]+")","gmi") - if(opts.highlightEscapeRegex){ + if(!opts.highlightRegexEnable){ rexp = new RegExp("("+opts.highlightTerms[i].replace(new RegExp("([^a-zA-Z0-9])","gmi"),"\\$1")+")","gmi") } el.innerHTML = el.innerHTML.replace(rexp,"$1") @@ -573,7 +573,7 @@ $(function() { 'spingDisabled': getCookie('pingdisabled'), 'shighlightTerms': getCookie('highlightterms'), 'shighlightColor': getCookie('highlightcolor'), - 'shighlightEscapeRegex': getCookie('highlightescaperegex'), + 'shighlightRegexEnable': getCookie('highlightregexenable'), 'shideSpam': getCookie('hidespam'), 'darkChat': getCookie('darkChat'), }; @@ -611,9 +611,9 @@ $(function() { opts.highlightColor = savedConfig.shighlightColor; internalOutput('Loaded highlight color of: '+savedConfig.shighlightColor+'', 'internal'); } - if (savedConfig.shighlightEscapeRegex) { - opts.highlightEscapeRegex = savedConfig.shighlightEscapeRegex; - internalOutput('Loaded highlight regex enable of: '+savedConfig.shighlightEscapeRegex+'', 'internal'); + if (savedConfig.shighlightRegexEnable) { + opts.highlightRegexEnable = savedConfig.shighlightRegexEnable; + internalOutput('Loaded highlight regex enable of: '+savedConfig.shighlightRegexEnable+'', 'internal'); } if (savedConfig.shideSpam) { opts.hideSpam = $.parseJSON(savedConfig.shideSpam); @@ -979,7 +979,7 @@ $(function() { var popupContent = '
String Highlighting
' + '
' + '
Choose up to '+opts.highlightLimit+' strings that will highlight the line when they appear in chat.
'+ - 'Regex Enabled'+ + 'Enable Regex'+ '
See here for details
' + '' + termInputs + @@ -989,6 +989,7 @@ $(function() { '' + '
'; createPopup(popupContent, 250); + document.querySelector(".popup #highlightRegexEnable").checked = opts.highlightRegexEnable; }); $('body').on('keyup', '#highlightColor', function() { var color = $('#highlightColor').val(); @@ -1017,7 +1018,7 @@ $(function() { } var color = $('#highlightColor').val(); - opts.highlightEscapeRegex = !(document.getElementById('highlightregexenable').checked) + opts.highlightRegexEnable = document.querySelector("#highlightRegexEnable").checked color = color.trim(); if (color == '' || color.charAt(0) != '#') { opts.highlightColor = '#FFFF00'; @@ -1027,7 +1028,7 @@ $(function() { var $popup = $('#highlightPopup').closest('.popup'); $popup.remove(); - setCookie('highlightescaperegex', opts.highlightEscapeRegex,365) + setCookie('highlightregexenable', opts.highlightRegexEnable,365) setCookie('highlightterms', JSON.stringify(opts.highlightTerms), 365); setCookie('highlightcolor', opts.highlightColor, 365); }); From ec2eeeff502609a537c385ed380f0d79a207c1c0 Mon Sep 17 00:00:00 2001 From: craftxbox Date: Mon, 7 Oct 2019 20:54:43 -0230 Subject: [PATCH 04/47] lets try this again --- goon/browserassets/js/browserOutput.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/goon/browserassets/js/browserOutput.js b/goon/browserassets/js/browserOutput.js index 962809eae68..565a3535982 100644 --- a/goon/browserassets/js/browserOutput.js +++ b/goon/browserassets/js/browserOutput.js @@ -160,11 +160,13 @@ function setHighlightColor(match) { function highlightTerms(el) { for (var i = 0; i < opts.highlightTerms.length; i++) { //Each highlight term if(opts.highlightTerms[i]) { - var rexp = new RegExp("("+opts.highlightTerms[i]+")","gmi") + var rexp = new RegExp(opts.highlightTerms[i],"gmi") if(!opts.highlightRegexEnable){ rexp = new RegExp("("+opts.highlightTerms[i].replace(new RegExp("([^a-zA-Z0-9])","gmi"),"\\$1")+")","gmi") + el.innerText = el.innerText.replace(rexp,"$1") //disabling regex disables html matching too + continue; } - el.innerHTML = el.innerHTML.replace(rexp,"$1") + el.innerHTML = el.innerHTML.replace(rexp,"$0") //i cant figure out a proper, non snowflakey way to let people select the group that gets highlighted } } } From bf131ecdb283fafa4a20df176fb2c5af496cc5fd Mon Sep 17 00:00:00 2001 From: craftxbox Date: Sun, 27 Oct 2019 17:01:40 -0230 Subject: [PATCH 05/47] fix all the shit --- goon/browserassets/js/browserOutput.js | 33 ++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/goon/browserassets/js/browserOutput.js b/goon/browserassets/js/browserOutput.js index 565a3535982..f700d2ff028 100644 --- a/goon/browserassets/js/browserOutput.js +++ b/goon/browserassets/js/browserOutput.js @@ -72,6 +72,8 @@ var opts = { 'enableEmoji': true }; +var regexHasError = false; //variable to check if regex has excepted + function outerHTML(el) { var wrap = document.createElement('div'); wrap.appendChild(el.cloneNode(true)); @@ -91,6 +93,19 @@ if (typeof String.prototype.trim !== 'function') { }; } +//Polyfill for string.prototype.includes. Why the fuck. Just why the fuck. +if (!String.prototype.includes) { + String.prototype.includes = function(search, start) { + 'use strict'; + + if (search instanceof RegExp) { + throw TypeError('first argument must not be a RegExp'); + } + if (start === undefined) { start = 0; } + return this.indexOf(search, start) !== -1; + }; +} + //Shit fucking piece of crap that doesn't work god fuckin damn it function linkify(text) { var rex = /((?:$1") //disabling regex disables html matching too + if(el.innerText.toString().toLowerCase().includes(opts.highlightTerms[i].toLowerCase())) //match normally + el.innerHTML = ''+el.innerHTML+'' //encloseincludes continue; } + var rexp; + try{ + rexp = new RegExp(opts.highlightTerms[i],"gmi") + } catch(e){ + el.innerHTML+='
Your highlight regex - '+opts.highlightTerms[i]+' - is malformed. Thrown exception: '+e+'' + regexHasError = true; + return; + } el.innerHTML = el.innerHTML.replace(rexp,"$0") //i cant figure out a proper, non snowflakey way to let people select the group that gets highlighted } } @@ -575,7 +598,7 @@ $(function() { 'spingDisabled': getCookie('pingdisabled'), 'shighlightTerms': getCookie('highlightterms'), 'shighlightColor': getCookie('highlightcolor'), - 'shighlightRegexEnable': getCookie('highlightregexenable'), + 'shighlightRegexEnable': getCookie('highlightregexenable') == "true", 'shideSpam': getCookie('hidespam'), 'darkChat': getCookie('darkChat'), }; @@ -1027,6 +1050,8 @@ $(function() { } else { opts.highlightColor = color; } + regexHasError = false; //they changed the regex so it might be valid now + var $popup = $('#highlightPopup').closest('.popup'); $popup.remove(); From 2d97f55b16561e93a0b07ff78f571970d0c385aa Mon Sep 17 00:00:00 2001 From: craftxbox Date: Mon, 4 Nov 2019 00:30:09 -0330 Subject: [PATCH 06/47] my hatred for ie is immesurable --- goon/browserassets/js/browserOutput.js | 64 +++++++++++++++++++++----- 1 file changed, 53 insertions(+), 11 deletions(-) diff --git a/goon/browserassets/js/browserOutput.js b/goon/browserassets/js/browserOutput.js index 094e8258562..b94734040bb 100644 --- a/goon/browserassets/js/browserOutput.js +++ b/goon/browserassets/js/browserOutput.js @@ -171,25 +171,67 @@ function setHighlightColor(match) { match.style.background = opts.highlightColor } +function escapeRegex(input){ // put this in a function incase it ever needs to be used elsewhere, makes code cleaner + return input.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); +} + //Highlights words based on user settings function highlightTerms(el) { if(regexHasError) return; //just stop right there ig the regex is gonna except + function highlightRecursor(element,term){ //recursor function to do the highlighting proper + var regex = new RegExp("("+term+")","gi") + function replace(str) { + return str.replace(regex,'$&') + } + var s='' + var work=element.innerHTML; + var work_lc=work.toLowerCase() + var ind=0; + while(ind < work_lc.length) { + console.log(s); + var next_term=work_lc.substring(ind).search(regex); + if(next_term!=-1)next_term+=ind; + var next_tag =work_lc.indexOf('<',ind) + if(next_tag == -1) { + s+=replace(work.substring(ind)); + break; + } + else if(next_term==-1) { + s+=work.substring(ind) + break; + } + else if(next_tag < next_term) { + var temp=work_lc.indexOf('>',next_tag) + s+=work.substring(ind,temp+1); + ind=temp+1; + } + else { + s+=replace(work.substring(ind,next_tag)); + ind=next_tag + } + } + + element.innerHTML=s; + } + for (var i = 0; i < opts.highlightTerms.length; i++) { //Each highlight term if(opts.highlightTerms[i]) { if(!opts.highlightRegexEnable){ - if(el.innerText.toString().toLowerCase().includes(opts.highlightTerms[i].toLowerCase())) //match normally - el.innerHTML = ''+el.innerHTML+'' //encloseincludes - continue; + var innerTerms = opts.highlightTerms[i].split(" ") + for(var a in innerTerms){ + highlightRecursor(el,escapeRegex(innerTerms[a])) + } } - var rexp; - try{ - rexp = new RegExp(opts.highlightTerms[i],"gmi") - } catch(e){ - el.innerHTML+='
Your highlight regex - '+opts.highlightTerms[i]+' - is malformed. Thrown exception: '+e+'' - regexHasError = true; - return; + else { + try{ + new RegExp(opts.highlightTerms[i],"gmi") // check to make sure the pattern wont cause issues + } catch(e){ + el.innerHTML+='
Your highlight regex pattern - '+opts.highlightTerms[i]+' - is malformed.
Your highlights have been disabled until they are next edited
Thrown exception: '+e+'
' + regexHasError = true; + return; + } + highlightRecursor(el,opts.highlightTerms[i]) } - el.innerHTML = el.innerHTML.replace(rexp,"$0") //i cant figure out a proper, non snowflakey way to let people select the group that gets highlighted } } } From 89b9508378c1224275c5b29eb9afb32dbc501c32 Mon Sep 17 00:00:00 2001 From: craftxbox Date: Mon, 4 Nov 2019 18:16:41 -0330 Subject: [PATCH 07/47] remove the dumb bits and make the highlight color change retroactively upon change --- goon/browserassets/js/browserOutput.js | 45 ++++++++++++++++---------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/goon/browserassets/js/browserOutput.js b/goon/browserassets/js/browserOutput.js index b94734040bb..9508f669bc3 100644 --- a/goon/browserassets/js/browserOutput.js +++ b/goon/browserassets/js/browserOutput.js @@ -166,9 +166,12 @@ function emojiparse(el) { } } -// Colorizes the highlight spans -function setHighlightColor(match) { - match.style.background = opts.highlightColor +// Recolorizes the highlight spans +function setHighlightColor() { + var highlightspans = document.getElementsByClassName("highlight") + for(var i in highlightspans){ + highlightspans[i].setAttribute("style","background-color:"+opts.highlightColor) + } } function escapeRegex(input){ // put this in a function incase it ever needs to be used elsewhere, makes code cleaner @@ -177,21 +180,25 @@ function escapeRegex(input){ // put this in a function incase it ever needs to b //Highlights words based on user settings function highlightTerms(el) { + if(regexHasError) return; //just stop right there ig the regex is gonna except + function highlightRecursor(element,term){ //recursor function to do the highlighting proper var regex = new RegExp("("+term+")","gi") + function replace(str) { - return str.replace(regex,'$&') + return str.replace(regex,'$&') } + var s='' var work=element.innerHTML; - var work_lc=work.toLowerCase() var ind=0; - while(ind < work_lc.length) { - console.log(s); - var next_term=work_lc.substring(ind).search(regex); - if(next_term!=-1)next_term+=ind; - var next_tag =work_lc.indexOf('<',ind) + + while(ind < work.length) { + + var next_term=work.substring(ind).search(regex); + if(next_term!=-1)next_term+=ind; + var next_tag =work.indexOf('<',ind) if(next_tag == -1) { s+=replace(work.substring(ind)); break; @@ -201,7 +208,7 @@ function highlightTerms(el) { break; } else if(next_tag < next_term) { - var temp=work_lc.indexOf('>',next_tag) + var temp=work.indexOf('>',next_tag) s+=work.substring(ind,temp+1); ind=temp+1; } @@ -1084,13 +1091,17 @@ $(function() { count++; } - var color = $('#highlightColor').val(); opts.highlightRegexEnable = document.querySelector("#highlightRegexEnable").checked - color = color.trim(); - if (color == '' || color.charAt(0) != '#') { - opts.highlightColor = '#FFFF00'; - } else { - opts.highlightColor = color; + + var color = $('#highlightColor').val(); + if(color != opts.highlightColor) { // did the color even change? + color = color.trim(); + if (color == '' || color.charAt(0) != '#') { + opts.highlightColor = '#FFFF00'; + } else { + opts.highlightColor = color; + } + setHighlightColor(); } regexHasError = false; //they changed the regex so it might be valid now From ea8472f038c681a204085ee1e404cfc85808ebea Mon Sep 17 00:00:00 2001 From: craftxbox Date: Mon, 4 Nov 2019 18:46:23 -0330 Subject: [PATCH 08/47] do the onedit pattern check simply --- goon/browserassets/js/browserOutput.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/goon/browserassets/js/browserOutput.js b/goon/browserassets/js/browserOutput.js index 9508f669bc3..3c266fc023e 100644 --- a/goon/browserassets/js/browserOutput.js +++ b/goon/browserassets/js/browserOutput.js @@ -1103,7 +1103,9 @@ $(function() { } setHighlightColor(); } + regexHasError = false; //they changed the regex so it might be valid now + internalOutput('Highlights have been updated.',"internal") // simplest way to test if pattern works, why reinvent the wheel? var $popup = $('#highlightPopup').closest('.popup'); $popup.remove(); From 68c06c7ceb8764357e466c976221a9eb6ccaf354 Mon Sep 17 00:00:00 2001 From: joep van der velden Date: Sun, 22 Mar 2020 18:53:58 +0100 Subject: [PATCH 09/47] Adds LOGS to the PP. Adds add mob (by ckey) --- code/__HELPERS/unsorted.dm | 10 ++++++++++ code/datums/log_viewer.dm | 18 ++++++++++++++++-- code/modules/admin/admin.dm | 1 + code/modules/admin/topic.dm | 5 +++++ code/modules/admin/verbs/logging_view.dm | 16 +++++++++++++--- 5 files changed, 45 insertions(+), 5 deletions(-) diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index aedc16c4162..2121ce8aee6 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -1946,6 +1946,16 @@ GLOBAL_DATUM_INIT(dview_mob, /mob/dview, new) return pois +/* + * Returns all player mobs in an assoc list with ckey as key and the mob as value +*/ +/proc/get_assoc_mob_list_by_ckey() + var/list/mob/mobs = list() + for(var/i in GLOB.player_list) + var/mob/M = i + mobs[M.ckey] = M + return mobs + /proc/flash_color(mob_or_client, flash_color="#960000", flash_time=20) var/client/C if(istype(mob_or_client, /mob)) diff --git a/code/datums/log_viewer.dm b/code/datums/log_viewer.dm index 70f7d832924..e654becca3d 100644 --- a/code/datums/log_viewer.dm +++ b/code/datums/log_viewer.dm @@ -4,13 +4,13 @@ var/time_from = 0 var/time_to = 4 HOURS // 4 Hours should be enough. INFINITY would screw the UI up var/list/selected_mobs = list() // The mobs in question - var/list/selected_log_types = list() // The log types being searched for + var/list/selected_log_types = ALL_LOGS // The log types being searched for var/list/log_records = list() // Found and sorted records /datum/log_viewer/proc/clear_all() selected_mobs.Cut() - selected_log_types.Cut() + selected_log_types = ALL_LOGS time_from = initial(time_from) time_to = initial(time_to) log_records.Cut() @@ -91,6 +91,14 @@ return start return 0 +/datum/log_viewer/proc/add_mobs(list/mob/mobs) + if(!mobs?.len) + return + for(var/i in mobs) + var/mob/M = i + if(istype(M)) + selected_mobs |= M + /datum/log_viewer/proc/add_mob(mob/user, mob/M) if(!M || !user) return @@ -114,6 +122,7 @@ var/mob/M = i dat += "[M.name]" dat += "Add Mob" + dat += "Add Mob(via CKEY)" dat += "Clear All Mobs" dat += "
" @@ -200,6 +209,11 @@ var/datum/async_input/A = input_autocomplete_async(usr, "Please, select a mob: ", mobs) A.on_close(CALLBACK(src, .proc/add_mob, usr)) return + if(href_list["add_mob_ckey"]) + var/list/mobs = get_assoc_mob_list_by_ckey() + var/datum/async_input/A = input_autocomplete_async(usr, "Please, select a ckey: ", mobs) + A.on_close(CALLBACK(src, .proc/add_mob, usr)) + return if(href_list["remove_mob"]) var/mob/M = locate(href_list["remove_mob"]) if(M) diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm index df156c5b0df..8cb1c831c17 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -78,6 +78,7 @@ GLOBAL_VAR_INIT(nologevent, 0) body += " \[Heal\] " body += "

\[ " + body += "LOGS - " body += "VV - " body += "[ADMIN_TP(M,"TP")] - " if(M.client) diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index 03b5cb09720..464d0babf56 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -911,6 +911,11 @@ //M.client = null del(M.client) + else if(href_list["open_logging_view"]) + var/mob/M = locateUID(href_list["open_logging_view"]) + if(ismob(M)) + usr.client.open_logging_view(list(M), TRUE) + //Player Notes else if(href_list["addnote"]) var/target_ckey = href_list["addnote"] diff --git a/code/modules/admin/verbs/logging_view.dm b/code/modules/admin/verbs/logging_view.dm index 2a222e21dbd..d7240e9c1e8 100644 --- a/code/modules/admin/verbs/logging_view.dm +++ b/code/modules/admin/verbs/logging_view.dm @@ -4,7 +4,17 @@ GLOBAL_LIST_INIT(open_logging_views, list()) set category = "Admin" set name = "Open Logging View" set desc = "Opens the detailed logging viewer" + open_logging_view() - if(!GLOB.open_logging_views[usr.client.ckey]) - GLOB.open_logging_views[usr.client.ckey] = new /datum/log_viewer() - GLOB.open_logging_views[usr.client.ckey].show_ui(usr) \ No newline at end of file +/client/proc/open_logging_view(list/mob/mobs_to_add = null, clear_view = FALSE) + var/datum/log_viewer/cur_view = GLOB.open_logging_views[usr.client.ckey] + if(!cur_view) + cur_view = new /datum/log_viewer() + GLOB.open_logging_views[usr.client.ckey] = cur_view + else if(clear_view) + cur_view.clear_all() + + if(mobs_to_add?.len) + cur_view.add_mobs(mobs_to_add) + + cur_view.show_ui(usr) From d3cc0526d73dbcd4562838cb78fa7d3a971e6b86 Mon Sep 17 00:00:00 2001 From: joep van der velden Date: Sun, 22 Mar 2020 19:49:36 +0100 Subject: [PATCH 10/47] mob display name and text change --- code/datums/log_viewer.dm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/code/datums/log_viewer.dm b/code/datums/log_viewer.dm index e654becca3d..849665758c6 100644 --- a/code/datums/log_viewer.dm +++ b/code/datums/log_viewer.dm @@ -120,9 +120,9 @@ dat += "Mobs being used:" for(var/i in selected_mobs) var/mob/M = i - dat += "[M.name]" + dat += "[get_display_name(M)]" dat += "Add Mob" - dat += "Add Mob(via CKEY)" + dat += "Add Mob (by ckey)" dat += "Clear All Mobs" dat += "
" @@ -244,3 +244,11 @@ if(MISC_LOG) return "gray" return "slategray" + +/datum/log_viewer/proc/get_display_name(mob/M) + var/name = M.name + if(M.name != M.real_name) + name = "[name] ([M.real_name])" + if(isobserver(M)) + name = "[name] (DEAD)" + return name From a37652b70c7887d7af105a495ae646322f9e612b Mon Sep 17 00:00:00 2001 From: joep van der velden Date: Thu, 26 Mar 2020 21:34:55 +0100 Subject: [PATCH 11/47] Logging View scaling, health, formatting changes --- code/_onclick/item_attack.dm | 2 +- code/datums/log_record.dm | 33 ++++++++++++++----- code/datums/log_viewer.dm | 10 +++--- .../mecha/equipment/tools/mining_tools.dm | 2 +- code/game/mecha/equipment/tools/work_tools.dm | 2 +- code/game/mecha/mecha.dm | 2 +- code/game/objects/items.dm | 2 +- code/game/objects/items/robot/robot_items.dm | 2 +- 8 files changed, 35 insertions(+), 20 deletions(-) diff --git a/code/_onclick/item_attack.dm b/code/_onclick/item_attack.dm index d2a91da4020..cc0269cdc95 100644 --- a/code/_onclick/item_attack.dm +++ b/code/_onclick/item_attack.dm @@ -81,7 +81,7 @@ user.do_attack_animation(M) . = M.attacked_by(src, user, def_zone) - add_attack_logs(user, M, "Attacked with [name] (INTENT: [uppertext(user.a_intent)]) (DAMTYPE: [uppertext(damtype)])", (M.ckey && force > 0 && damtype != STAMINA) ? null : ATKLOG_ALMOSTALL) + add_attack_logs(user, M, "Attacked with [name] ([uppertext(user.a_intent)]) ([uppertext(damtype)])", (M.ckey && force > 0 && damtype != STAMINA) ? null : ATKLOG_ALMOSTALL) add_fingerprint(user) diff --git a/code/datums/log_record.dm b/code/datums/log_record.dm index 9b7d52b5390..7d127eedc7d 100644 --- a/code/datums/log_record.dm +++ b/code/datums/log_record.dm @@ -8,10 +8,10 @@ /datum/log_record/New(_log_type, _who, _what, _target, _where, _raw_time) log_type = _log_type - - who = get_subject_text(_who) + + who = get_subject_text(_who, _log_type) what = _what - target = get_subject_text(_target) + target = get_subject_text(_target, _log_type) if(!_where) _where = get_turf(_who) where = _where @@ -19,16 +19,31 @@ _raw_time = world.time raw_time = _raw_time -/datum/log_record/proc/get_subject_text(subject) +/datum/log_record/proc/get_subject_text(subject, log_type) if(ismob(subject) || isclient(subject) || istype(subject, /datum/mind)) - return key_name_admin(subject) - if(isatom(subject)) + . = key_name_admin(subject) + if(should_log_health(log_type) && isliving(subject)) + . += get_health_string(subject) + else if(isatom(subject)) var/atom/A = subject - return A.name - if(istype(subject, /datum)) + . = A.name + else if(istype(subject, /datum)) var/datum/D = subject return D.type - return subject + else + . = subject + +/datum/log_record/proc/get_health_string(var/mob/living/L) + var/OX = L.getOxyLoss() > 50 ? "[L.getOxyLoss()]" : L.getOxyLoss() + var/TX = L.getToxLoss() > 50 ? "[L.getToxLoss()]" : L.getToxLoss() + var/BU = L.getFireLoss() > 50 ? "[L.getFireLoss()]" : L.getFireLoss() + var/BR = L.getBruteLoss() > 50 ? "[L.getBruteLoss()]" : L.getBruteLoss() + return " ([L.health]: [OX] - [TX] - [BU] - [BR])" + +/datum/log_record/proc/should_log_health(log_type) + if(log_type == ATTACK_LOG || log_type == DEFENSE_LOG) + return TRUE + return FALSE /proc/compare_log_record(datum/log_record/A, datum/log_record/B) var/time_diff = A.raw_time - B.raw_time diff --git a/code/datums/log_viewer.dm b/code/datums/log_viewer.dm index 849665758c6..460cd47100f 100644 --- a/code/datums/log_viewer.dm +++ b/code/datums/log_viewer.dm @@ -111,8 +111,8 @@ var/trStyleTop = "border-top:2px solid; border-bottom:2px solid; padding-top: 5px; padding-bottom: 5px;" var/trStyle = "border-top:1px solid; border-bottom:1px solid; padding-top: 5px; padding-bottom: 5px;" var/dat - dat += "" - dat += "
" + dat += "" + dat += "
" dat += "Time Search Range: [gameTimestamp(wtime = time_from)]" dat += " To: [gameTimestamp(wtime = time_to)]" dat += "
" @@ -148,9 +148,9 @@ // Search results var/tdStyleTime = "width:80px; text-align:center;" var/tdStyleType = "width:80px; text-align:center;" - var/tdStyleWho = "width:300px; text-align:center;" + var/tdStyleWho = "width:400px; text-align:center;" var/tdStyleWhere = "width:150px; text-align:center;" - dat += "
" + dat += "
" dat += "" dat += "" for(var/i in log_records) @@ -164,7 +164,7 @@ dat += "
WhenTypeWhoWhatTargetWhere
" dat += "
" - var/datum/browser/popup = new(user, "Log viewer", "Log viewer", 1400, 600) + var/datum/browser/popup = new(user, "Log Viewer", "Log Viewer", 1500, 600) popup.set_content(dat) popup.open() diff --git a/code/game/mecha/equipment/tools/mining_tools.dm b/code/game/mecha/equipment/tools/mining_tools.dm index 5916d0f96c7..2248c37f518 100644 --- a/code/game/mecha/equipment/tools/mining_tools.dm +++ b/code/game/mecha/equipment/tools/mining_tools.dm @@ -94,7 +94,7 @@ /obj/item/mecha_parts/mecha_equipment/drill/proc/drill_mob(mob/living/target, mob/user) target.visible_message("[chassis] is drilling [target] with [src]!", "[chassis] is drilling you with [src]!") - add_attack_logs(user, target, "DRILLED with [src] (INTENT: [uppertext(user.a_intent)]) (DAMTYPE: [uppertext(damtype)])") + add_attack_logs(user, target, "DRILLED with [src] ([uppertext(user.a_intent)]) ([uppertext(damtype)])") if(target.stat == DEAD && target.getBruteLoss() >= 200) add_attack_logs(user, target, "gibbed") if(LAZYLEN(target.butcher_results)) diff --git a/code/game/mecha/equipment/tools/work_tools.dm b/code/game/mecha/equipment/tools/work_tools.dm index 63eeb21e165..5962a1eccbb 100644 --- a/code/game/mecha/equipment/tools/work_tools.dm +++ b/code/game/mecha/equipment/tools/work_tools.dm @@ -60,7 +60,7 @@ target.visible_message("[chassis] squeezes [target].", \ "[chassis] squeezes [target].",\ "You hear something crack.") - add_attack_logs(chassis.occupant, M, "Squeezed with [src] (INTENT: [uppertext(chassis.occupant.a_intent)]) (DAMTYE: [uppertext(damtype)])") + add_attack_logs(chassis.occupant, M, "Squeezed with [src] ([uppertext(chassis.occupant.a_intent)]) ([uppertext(damtype)])") start_cooldown() else step_away(M,chassis) diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index ec6f2c6456e..ddc2a44b278 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -851,7 +851,7 @@ return 0 use_power(melee_energy_drain) if(M.damtype == BRUTE || M.damtype == BURN) - add_attack_logs(M.occupant, src, "Mecha-attacked with [M] (INTENT: [uppertext(M.occupant.a_intent)]) (DAMTYPE: [uppertext(M.damtype)])") + add_attack_logs(M.occupant, src, "Mecha-attacked with [M] ([uppertext(M.occupant.a_intent)]) ([uppertext(M.damtype)])") . = ..() /obj/mecha/emag_act(mob/user) diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index d530d0d71d6..c0c5fd2f3d6 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -515,7 +515,7 @@ GLOBAL_DATUM_INIT(fire_overlay, /image, image("icon" = 'icons/goonstation/effect "You stab yourself in the eyes with [src]!" \ ) - add_attack_logs(user, M, "Eye-stabbed with [src] (INTENT: [uppertext(user.a_intent)])") + add_attack_logs(user, M, "Eye-stabbed with [src] ([uppertext(user.a_intent)])") if(istype(H)) var/obj/item/organ/internal/eyes/eyes = H.get_int_organ(/obj/item/organ/internal/eyes) diff --git a/code/game/objects/items/robot/robot_items.dm b/code/game/objects/items/robot/robot_items.dm index eae59151a38..f1487a09986 100644 --- a/code/game/objects/items/robot/robot_items.dm +++ b/code/game/objects/items/robot/robot_items.dm @@ -29,7 +29,7 @@ "[user] has prodded you with [src]!") playsound(loc, 'sound/weapons/egloves.ogg', 50, 1, -1) - add_attack_logs(user, M, "Stunned with [src] (INTENT: [uppertext(user.a_intent)])") + add_attack_logs(user, M, "Stunned with [src] ([uppertext(user.a_intent)])") /obj/item/borg/overdrive name = "Overdrive" From bdf2171a8395e6fde0a765b51332b8d7d0912f7d Mon Sep 17 00:00:00 2001 From: farie82 Date: Thu, 26 Mar 2020 22:18:22 +0100 Subject: [PATCH 12/47] Open Logging View -> Logging View --- code/modules/admin/verbs/logging_view.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/admin/verbs/logging_view.dm b/code/modules/admin/verbs/logging_view.dm index d7240e9c1e8..976554a0375 100644 --- a/code/modules/admin/verbs/logging_view.dm +++ b/code/modules/admin/verbs/logging_view.dm @@ -2,7 +2,7 @@ GLOBAL_LIST_INIT(open_logging_views, list()) /client/proc/cmd_admin_open_logging_view() set category = "Admin" - set name = "Open Logging View" + set name = "Logging View" set desc = "Opens the detailed logging viewer" open_logging_view() From 964e23bb48a7fc9b98be724f6513946b8938e59b Mon Sep 17 00:00:00 2001 From: craftxbox Date: Mon, 13 Apr 2020 00:23:15 -0230 Subject: [PATCH 13/47] styling fixes --- goon/browserassets/js/browserOutput.js | 42 +++++++++++++------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/goon/browserassets/js/browserOutput.js b/goon/browserassets/js/browserOutput.js index 3c266fc023e..d20d2eb239e 100644 --- a/goon/browserassets/js/browserOutput.js +++ b/goon/browserassets/js/browserOutput.js @@ -174,51 +174,51 @@ function setHighlightColor() { } } -function escapeRegex(input){ // put this in a function incase it ever needs to be used elsewhere, makes code cleaner +function escapeRegexCharacters(input){ //escapes any characters that could be interpreted as regex patterns, potentially causing patterns to break if not escaped return input.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); } //Highlights words based on user settings function highlightTerms(el) { - if(regexHasError) return; //just stop right there ig the regex is gonna except + if (regexHasError) return; //just stop right there ig the regex is gonna except function highlightRecursor(element,term){ //recursor function to do the highlighting proper - var regex = new RegExp("("+term+")","gi") + var regex = new RegExp(term,"gi"); function replace(str) { - return str.replace(regex,'$&') + return str.replace(regex,'$&'); } - var s='' - var work=element.innerHTML; - var ind=0; + var s = ''; + var work = element.innerHTML; + var ind = 0; while(ind < work.length) { - var next_term=work.substring(ind).search(regex); - if(next_term!=-1)next_term+=ind; - var next_tag =work.indexOf('<',ind) + var next_term = work.substring(ind).search(regex); + if(next_term != -1) next_term += ind; + var next_tag = work.indexOf('<',ind); if(next_tag == -1) { s+=replace(work.substring(ind)); break; } else if(next_term==-1) { - s+=work.substring(ind) + s += work.substring(ind); break; } else if(next_tag < next_term) { - var temp=work.indexOf('>',next_tag) - s+=work.substring(ind,temp+1); - ind=temp+1; + var temp = work.indexOf('>',next_tag); + s += work.substring(ind,temp+1); + ind = temp+1; } else { - s+=replace(work.substring(ind,next_tag)); - ind=next_tag + s += replace(work.substring(ind,next_tag)); + ind = next_tag; } } - element.innerHTML=s; + element.innerHTML = s; } for (var i = 0; i < opts.highlightTerms.length; i++) { //Each highlight term @@ -226,18 +226,18 @@ function highlightTerms(el) { if(!opts.highlightRegexEnable){ var innerTerms = opts.highlightTerms[i].split(" ") for(var a in innerTerms){ - highlightRecursor(el,escapeRegex(innerTerms[a])) + highlightRecursor(el, escapeRegexCharacters(innerTerms[a])) } } else { try{ - new RegExp(opts.highlightTerms[i],"gmi") // check to make sure the pattern wont cause issues + new RegExp(opts.highlightTerms[i],"gmi"); // check to make sure the pattern wont cause issues } catch(e){ - el.innerHTML+='
Your highlight regex pattern - '+opts.highlightTerms[i]+' - is malformed.
Your highlights have been disabled until they are next edited
Thrown exception: '+e+'
' + el.innerHTML += '
Your highlight regex pattern - '+opts.highlightTerms[i]+' - is malformed.
Your highlights have been disabled until they are next edited
Thrown exception: '+e+'
'; regexHasError = true; return; } - highlightRecursor(el,opts.highlightTerms[i]) + highlightRecursor(el, opts.highlightTerms[i]); } } } From c9f1a997bd2e4c6adbac6604dfb69ce9f0f8b115 Mon Sep 17 00:00:00 2001 From: craftxbox Date: Mon, 13 Apr 2020 00:25:48 -0230 Subject: [PATCH 14/47] extra styling fixes --- goon/browserassets/js/browserOutput.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/goon/browserassets/js/browserOutput.js b/goon/browserassets/js/browserOutput.js index d20d2eb239e..20162e8d3ca 100644 --- a/goon/browserassets/js/browserOutput.js +++ b/goon/browserassets/js/browserOutput.js @@ -183,11 +183,11 @@ function highlightTerms(el) { if (regexHasError) return; //just stop right there ig the regex is gonna except - function highlightRecursor(element,term){ //recursor function to do the highlighting proper - var regex = new RegExp(term,"gi"); + function highlightRecursor(element, term){ //recursor function to do the highlighting proper + var regex = new RegExp(term, "gi"); function replace(str) { - return str.replace(regex,'$&'); + return str.replace(regex, '$&'); } var s = ''; @@ -198,7 +198,7 @@ function highlightTerms(el) { var next_term = work.substring(ind).search(regex); if(next_term != -1) next_term += ind; - var next_tag = work.indexOf('<',ind); + var next_tag = work.indexOf('<', ind); if(next_tag == -1) { s+=replace(work.substring(ind)); break; @@ -208,12 +208,12 @@ function highlightTerms(el) { break; } else if(next_tag < next_term) { - var temp = work.indexOf('>',next_tag); + var temp = work.indexOf('>', next_tag); s += work.substring(ind,temp+1); ind = temp+1; } else { - s += replace(work.substring(ind,next_tag)); + s += replace(work.substring(ind, next_tag)); ind = next_tag; } } @@ -231,9 +231,9 @@ function highlightTerms(el) { } else { try{ - new RegExp(opts.highlightTerms[i],"gmi"); // check to make sure the pattern wont cause issues + new RegExp(opts.highlightTerms[i], "gmi"); // check to make sure the pattern wont cause issues } catch(e){ - el.innerHTML += '
Your highlight regex pattern - '+opts.highlightTerms[i]+' - is malformed.
Your highlights have been disabled until they are next edited
Thrown exception: '+e+'
'; + el.innerHTML += '
Your highlight regex pattern -- ' + opts.highlightTerms[i] + ' -- is malformed.
Your highlights have been disabled until they are next edited
Thrown exception: '+e+'
'; regexHasError = true; return; } From dc6a5691fa0d6f7b9dc1d1d949837c4644e5ea42 Mon Sep 17 00:00:00 2001 From: Fox McCloud Date: Mon, 4 May 2020 19:15:35 -0400 Subject: [PATCH 15/47] Applicator QoL Tweaks --- .../objects/items/weapons/storage/firstaid.dm | 2 +- .../reagents/reagent_containers/applicator.dm | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/code/game/objects/items/weapons/storage/firstaid.dm b/code/game/objects/items/weapons/storage/firstaid.dm index 4ff769a7d3f..1e22015bc97 100644 --- a/code/game/objects/items/weapons/storage/firstaid.dm +++ b/code/game/objects/items/weapons/storage/firstaid.dm @@ -205,7 +205,7 @@ if(empty) return new /obj/item/reagent_containers/hypospray/combat(src) - new /obj/item/reagent_containers/applicator/dual(src) // Because you ain't got no time to look at what damage dey taking yo + new /obj/item/reagent_containers/applicator/dual/syndi(src) // Because you ain't got no time to look at what damage dey taking yo new /obj/item/defibrillator/compact/combat/loaded(src) new /obj/item/clothing/glasses/hud/health/night(src) diff --git a/code/modules/reagents/reagent_containers/applicator.dm b/code/modules/reagents/reagent_containers/applicator.dm index dfa59c941ac..652b358b8fb 100644 --- a/code/modules/reagents/reagent_containers/applicator.dm +++ b/code/modules/reagents/reagent_containers/applicator.dm @@ -5,6 +5,7 @@ icon_state = "mender" item_state = "mender" volume = 200 + possible_transfer_amounts = null resistance_flags = ACID_PROOF container_type = REFILLABLE | AMOUNT_VISIBLE temperature_min = 270 @@ -93,6 +94,20 @@ playsound(get_turf(src), pick('sound/goonstation/items/mender.ogg', 'sound/goonstation/items/mender2.ogg'), 50, 1) +/obj/item/reagent_containers/applicator/verb/empty() + set name = "Empty Applicator" + set category = "Object" + set src in usr + + if(usr.incapacitated()) + return + if(alert(usr, "Are you sure you want to empty [src]?", "Empty Applicator:", "Yes", "No") != "Yes") + return + if(isturf(usr.loc) && loc == usr) + to_chat(usr, "You empty [src] onto the floor.") + reagents.reaction(usr.loc) + reagents.clear_reagents() + /obj/item/reagent_containers/applicator/brute name = "brute auto-mender" list_reagents = list("styptic_powder" = 200) @@ -104,3 +119,6 @@ /obj/item/reagent_containers/applicator/dual name = "dual auto-mender" list_reagents = list("synthflesh" = 200) + +/obj/item/reagent_containers/applicator/dual/syndi // It magically goes through hardsuits. Don't ask how. + ignore_flags = TRUE From 03fcfaaef8127ec3b58db27c6e4fe225f8e084a2 Mon Sep 17 00:00:00 2001 From: Fox McCloud Date: Sat, 9 May 2020 02:23:35 -0400 Subject: [PATCH 16/47] tweak --- code/modules/reagents/reagent_containers/applicator.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/reagents/reagent_containers/applicator.dm b/code/modules/reagents/reagent_containers/applicator.dm index 652b358b8fb..3ae12d696b2 100644 --- a/code/modules/reagents/reagent_containers/applicator.dm +++ b/code/modules/reagents/reagent_containers/applicator.dm @@ -103,7 +103,7 @@ return if(alert(usr, "Are you sure you want to empty [src]?", "Empty Applicator:", "Yes", "No") != "Yes") return - if(isturf(usr.loc) && loc == usr) + if(!usr.incapacitated() && isturf(usr.loc) && loc == usr) to_chat(usr, "You empty [src] onto the floor.") reagents.reaction(usr.loc) reagents.clear_reagents() From 0c6982cd0531ffe56a47d35720574088fabd7295 Mon Sep 17 00:00:00 2001 From: farie82 Date: Fri, 22 May 2020 07:56:40 +0200 Subject: [PATCH 17/47] Adds missing EOF line --- code/modules/admin/verbs/logging_view.dm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/modules/admin/verbs/logging_view.dm b/code/modules/admin/verbs/logging_view.dm index ba8171990dc..cafaab8f1d7 100644 --- a/code/modules/admin/verbs/logging_view.dm +++ b/code/modules/admin/verbs/logging_view.dm @@ -17,4 +17,5 @@ GLOBAL_LIST_INIT(open_logging_views, list()) if(mobs_to_add?.len) cur_view.add_mobs(mobs_to_add) - cur_view.show_ui(usr) \ No newline at end of file + cur_view.show_ui(usr) + From d96d3f2b7af2006865ce8e3e7f82a81c6c518feb Mon Sep 17 00:00:00 2001 From: mochi Date: Sun, 31 May 2020 17:11:04 +0200 Subject: [PATCH 18/47] #13499: Command amplification no longer applies to non-comms line Make a copy of message_pieces when instancing message datum for radio speech to allow editing the radio line without affecting the actual line --- code/game/objects/items/devices/radio/radio.dm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/code/game/objects/items/devices/radio/radio.dm b/code/game/objects/items/devices/radio/radio.dm index 4c2aaa82c1e..764aee032f4 100644 --- a/code/game/objects/items/devices/radio/radio.dm +++ b/code/game/objects/items/devices/radio/radio.dm @@ -411,11 +411,16 @@ GLOBAL_LIST_INIT(default_medbay_channels, list( jobname = "Unknown" voicemask = TRUE + // Copy the message pieces so we can safely edit comms line without affecting the actual line + var/list/message_pieces_copy = list() + for(var/datum/multilingual_say_piece/S in message_pieces) + message_pieces_copy += new /datum/multilingual_say_piece(S.speaking, S.message) + // Make us a message datum! var/datum/tcomms_message/tcm = new tcm.sender_name = displayname tcm.sender_job = jobname - tcm.message_pieces = message_pieces + tcm.message_pieces = message_pieces_copy tcm.source_level = position.z tcm.freq = connection.frequency tcm.vmask = voicemask From 5138ab09b2b840ec10572db291547d2eb969b58b Mon Sep 17 00:00:00 2001 From: mochi Date: Sun, 31 May 2020 19:00:45 +0200 Subject: [PATCH 19/47] #13493: Nitroglycerin chemical reaction no longer yields reagent The nitroglycerin reaction causes the explosion which is fine, but it also tries to generate a reagent of the same name, which doesn't exist. This commit prevents reaction from trying to spawn the reagent. --- code/modules/reagents/chemistry/recipes/pyrotechnics.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/reagents/chemistry/recipes/pyrotechnics.dm b/code/modules/reagents/chemistry/recipes/pyrotechnics.dm index f2740676314..b188afd968c 100644 --- a/code/modules/reagents/chemistry/recipes/pyrotechnics.dm +++ b/code/modules/reagents/chemistry/recipes/pyrotechnics.dm @@ -56,7 +56,7 @@ /datum/chemical_reaction/nitroglycerin name = "Nitroglycerin" id = "nitroglycerin" - result = "nitroglycerin" + result = null required_reagents = list("glycerol" = 1, "facid" = 1, "sacid" = 1) result_amount = 2 From 061a785d4093eb23c56f4c4b04f636e3696b96b8 Mon Sep 17 00:00:00 2001 From: mochi Date: Mon, 1 Jun 2020 01:23:24 +0200 Subject: [PATCH 20/47] #13365: Highlight regex no longer breaks HTML Highlighting specific terms with regex on caused the HTML code to break due to tags being affected by the highlighting mechanic. This commit fixes that, allowing regex highlighting to highlight the terms only without any issue. --- goon/browserassets/js/browserOutput.js | 35 +++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/goon/browserassets/js/browserOutput.js b/goon/browserassets/js/browserOutput.js index 40a69245188..d9af0b9eff5 100644 --- a/goon/browserassets/js/browserOutput.js +++ b/goon/browserassets/js/browserOutput.js @@ -176,20 +176,47 @@ function highlightTerms(el) { if(regexHasError) return; //just stop right there ig the regex is gonna except for (var i = 0; i < opts.highlightTerms.length; i++) { //Each highlight term if(opts.highlightTerms[i]) { + var term = opts.highlightTerms[i]; if(!opts.highlightRegexEnable){ - if(el.innerText.toString().toLowerCase().includes(opts.highlightTerms[i].toLowerCase())) //match normally + if(el.innerText.toString().toLowerCase().includes(term.toLowerCase())) //match normally el.innerHTML = ''+el.innerHTML+'' //encloseincludes continue; } var rexp; try{ - rexp = new RegExp(opts.highlightTerms[i],"gmi") + rexp = new RegExp(term,"gmi") } catch(e){ - el.innerHTML+='
Your highlight regex - '+opts.highlightTerms[i]+' - is malformed. Thrown exception: '+e+'' + el.innerHTML+='
Your highlight regex - '+term+' - is malformed. Thrown exception: '+e+'' regexHasError = true; return; } - el.innerHTML = el.innerHTML.replace(rexp,"$0") //i cant figure out a proper, non snowflakey way to let people select the group that gets highlighted + + // highlight using regex without destroying HTML + for (var j = 0; j < el.childNodes.length; j++) { + var child = el.childNodes[j]; + if (child.nodeType != Node.TEXT_NODE) { + if (child.className != "highlighted") + highlightTerms(child); + continue; + } + + var tx = child.textContent; + + var index = tx.toLowerCase().indexOf(term.toLowerCase()); + if (index > -1) { + var beforeNode = document.createTextNode(tx.substring(0, index)); + var highlightedNode = document.createElement("span"); + highlightedNode.innerText = term; + highlightedNode.className = "highlighted"; + highlightedNode.style.backgroundColor = opts.highlightColor; + var afterNode = document.createTextNode(tx.substring(index + term.length)); + + el.insertBefore(beforeNode, child); + el.insertBefore(highlightedNode, child); + el.insertBefore(afterNode, child); + el.removeChild(child); + } + } } } } From 5440f22a4dc38b1e6ee21d34061e8bab3767a7b3 Mon Sep 17 00:00:00 2001 From: mochi Date: Sat, 13 Jun 2020 14:12:57 +0200 Subject: [PATCH 21/47] Fix highlighted term losing its casing --- goon/browserassets/js/browserOutput.js | 28 +++++++++++++------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/goon/browserassets/js/browserOutput.js b/goon/browserassets/js/browserOutput.js index d9af0b9eff5..431fe18e010 100644 --- a/goon/browserassets/js/browserOutput.js +++ b/goon/browserassets/js/browserOutput.js @@ -72,7 +72,7 @@ var opts = { 'enableEmoji': true }; -var regexHasError = false; //variable to check if regex has excepted +var regexHasError = false; //variable to check if regex has excepted function outerHTML(el) { var wrap = document.createElement('div'); @@ -97,10 +97,10 @@ if (typeof String.prototype.trim !== 'function') { if (!String.prototype.includes) { String.prototype.includes = function(search, start) { 'use strict'; - + if (search instanceof RegExp) { throw TypeError('first argument must not be a RegExp'); - } + } if (start === undefined) { start = 0; } return this.indexOf(search, start) !== -1; }; @@ -124,7 +124,7 @@ function byondDecode(message) { // The replace for + is because FOR SOME REASON, BYOND replaces spaces with a + instead of %20, and a plus with %2b. // Marvelous. message = message.replace(/\+/g, "%20"); - try { + try { // This is a workaround for the above not always working when BYOND's shitty url encoding breaks. // Basically, sometimes BYOND's double encoding trick just arbitrarily produces something that makes decodeURIComponent // throw an "Invalid Encoding URI" URIError... the simplest way to work around this is to just ignore it and use unescape instead @@ -190,7 +190,7 @@ function highlightTerms(el) { regexHasError = true; return; } - + // highlight using regex without destroying HTML for (var j = 0; j < el.childNodes.length; j++) { var child = el.childNodes[j]; @@ -199,18 +199,18 @@ function highlightTerms(el) { highlightTerms(child); continue; } - + var tx = child.textContent; var index = tx.toLowerCase().indexOf(term.toLowerCase()); if (index > -1) { var beforeNode = document.createTextNode(tx.substring(0, index)); var highlightedNode = document.createElement("span"); - highlightedNode.innerText = term; + highlightedNode.innerText = tx.substring(index, index + term.length); highlightedNode.className = "highlighted"; highlightedNode.style.backgroundColor = opts.highlightColor; var afterNode = document.createTextNode(tx.substring(index + term.length)); - + el.insertBefore(beforeNode, child); el.insertBefore(highlightedNode, child); el.insertBefore(afterNode, child); @@ -630,7 +630,7 @@ $(function() { 'shideSpam': getCookie('hidespam'), 'darkChat': getCookie('darkChat'), }; - + if (savedConfig.sfontSize) { $messages.css('font-size', savedConfig.sfontSize); internalOutput('Loaded font size setting of: '+savedConfig.sfontSize+'', 'internal'); @@ -988,18 +988,18 @@ $(function() { } else { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } - + // synchronous requests are depricated in modern browsers - xmlHttp.open('GET', 'browserOutput.css', true); + xmlHttp.open('GET', 'browserOutput.css', true); xmlHttp.onload = function (e) { if (xmlHttp.status === 200) { // request successful - + // Generate Log var saved = ''; saved += $messages.html(); saved = saved.replace(/&/g, '&'); saved = saved.replace(/ Date: Fri, 17 Jul 2020 17:36:38 -0400 Subject: [PATCH 22/47] Fixes Loadout Errors --- .../preference/loadout/loadout_accessories.dm | 25 +++++++--------- .../client/preference/loadout/loadout_hat.dm | 29 +++++++++---------- 2 files changed, 24 insertions(+), 30 deletions(-) diff --git a/code/modules/client/preference/loadout/loadout_accessories.dm b/code/modules/client/preference/loadout/loadout_accessories.dm index 8805c6dd9a9..b9318fd9e8c 100644 --- a/code/modules/client/preference/loadout/loadout_accessories.dm +++ b/code/modules/client/preference/loadout/loadout_accessories.dm @@ -154,9 +154,6 @@ display_name = "corset, blue" path = /obj/item/clothing/accessory/corset/blue -/datum/gear/accessory/armband/job - subtype_path = /datum/gear/accessory/armband/job - subtype_cost_overlap = FALSE /datum/gear/accessory/armband_red display_name = "armband" @@ -166,41 +163,41 @@ display_name = "armband, blue-yellow" path = /obj/item/clothing/accessory/armband/yb -/datum/gear/accessory/armband/job/sec +/datum/gear/accessory/armband_job + subtype_path = /datum/gear/accessory/armband_job + subtype_cost_overlap = FALSE + +/datum/gear/accessory/armband_job/sec display_name = " armband, security" path = /obj/item/clothing/accessory/armband/sec allowed_roles = list("Head of Security", "Warden", "Detective", "Security Officer", "Brig Physician", "Security Pod Pilot") -/datum/gear/accessory/armband/job/cargo +/datum/gear/accessory/armband_job/cargo display_name = "cargo armband" path = /obj/item/clothing/accessory/armband/cargo allowed_roles = list("Quartermaster","Cargo Technician", "Shaft Miner") -/datum/gear/accessory/armband/job/medical +/datum/gear/accessory/armband_job/medical display_name = "armband, medical" path = /obj/item/clothing/accessory/armband/med allowed_roles = list("Chief Medical Officer", "Medical Doctor", "Coroner", "Paramedic", "Brig Physician") -/datum/gear/accessory/armband/job/emt +/datum/gear/accessory/armband_job/emt display_name = "armband, EMT" path = /obj/item/clothing/accessory/armband/medgreen allowed_roles = list("Paramedic", "Brig Physician") -/datum/gear/accessory/armband/job/engineering +/datum/gear/accessory/armband_job/engineering display_name = "armband, engineering" path = /obj/item/clothing/accessory/armband/engine allowed_roles = list("Chief Engineer","Station Engineer", "Life Support Specialist") -/datum/gear/accessory/armband/job/hydro +/datum/gear/accessory/armband_job/hydro display_name = "armband, hydroponics" path = /obj/item/clothing/accessory/armband/hydro allowed_roles = list("Botanist") -/datum/gear/accessory/armband/job/sci +/datum/gear/accessory/armband_job/sci display_name = "armband, science" path = /obj/item/clothing/accessory/armband/science allowed_roles = list("Research Director","Scientist", "Roboticist") - - - - diff --git a/code/modules/client/preference/loadout/loadout_hat.dm b/code/modules/client/preference/loadout/loadout_hat.dm index 758e70f654f..4993c8502ea 100644 --- a/code/modules/client/preference/loadout/loadout_hat.dm +++ b/code/modules/client/preference/loadout/loadout_hat.dm @@ -108,50 +108,47 @@ display_name = "cowboy hat, pink" path = /obj/item/clothing/head/cowboyhat/pink -//Berets Refactor -//Defining all Job Berets as no-overlap -//Somehow this doesn't break the DB. -/datum/gear/hat/beret/job - subtype_path = /datum/gear/hat/beret/job - subtype_cost_overlap = FALSE - -/datum/gear/hat/beret/purple +/datum/gear/hat/beret_purple display_name = "beret, purple" path = /obj/item/clothing/head/beret/purple_normal -/datum/gear/hat/beret/black +/datum/gear/hat/beret_black display_name = "beret, black" path = /obj/item/clothing/head/beret/black -/datum/gear/hat/beret/blue +/datum/gear/hat/beret_blue display_name = "beret, blue" path = /obj/item/clothing/head/beret/blue -/datum/gear/hat/beret/red +/datum/gear/hat/beret_red display_name = "beret, red" path = /obj/item/clothing/head/beret -/datum/gear/hat/beret/job/sec +/datum/gear/hat/beret_job + subtype_path = /datum/gear/hat/beret_job + subtype_cost_overlap = FALSE + +/datum/gear/hat/beret_job/sec display_name = "security beret" path = /obj/item/clothing/head/beret/sec allowed_roles = list("Head of Security", "Warden", "Security Officer", "Security Pod Pilot") -/datum/gear/hat/beret/job/sci +/datum/gear/hat/beret_job/sci display_name = "science beret" path = /obj/item/clothing/head/beret/sci allowed_roles = list("Research Director", "Scientist") -/datum/gear/hat/beret/job/med +/datum/gear/hat/beret_job/med display_name = "medical beret" path = /obj/item/clothing/head/beret/med allowed_roles = list("Chief Medical Officer", "Medical Doctor" , "Virologist", "Brig Physician" , "Coroner") -/datum/gear/hat/beret/job/eng +/datum/gear/hat/beret_job/eng display_name = "engineering beret" path = /obj/item/clothing/head/beret/eng allowed_roles = list("Chief Engineer", "Station Engineer") -/datum/gear/hat/beret/job/atmos +/datum/gear/hat/beret_job/atmos display_name = "atmospherics beret" path = /obj/item/clothing/head/beret/atmos allowed_roles = list("Chief Engineer", "Life Support Specialist") From cf5c8182dcbc0f78e387bdd4aab5602132dd4ca2 Mon Sep 17 00:00:00 2001 From: Mitchell Date: Fri, 24 Jul 2020 02:39:21 -0500 Subject: [PATCH 23/47] Emotional --- code/modules/mob/living/carbon/human/emote.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/modules/mob/living/carbon/human/emote.dm b/code/modules/mob/living/carbon/human/emote.dm index 10c2ac8f119..b69c13987b9 100644 --- a/code/modules/mob/living/carbon/human/emote.dm +++ b/code/modules/mob/living/carbon/human/emote.dm @@ -308,14 +308,14 @@ m_type = 1 if("bow", "bows") - if(!buckled) + if(!restrained()) var/M = handle_emote_param(param) message = "[src] bows[M ? " to [M]" : ""]." m_type = 1 if("salute", "salutes") - if(!buckled) + if(!restrained()) var/M = handle_emote_param(param) message = "[src] salutes[M ? " to [M]" : ""]." From ef230a92d0e3d428d868e084094e2d5ea6d80fa0 Mon Sep 17 00:00:00 2001 From: Kyep Date: Wed, 29 Jul 2020 18:54:15 -0700 Subject: [PATCH 24/47] Stops force-feeding non-carbon mobs reagents --- code/modules/reagents/reagent_containers/glass_containers.dm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/code/modules/reagents/reagent_containers/glass_containers.dm b/code/modules/reagents/reagent_containers/glass_containers.dm index 1e42899111b..1ab6a1c2511 100644 --- a/code/modules/reagents/reagent_containers/glass_containers.dm +++ b/code/modules/reagents/reagent_containers/glass_containers.dm @@ -47,6 +47,11 @@ reagents.reaction(M, REAGENT_TOUCH) reagents.clear_reagents() else + if(!iscarbon(M)) + // This is a simple mob, or some other kind of mob that cannot process reagents. + // It makes no sense to inject reagents into mobs that don't even process them. + to_chat(user, "You cannot find a way to feed [M].") + return if(M != user) M.visible_message("[user] attempts to feed something to [M].", \ "[user] attempts to feed something to you.") From b2b42d10fd9b2d96b9dfcd8d5069a128bd0c1914 Mon Sep 17 00:00:00 2001 From: Kyep Date: Fri, 31 Jul 2020 14:08:30 -0700 Subject: [PATCH 25/47] updates comment --- code/modules/reagents/reagent_containers/glass_containers.dm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/code/modules/reagents/reagent_containers/glass_containers.dm b/code/modules/reagents/reagent_containers/glass_containers.dm index 1ab6a1c2511..b2a25f5f8c0 100644 --- a/code/modules/reagents/reagent_containers/glass_containers.dm +++ b/code/modules/reagents/reagent_containers/glass_containers.dm @@ -48,8 +48,7 @@ reagents.clear_reagents() else if(!iscarbon(M)) - // This is a simple mob, or some other kind of mob that cannot process reagents. - // It makes no sense to inject reagents into mobs that don't even process them. + // Non-carbons can't process reagents to_chat(user, "You cannot find a way to feed [M].") return if(M != user) From 4e676f30c7a94250441a46758fffa73aae4ec267 Mon Sep 17 00:00:00 2001 From: Kyep Date: Fri, 31 Jul 2020 14:09:01 -0700 Subject: [PATCH 26/47] inline --- code/modules/reagents/reagent_containers/glass_containers.dm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/code/modules/reagents/reagent_containers/glass_containers.dm b/code/modules/reagents/reagent_containers/glass_containers.dm index b2a25f5f8c0..175ae757df4 100644 --- a/code/modules/reagents/reagent_containers/glass_containers.dm +++ b/code/modules/reagents/reagent_containers/glass_containers.dm @@ -47,8 +47,7 @@ reagents.reaction(M, REAGENT_TOUCH) reagents.clear_reagents() else - if(!iscarbon(M)) - // Non-carbons can't process reagents + if(!iscarbon(M)) // Non-carbons can't process reagents to_chat(user, "You cannot find a way to feed [M].") return if(M != user) From d49c2cbcabd9e4b0909dd161fdb5267ae3d6e70f Mon Sep 17 00:00:00 2001 From: Kyep Date: Sat, 1 Aug 2020 12:29:13 -0700 Subject: [PATCH 27/47] Fixes runtime in cryopod.dm:310 --- code/game/machinery/cryopod.dm | 1 + 1 file changed, 1 insertion(+) diff --git a/code/game/machinery/cryopod.dm b/code/game/machinery/cryopod.dm index 36196ea4eca..2e0c4c54375 100644 --- a/code/game/machinery/cryopod.dm +++ b/code/game/machinery/cryopod.dm @@ -302,6 +302,7 @@ // Eject dead people if(occupant.stat == DEAD) go_out() + return // Allow a gap between entering the pod and actually despawning. if(world.time - time_entered < time_till_despawn) From 45ccab31a3271d8c64996cbbb64333704bc69b21 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 2 Aug 2020 03:50:05 +0000 Subject: [PATCH 28/47] Bump elliptic from 6.5.2 to 6.5.3 in /tgui Bumps [elliptic](https://github.com/indutny/elliptic) from 6.5.2 to 6.5.3. - [Release notes](https://github.com/indutny/elliptic/releases) - [Commits](https://github.com/indutny/elliptic/compare/v6.5.2...v6.5.3) Signed-off-by: dependabot[bot] --- tgui/yarn.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tgui/yarn.lock b/tgui/yarn.lock index 8cc9b0c818e..84cab5eb253 100644 --- a/tgui/yarn.lock +++ b/tgui/yarn.lock @@ -1241,9 +1241,9 @@ bluebird@^3.5.5: integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.1.1, bn.js@^4.4.0: - version "4.11.8" - resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.8.tgz#2cde09eb5ee341f484746bb0309b3253b1b1442f" - integrity sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA== + version "4.11.9" + resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.9.tgz#26d556829458f9d1e81fc48952493d0ba3507828" + integrity sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw== body-parser@1.19.0: version "1.19.0" @@ -2198,9 +2198,9 @@ electron-to-chromium@^1.3.390: integrity sha512-DbCBdwtARI0l3e3m6ZIxVaTNahb6dSsmGjuag/twiVcWuM4MSpL5IfsJsJSyqLqxosE/m0CXlZaBmxegQW/dAg== elliptic@^6.0.0: - version "6.5.2" - resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.2.tgz#05c5678d7173c049d8ca433552224a495d0e3762" - integrity sha512-f4x70okzZbIQl/NSRLkI/+tteV/9WqL98zx+SQ69KbXxmVrmjwsNUPn/gYJJ0sHvEak24cZgHIPegRePAtA/xw== + version "6.5.3" + resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.3.tgz#cb59eb2efdaf73a0bd78ccd7015a62ad6e0f93d6" + integrity sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw== dependencies: bn.js "^4.4.0" brorand "^1.0.1" From 24d3698608daabeb160c82b5e729d0510e50139e Mon Sep 17 00:00:00 2001 From: SteelSlayer Date: Sun, 2 Aug 2020 10:39:15 -0500 Subject: [PATCH 29/47] Fixes bees turning invisible when you put a collar on them --- code/modules/mob/living/simple_animal/hostile/bees.dm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/code/modules/mob/living/simple_animal/hostile/bees.dm b/code/modules/mob/living/simple_animal/hostile/bees.dm index 3276416fe7f..3419279ffe5 100644 --- a/code/modules/mob/living/simple_animal/hostile/bees.dm +++ b/code/modules/mob/living/simple_animal/hostile/bees.dm @@ -95,6 +95,10 @@ for(var/mob/A in searched_for) . += A +// All bee sprites are made up of overlays. They do not have any special sprite overlays for items placed on them, such as collars, so this proc is unneeded. +/mob/living/simple_animal/hostile/poison/bees/regenerate_icons() + return + /mob/living/simple_animal/hostile/poison/bees/proc/generate_bee_visuals() overlays.Cut() From a2eb51c40e8ded78eb86d8a892e8d377ba7091b1 Mon Sep 17 00:00:00 2001 From: Bizzonium Date: Sun, 2 Aug 2020 18:33:44 +0300 Subject: [PATCH 30/47] Fix runtime in NewBan.dm when usr is bot --- code/modules/admin/NewBan.dm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/modules/admin/NewBan.dm b/code/modules/admin/NewBan.dm index 9aab12234d2..293504919d4 100644 --- a/code/modules/admin/NewBan.dm +++ b/code/modules/admin/NewBan.dm @@ -103,7 +103,8 @@ GLOBAL_PROTECT(banlist_savefile) // Obvious reasons GLOB.banlist_savefile.cd = "/base" if( GLOB.banlist_savefile.dir.Find("[ckey][computerid]") ) - to_chat(usr, "Ban already exists.") + if(usr) + to_chat(usr, "Ban already exists.") return 0 else GLOB.banlist_savefile.dir.Add("[ckey][computerid]") From 710c32553f464cd219e7018106a2b6b36edd3021 Mon Sep 17 00:00:00 2001 From: Bizzonium Date: Sun, 2 Aug 2020 21:16:56 +0300 Subject: [PATCH 31/47] Sanitize usr --- code/modules/admin/NewBan.dm | 6 +++--- code/modules/admin/sql_notes.dm | 24 ++++++++++++++---------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/code/modules/admin/NewBan.dm b/code/modules/admin/NewBan.dm index 293504919d4..3e74c0854be 100644 --- a/code/modules/admin/NewBan.dm +++ b/code/modules/admin/NewBan.dm @@ -138,9 +138,9 @@ GLOBAL_PROTECT(banlist_savefile) // Obvious reasons log_admin("Ban Expired: [key]") message_admins("Ban Expired: [key]") else - ban_unban_log_save("[key_name_admin(usr)] unbanned [key]") - log_admin("[key_name_admin(usr)] unbanned [key]") - message_admins("[key_name_admin(usr)] unbanned: [key]") + ban_unban_log_save("[usr ? key_name_admin(usr) : "Bot"] unbanned [key]") + log_admin("[usr ? key_name_admin(usr) : "Bot"] unbanned [key]") + message_admins("[usr ? key_name_admin(usr) : "Bot"] unbanned: [key]") feedback_inc("ban_unban",1) usr.client.holder.DB_ban_unban( ckey(key), BANTYPE_ANY_FULLBAN) for(var/A in GLOB.banlist_savefile.dir) diff --git a/code/modules/admin/sql_notes.dm b/code/modules/admin/sql_notes.dm index a438a43eaec..5c73dda3beb 100644 --- a/code/modules/admin/sql_notes.dm +++ b/code/modules/admin/sql_notes.dm @@ -2,7 +2,8 @@ if(checkrights && !check_rights(R_ADMIN|R_MOD)) return if(!GLOB.dbcon.IsConnected()) - to_chat(usr, "Failed to establish database connection.") + if(usr) + to_chat(usr, "Failed to establish database connection.") return if(!target_ckey) @@ -19,7 +20,8 @@ log_game("SQL ERROR obtaining ckey from player table. Error : \[[err]\]\n") return if(!query_find_ckey.NextRow()) - to_chat(usr, "[target_ckey] has not been seen before, you can only add notes to known players.") + if(usr) + to_chat(usr, "[target_ckey] has not been seen before, you can only add notes to known players.") return var/exp_data = query_find_ckey.item[2] @@ -52,8 +54,8 @@ log_game("SQL ERROR adding new note to table. Error : \[[err]\]\n") return if(logged) - log_admin("[key_name(usr)] has added a note to [target_ckey]: [notetext]") - message_admins("[key_name_admin(usr)] has added a note to [target_ckey]:
[notetext]") + log_admin("[usr ? key_name(usr) : "Bot" ] has added a note to [target_ckey]: [notetext]") + message_admins("[usr ? key_name_admin(usr) : "Bot"] has added a note to [target_ckey]:
[notetext]") show_note(target_ckey) /proc/remove_note(note_id) @@ -63,7 +65,8 @@ var/notetext var/adminckey if(!GLOB.dbcon.IsConnected()) - to_chat(usr, "Failed to establish database connection.") + if(usr) + to_chat(usr, "Failed to establish database connection.") return if(!note_id) return @@ -82,15 +85,16 @@ var/err = query_del_note.ErrorMsg() log_game("SQL ERROR removing note from table. Error : \[[err]\]\n") return - log_admin("[key_name(usr)] has removed a note made by [adminckey] from [ckey]: [notetext]") - message_admins("[key_name_admin(usr)] has removed a note made by [adminckey] from [ckey]:
[notetext]") + log_admin("[usr ? key_name(usr) : "Bot" ] has removed a note made by [adminckey] from [ckey]: [notetext]") + message_admins("[usr ? key_name_admin(usr) : "Bot"] has removed a note made by [adminckey] from [ckey]:
[notetext]") show_note(ckey) /proc/edit_note(note_id) if(!check_rights(R_ADMIN|R_MOD)) return if(!GLOB.dbcon.IsConnected()) - to_chat(usr, "Failed to establish database connection.") + if(usr) + to_chat(usr, "Failed to establish database connection.") return if(!note_id) return @@ -117,8 +121,8 @@ var/err = query_update_note.ErrorMsg() log_game("SQL ERROR editing note. Error : \[[err]\]\n") return - log_admin("[key_name(usr)] has edited [target_ckey]'s note made by [adminckey] from \"[old_note]\" to \"[new_note]\"") - message_admins("[key_name_admin(usr)] has edited [target_ckey]'s note made by [adminckey] from \"[old_note]\" to \"[new_note]\"") + log_admin("[usr ? key_name(usr) : "Bot" ] has edited [target_ckey]'s note made by [adminckey] from \"[old_note]\" to \"[new_note]\"") + message_admins("[usr ? key_name_admin(usr) : "Bot"] has edited [target_ckey]'s note made by [adminckey] from \"[old_note]\" to \"[new_note]\"") show_note(target_ckey) /proc/show_note(target_ckey, index, linkless = 0) From 2f61e6b4bcc9068c471c62b91f5bccadaf0d1f45 Mon Sep 17 00:00:00 2001 From: Bizzonium Date: Sun, 2 Aug 2020 18:49:26 +0300 Subject: [PATCH 32/47] Fix runtime in Hallucination.dm when target.client is null --- code/modules/flufftext/Hallucination.dm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/code/modules/flufftext/Hallucination.dm b/code/modules/flufftext/Hallucination.dm index 905b629a0b9..78cda2c0f88 100644 --- a/code/modules/flufftext/Hallucination.dm +++ b/code/modules/flufftext/Hallucination.dm @@ -159,6 +159,8 @@ Gunshots/explosions/opening doors/less rare audio (done) next_expand = world.time + FAKE_FLOOD_EXPAND_TIME /obj/effect/hallucination/fake_flood/proc/Expand() + if(!target) + qdel(src) for(var/turf/FT in flood_turfs) for(var/dir in GLOB.cardinal) var/turf/T = get_step(FT, dir) From b78530873ecacd9543fbd23a28e67bd0c410afb2 Mon Sep 17 00:00:00 2001 From: Bizzonium Date: Sun, 2 Aug 2020 23:34:55 +0300 Subject: [PATCH 33/47] Fix type of new nuke code in blob gamemode --- code/game/gamemodes/blob/blob_report.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/gamemodes/blob/blob_report.dm b/code/game/gamemodes/blob/blob_report.dm index 9c7fb99fe81..8f6ba965222 100644 --- a/code/game/gamemodes/blob/blob_report.dm +++ b/code/game/gamemodes/blob/blob_report.dm @@ -18,7 +18,7 @@ intercepttext += "
Note in the event of a quarantine breach or uncontrolled spread of the biohazard, the directive 7-10 may be upgraded to a directive 7-12.
" intercepttext += "Message ends." if(2) - var/nukecode = rand(10000, 99999) + var/nukecode = "[rand(10000, 99999)]" for(var/obj/machinery/nuclearbomb/bomb in GLOB.machines) if(bomb && bomb.r_code) if(is_station_level(bomb.z)) From 5d779da274e68d567e7ffa2ed856701c26f1882f Mon Sep 17 00:00:00 2001 From: Bizzonium Date: Mon, 3 Aug 2020 00:02:41 +0300 Subject: [PATCH 34/47] Better code --- code/modules/admin/NewBan.dm | 6 +++--- code/modules/admin/sql_notes.dm | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/code/modules/admin/NewBan.dm b/code/modules/admin/NewBan.dm index 3e74c0854be..293504919d4 100644 --- a/code/modules/admin/NewBan.dm +++ b/code/modules/admin/NewBan.dm @@ -138,9 +138,9 @@ GLOBAL_PROTECT(banlist_savefile) // Obvious reasons log_admin("Ban Expired: [key]") message_admins("Ban Expired: [key]") else - ban_unban_log_save("[usr ? key_name_admin(usr) : "Bot"] unbanned [key]") - log_admin("[usr ? key_name_admin(usr) : "Bot"] unbanned [key]") - message_admins("[usr ? key_name_admin(usr) : "Bot"] unbanned: [key]") + ban_unban_log_save("[key_name_admin(usr)] unbanned [key]") + log_admin("[key_name_admin(usr)] unbanned [key]") + message_admins("[key_name_admin(usr)] unbanned: [key]") feedback_inc("ban_unban",1) usr.client.holder.DB_ban_unban( ckey(key), BANTYPE_ANY_FULLBAN) for(var/A in GLOB.banlist_savefile.dir) diff --git a/code/modules/admin/sql_notes.dm b/code/modules/admin/sql_notes.dm index 5c73dda3beb..4307fe57846 100644 --- a/code/modules/admin/sql_notes.dm +++ b/code/modules/admin/sql_notes.dm @@ -54,8 +54,8 @@ log_game("SQL ERROR adding new note to table. Error : \[[err]\]\n") return if(logged) - log_admin("[usr ? key_name(usr) : "Bot" ] has added a note to [target_ckey]: [notetext]") - message_admins("[usr ? key_name_admin(usr) : "Bot"] has added a note to [target_ckey]:
[notetext]") + log_admin("[usr ? key_name(usr) : adminckey] has added a note to [target_ckey]: [notetext]") + message_admins("[usr ? key_name_admin(usr) : adminckey] has added a note to [target_ckey]:
[notetext]") show_note(target_ckey) /proc/remove_note(note_id) @@ -85,8 +85,8 @@ var/err = query_del_note.ErrorMsg() log_game("SQL ERROR removing note from table. Error : \[[err]\]\n") return - log_admin("[usr ? key_name(usr) : "Bot" ] has removed a note made by [adminckey] from [ckey]: [notetext]") - message_admins("[usr ? key_name_admin(usr) : "Bot"] has removed a note made by [adminckey] from [ckey]:
[notetext]") + log_admin("[usr ? key_name(usr) : adminckey] has removed a note made by [adminckey] from [ckey]: [notetext]") + message_admins("[usr ? key_name_admin(usr) : adminckey] has removed a note made by [adminckey] from [ckey]:
[notetext]") show_note(ckey) /proc/edit_note(note_id) @@ -121,8 +121,8 @@ var/err = query_update_note.ErrorMsg() log_game("SQL ERROR editing note. Error : \[[err]\]\n") return - log_admin("[usr ? key_name(usr) : "Bot" ] has edited [target_ckey]'s note made by [adminckey] from \"[old_note]\" to \"[new_note]\"") - message_admins("[usr ? key_name_admin(usr) : "Bot"] has edited [target_ckey]'s note made by [adminckey] from \"[old_note]\" to \"[new_note]\"") + log_admin("[usr ? key_name(usr) : adminckey] has edited [target_ckey]'s note made by [adminckey] from \"[old_note]\" to \"[new_note]\"") + message_admins("[usr ? key_name_admin(usr) : adminckey] has edited [target_ckey]'s note made by [adminckey] from \"[old_note]\" to \"[new_note]\"") show_note(target_ckey) /proc/show_note(target_ckey, index, linkless = 0) From 372fd1ba818edf30038a8da539e83939a9e1f9b4 Mon Sep 17 00:00:00 2001 From: Bizzonium Date: Mon, 3 Aug 2020 00:13:03 +0300 Subject: [PATCH 35/47] Code improvements --- code/modules/flufftext/Hallucination.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/modules/flufftext/Hallucination.dm b/code/modules/flufftext/Hallucination.dm index 78cda2c0f88..21b99acb910 100644 --- a/code/modules/flufftext/Hallucination.dm +++ b/code/modules/flufftext/Hallucination.dm @@ -149,18 +149,18 @@ Gunshots/explosions/opening doors/less rare audio (done) /obj/effect/hallucination/fake_flood/process() if(!target) qdel(src) + return if(next_expand <= world.time) radius++ if(radius > FAKE_FLOOD_MAX_RADIUS) qdel(src) + return Expand() if((get_turf(target) in flood_turfs) && !target.internal) target.hallucinate("fake_alert", "too_much_tox") next_expand = world.time + FAKE_FLOOD_EXPAND_TIME /obj/effect/hallucination/fake_flood/proc/Expand() - if(!target) - qdel(src) for(var/turf/FT in flood_turfs) for(var/dir in GLOB.cardinal) var/turf/T = get_step(FT, dir) From 9b1d61bdf966438f1c561e09ef249dadbd813e50 Mon Sep 17 00:00:00 2001 From: Bizzonium Date: Mon, 3 Aug 2020 00:28:50 +0300 Subject: [PATCH 36/47] Code improvements --- code/modules/admin/sql_notes.dm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/code/modules/admin/sql_notes.dm b/code/modules/admin/sql_notes.dm index 4307fe57846..04e28737479 100644 --- a/code/modules/admin/sql_notes.dm +++ b/code/modules/admin/sql_notes.dm @@ -85,8 +85,8 @@ var/err = query_del_note.ErrorMsg() log_game("SQL ERROR removing note from table. Error : \[[err]\]\n") return - log_admin("[usr ? key_name(usr) : adminckey] has removed a note made by [adminckey] from [ckey]: [notetext]") - message_admins("[usr ? key_name_admin(usr) : adminckey] has removed a note made by [adminckey] from [ckey]:
[notetext]") + log_admin("[usr ? key_name(usr) : "Bot"] has removed a note made by [adminckey] from [ckey]: [notetext]") + message_admins("[usr ? key_name_admin(usr) : "Bot"] has removed a note made by [adminckey] from [ckey]:
[notetext]") show_note(ckey) /proc/edit_note(note_id) @@ -121,8 +121,8 @@ var/err = query_update_note.ErrorMsg() log_game("SQL ERROR editing note. Error : \[[err]\]\n") return - log_admin("[usr ? key_name(usr) : adminckey] has edited [target_ckey]'s note made by [adminckey] from \"[old_note]\" to \"[new_note]\"") - message_admins("[usr ? key_name_admin(usr) : adminckey] has edited [target_ckey]'s note made by [adminckey] from \"[old_note]\" to \"[new_note]\"") + log_admin("[usr ? key_name(usr) : "Bot"] has edited [target_ckey]'s note made by [adminckey] from \"[old_note]\" to \"[new_note]\"") + message_admins("[usr ? key_name_admin(usr) : "Bot"] has edited [target_ckey]'s note made by [adminckey] from \"[old_note]\" to \"[new_note]\"") show_note(target_ckey) /proc/show_note(target_ckey, index, linkless = 0) From f3d2c5ea424917db53a3ea628d23e371b7f2482b Mon Sep 17 00:00:00 2001 From: CornMyCob Date: Thu, 6 Aug 2020 12:26:28 +0100 Subject: [PATCH 37/47] fixes exploit --- code/game/objects/structures/girders.dm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/code/game/objects/structures/girders.dm b/code/game/objects/structures/girders.dm index 5fea799ecb0..6d27b21e686 100644 --- a/code/game/objects/structures/girders.dm +++ b/code/game/objects/structures/girders.dm @@ -76,14 +76,14 @@ if(istype(W,/obj/item/stack/rods)) var/obj/item/stack/rods/S = W if(state == GIRDER_DISPLACED) - if(S.get_amount() < 2) - to_chat(user, "You need at least two rods to create a false wall!") + if(S.get_amount() < 5) + to_chat(user, "You need at least five rods to create a false wall!") return to_chat(user, "You start building a reinforced false wall...") if(do_after(user, 20, target = src)) - if(!loc || !S || S.get_amount() < 2) + if(!loc || !S || S.get_amount() < 5) return - S.use(2) + S.use(5) to_chat(user, "You create a false wall. Push on it to open or close the passage.") var/obj/structure/falsewall/iron/FW = new (loc) transfer_fingerprints_to(FW) From cc04a0fb77e8e6e9601b51997246efd703c7d8e7 Mon Sep 17 00:00:00 2001 From: mochi Date: Fri, 7 Aug 2020 12:39:58 +0200 Subject: [PATCH 38/47] Fully revert browserOutput.js --- goon/browserassets/js/browserOutput.js | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/goon/browserassets/js/browserOutput.js b/goon/browserassets/js/browserOutput.js index 38bbb12d688..3cac81ca8e2 100644 --- a/goon/browserassets/js/browserOutput.js +++ b/goon/browserassets/js/browserOutput.js @@ -72,7 +72,7 @@ var opts = { 'enableEmoji': true }; -var regexHasError = false; //variable to check if regex has excepted +var regexHasError = false; //variable to check if regex has excepted function outerHTML(el) { var wrap = document.createElement('div'); @@ -97,10 +97,10 @@ if (typeof String.prototype.trim !== 'function') { if (!String.prototype.includes) { String.prototype.includes = function(search, start) { 'use strict'; - + if (search instanceof RegExp) { throw TypeError('first argument must not be a RegExp'); - } + } if (start === undefined) { start = 0; } return this.indexOf(search, start) !== -1; }; @@ -124,7 +124,7 @@ function byondDecode(message) { // The replace for + is because FOR SOME REASON, BYOND replaces spaces with a + instead of %20, and a plus with %2b. // Marvelous. message = message.replace(/\+/g, "%20"); - try { + try { // This is a workaround for the above not always working when BYOND's shitty url encoding breaks. // Basically, sometimes BYOND's double encoding trick just arbitrarily produces something that makes decodeURIComponent // throw an "Invalid Encoding URI" URIError... the simplest way to work around this is to just ignore it and use unescape instead @@ -217,13 +217,12 @@ function highlightTerms(el) { ind = next_tag; } } - + element.innerHTML = s; } - + for (var i = 0; i < opts.highlightTerms.length; i++) { //Each highlight term if(opts.highlightTerms[i]) { - var term = opts.highlightTerms[i]; if(!opts.highlightRegexEnable){ var innerTerms = opts.highlightTerms[i].split(" ") for(var a in innerTerms){ @@ -653,7 +652,7 @@ $(function() { 'shideSpam': getCookie('hidespam'), 'darkChat': getCookie('darkChat'), }; - + if (savedConfig.sfontSize) { $messages.css('font-size', savedConfig.sfontSize); internalOutput('Loaded font size setting of: '+savedConfig.sfontSize+'', 'internal'); @@ -1011,18 +1010,18 @@ $(function() { } else { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } - + // synchronous requests are depricated in modern browsers - xmlHttp.open('GET', 'browserOutput.css', true); + xmlHttp.open('GET', 'browserOutput.css', true); xmlHttp.onload = function (e) { if (xmlHttp.status === 200) { // request successful - + // Generate Log var saved = ''; saved += $messages.html(); saved = saved.replace(/&/g, '&'); saved = saved.replace(/ Date: Fri, 7 Aug 2020 13:34:09 +0200 Subject: [PATCH 39/47] use default null --- code/modules/reagents/chemistry/recipes/pyrotechnics.dm | 1 - 1 file changed, 1 deletion(-) diff --git a/code/modules/reagents/chemistry/recipes/pyrotechnics.dm b/code/modules/reagents/chemistry/recipes/pyrotechnics.dm index b188afd968c..abdf0305934 100644 --- a/code/modules/reagents/chemistry/recipes/pyrotechnics.dm +++ b/code/modules/reagents/chemistry/recipes/pyrotechnics.dm @@ -56,7 +56,6 @@ /datum/chemical_reaction/nitroglycerin name = "Nitroglycerin" id = "nitroglycerin" - result = null required_reagents = list("glycerol" = 1, "facid" = 1, "sacid" = 1) result_amount = 2 From c0f98deeab2b007a1cb7dca7c945ab73807276ab Mon Sep 17 00:00:00 2001 From: Kyep Date: Fri, 7 Aug 2020 06:26:03 -0700 Subject: [PATCH 40/47] Fixes cult summon runtime --- code/modules/power/singularity/narsie.dm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/modules/power/singularity/narsie.dm b/code/modules/power/singularity/narsie.dm index 80b10ab3a8b..fe1494e0969 100644 --- a/code/modules/power/singularity/narsie.dm +++ b/code/modules/power/singularity/narsie.dm @@ -127,7 +127,8 @@ /obj/singularity/narsie/proc/acquire(var/mob/food) if(food == target) return - to_chat(target, "[uppertext(SSticker.cultdat.entity_name)] HAS LOST INTEREST IN YOU") + if(target) + to_chat(target, "[uppertext(SSticker.cultdat.entity_name)] HAS LOST INTEREST IN YOU") target = food if(ishuman(target)) to_chat(target, "[uppertext(SSticker.cultdat.entity_name)] HUNGERS FOR YOUR SOUL") From 1fa9862a203c67a334866815299fc8c72f2f544f Mon Sep 17 00:00:00 2001 From: Kyep <16434066+Kyep@users.noreply.github.com> Date: Fri, 7 Aug 2020 13:31:47 +0000 Subject: [PATCH 41/47] Update code/modules/power/singularity/narsie.dm Co-authored-by: AffectedArc07 --- code/modules/power/singularity/narsie.dm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/code/modules/power/singularity/narsie.dm b/code/modules/power/singularity/narsie.dm index fe1494e0969..bead9c935ef 100644 --- a/code/modules/power/singularity/narsie.dm +++ b/code/modules/power/singularity/narsie.dm @@ -127,8 +127,9 @@ /obj/singularity/narsie/proc/acquire(var/mob/food) if(food == target) return - if(target) - to_chat(target, "[uppertext(SSticker.cultdat.entity_name)] HAS LOST INTEREST IN YOU") + if(!target) + return + to_chat(target, "[uppertext(SSticker.cultdat.entity_name)] HAS LOST INTEREST IN YOU") target = food if(ishuman(target)) to_chat(target, "[uppertext(SSticker.cultdat.entity_name)] HUNGERS FOR YOUR SOUL") From 0c33fc1eb79ff717ba161d8fa34010964fdcbe95 Mon Sep 17 00:00:00 2001 From: Kyep Date: Fri, 7 Aug 2020 07:31:42 -0700 Subject: [PATCH 42/47] mass hallucination event only affects station --- code/modules/events/mass_hallucination.dm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/code/modules/events/mass_hallucination.dm b/code/modules/events/mass_hallucination.dm index b8bde0a1a67..b8f45023a27 100644 --- a/code/modules/events/mass_hallucination.dm +++ b/code/modules/events/mass_hallucination.dm @@ -6,6 +6,9 @@ var/mob/living/carbon/human/H = thing if(H.stat == DEAD) continue + var/turf/T = get_turf(H) + if(!is_station_level(T.z)) + continue var/armor = H.getarmor(type = "rad") if((RADIMMUNE in H.dna.species.species_traits) || armor >= 75) // Leave radiation-immune species/rad armored players completely unaffected continue From 0cccd0ebf0f8fb8bee9b3eb9b697e1e69ed3975f Mon Sep 17 00:00:00 2001 From: joep van der velden Date: Fri, 7 Aug 2020 23:55:11 +0200 Subject: [PATCH 43/47] Improves botany fruit logging. Make throw logging more logical --- code/modules/hydroponics/grown.dm | 15 +++++++++++++++ code/modules/hydroponics/plant_genes.dm | 8 ++++++++ code/modules/mob/living/living_defense.dm | 2 +- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/code/modules/hydroponics/grown.dm b/code/modules/hydroponics/grown.dm index 5ad8a5f32f4..282976e1b5e 100644 --- a/code/modules/hydroponics/grown.dm +++ b/code/modules/hydroponics/grown.dm @@ -117,6 +117,7 @@ /obj/item/reagent_containers/food/snacks/grown/throw_impact(atom/hit_atom) if(!..()) //was it caught by a mob? if(seed) + log_action(thrownby, hit_atom, "Thrown [src] at") for(var/datum/plant_gene/trait/T in seed.genes) T.on_throw_impact(src, hit_atom) if(seed.get_gene(/datum/plant_gene/trait/squash)) @@ -190,3 +191,17 @@ else return ..() +/obj/item/reagent_containers/food/snacks/grown/proc/log_action(mob/user, atom/target, what_done) + var/reagent_str = reagents.log_list() + var/genes_str + if(seed && length(seed.genes)) + var/list/plant_gene_names = list() + for(var/datum/plant_gene/trait/T in seed.genes) + if(T.dangerous) + plant_gene_names += T.name + genes_str = english_list(plant_gene_names) + else + genes_str = "No genes" + + add_attack_logs(user, target, "[what_done] ([reagent_str] | [genes_str])") + diff --git a/code/modules/hydroponics/plant_genes.dm b/code/modules/hydroponics/plant_genes.dm index a4c6fe7280d..ef505e2842d 100644 --- a/code/modules/hydroponics/plant_genes.dm +++ b/code/modules/hydroponics/plant_genes.dm @@ -139,6 +139,8 @@ var/rate = 0.05 var/examine_line = "" var/list/origin_tech = null + /// Used to determine if the trait should be logged when the holder is used + var/dangerous = FALSE var/trait_id // must be set and equal for any two traits of the same type /datum/plant_gene/trait/Copy() @@ -194,6 +196,7 @@ name = "Liquid Contents" examine_line = "It has a lot of liquid contents inside." origin_tech = list("biotech" = 5) + dangerous = TRUE /datum/plant_gene/trait/slip // Makes plant slippery, unless it has a grown-type trash. Then the trash gets slippery. @@ -201,6 +204,7 @@ name = "Slippery Skin" rate = 0.1 examine_line = "It has a very slippery skin." + dangerous = TRUE /datum/plant_gene/trait/slip/on_new(obj/item/reagent_containers/food/snacks/grown/G, newloc) . = ..() @@ -224,6 +228,7 @@ name = "Electrical Activity" rate = 0.2 origin_tech = list("powerstorage" = 5) + dangerous = TRUE /datum/plant_gene/trait/cell_charge/on_slip(obj/item/reagent_containers/food/snacks/grown/G, mob/living/carbon/C) var/power = G.seed.potency*rate @@ -298,6 +303,7 @@ name = "Bluespace Activity" rate = 0.1 origin_tech = list("bluespace" = 5) + dangerous = TRUE /datum/plant_gene/trait/teleport/on_squash(obj/item/reagent_containers/food/snacks/grown/G, atom/target) if(isliving(target)) @@ -385,6 +391,7 @@ /datum/plant_gene/trait/stinging name = "Hypodermic Prickles" + dangerous = TRUE /datum/plant_gene/trait/stinging/on_throw_impact(obj/item/reagent_containers/food/snacks/grown/G, atom/target) if(isliving(target) && G.reagents && G.reagents.total_volume) @@ -398,6 +405,7 @@ /datum/plant_gene/trait/smoke name = "gaseous decomposition" + dangerous = TRUE /datum/plant_gene/trait/smoke/on_squash(obj/item/reagent_containers/food/snacks/grown/G, atom/target) var/datum/effect_system/smoke_spread/chem/S = new diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index b38f1819524..1f0f1cfa0f4 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -113,7 +113,7 @@ var/armor = run_armor_check(zone, "melee", "Your armor has protected your [parse_zone(zone)].", "Your armor has softened hit to your [parse_zone(zone)].", I.armour_penetration) apply_damage(I.throwforce, dtype, zone, armor, is_sharp(I), I) if(I.thrownby) - add_attack_logs(I.thrownby, src, "Hit with thrown [I]") + add_attack_logs(I.thrownby, src, "Hit with thrown [I]", !I.throwforce ? ATKLOG_ALMOSTALL : null) // Only message if the person gets damages else return 1 else From f4910dcc795d6a0b87cf65db352af7c91be14cf3 Mon Sep 17 00:00:00 2001 From: joep van der velden Date: Sat, 8 Aug 2020 00:03:16 +0200 Subject: [PATCH 44/47] Makes grown/On_Consume actually work properly --- code/modules/hydroponics/grown.dm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/modules/hydroponics/grown.dm b/code/modules/hydroponics/grown.dm index 5ad8a5f32f4..7956091a7bf 100644 --- a/code/modules/hydroponics/grown.dm +++ b/code/modules/hydroponics/grown.dm @@ -147,11 +147,11 @@ qdel(src) -/obj/item/reagent_containers/food/snacks/grown/On_Consume() - if(iscarbon(usr)) +/obj/item/reagent_containers/food/snacks/grown/On_Consume(mob/M, mob/user) + if(iscarbon(M)) if(seed) for(var/datum/plant_gene/trait/T in seed.genes) - T.on_consume(src, usr) + T.on_consume(src, M) ..() /obj/item/reagent_containers/food/snacks/grown/after_slip(mob/living/carbon/human/H) From d89572afee32fb6dae157a466210fe8aa67f9394 Mon Sep 17 00:00:00 2001 From: joep van der velden Date: Sat, 8 Aug 2020 07:39:25 +0200 Subject: [PATCH 45/47] review changes --- code/modules/hydroponics/grown.dm | 11 +++++------ code/modules/hydroponics/plant_genes.dm | 4 ++-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/code/modules/hydroponics/grown.dm b/code/modules/hydroponics/grown.dm index 282976e1b5e..c95146971bd 100644 --- a/code/modules/hydroponics/grown.dm +++ b/code/modules/hydroponics/grown.dm @@ -193,15 +193,14 @@ /obj/item/reagent_containers/food/snacks/grown/proc/log_action(mob/user, atom/target, what_done) var/reagent_str = reagents.log_list() - var/genes_str + var/genes_str = "No genes" if(seed && length(seed.genes)) var/list/plant_gene_names = list() - for(var/datum/plant_gene/trait/T in seed.genes) - if(T.dangerous) - plant_gene_names += T.name + for(var/thing in seed.genes) + var/datum/plant_gene/G = thing + if(G.dangerous) + plant_gene_names += G.name genes_str = english_list(plant_gene_names) - else - genes_str = "No genes" add_attack_logs(user, target, "[what_done] ([reagent_str] | [genes_str])") diff --git a/code/modules/hydroponics/plant_genes.dm b/code/modules/hydroponics/plant_genes.dm index ef505e2842d..c2f4914351c 100644 --- a/code/modules/hydroponics/plant_genes.dm +++ b/code/modules/hydroponics/plant_genes.dm @@ -1,5 +1,7 @@ /datum/plant_gene var/name + /// Used to determine if the trait should be logged when the holder is used + var/dangerous = FALSE /datum/plant_gene/proc/get_name() // Used for manipulator display and gene disk name. return name @@ -139,8 +141,6 @@ var/rate = 0.05 var/examine_line = "" var/list/origin_tech = null - /// Used to determine if the trait should be logged when the holder is used - var/dangerous = FALSE var/trait_id // must be set and equal for any two traits of the same type /datum/plant_gene/trait/Copy() From dbbb226a2778f13381a54fc673ee346f5515f430 Mon Sep 17 00:00:00 2001 From: Kyep Date: Sat, 8 Aug 2020 06:24:29 -0700 Subject: [PATCH 46/47] fix offstation_role bug --- code/game/gamemodes/nuclear/nuclear.dm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/code/game/gamemodes/nuclear/nuclear.dm b/code/game/gamemodes/nuclear/nuclear.dm index 5fed8ae00f4..8316364781b 100644 --- a/code/game/gamemodes/nuclear/nuclear.dm +++ b/code/game/gamemodes/nuclear/nuclear.dm @@ -53,7 +53,6 @@ proc/issyndicate(mob/living/M as mob) for(var/datum/mind/synd_mind in syndicates) synd_mind.assigned_role = SPECIAL_ROLE_NUKEOPS //So they aren't chosen for other jobs. synd_mind.special_role = SPECIAL_ROLE_NUKEOPS - synd_mind.offstation_role = TRUE return 1 @@ -113,7 +112,7 @@ proc/issyndicate(mob/living/M as mob) if(spawnpos > synd_spawn.len) spawnpos = 2 synd_mind.current.loc = synd_spawn[spawnpos] - + synd_mind.offstation_role = TRUE forge_syndicate_objectives(synd_mind) create_syndicate(synd_mind) greet_syndicate(synd_mind) From 4bcbb65b3771b0dc10af008f1d316513c9995c5a Mon Sep 17 00:00:00 2001 From: Kyep Date: Sat, 8 Aug 2020 07:43:35 -0700 Subject: [PATCH 47/47] disables dragon transformation because it freezes the server --- code/modules/mining/lavaland/loot/ashdragon_loot.dm | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/code/modules/mining/lavaland/loot/ashdragon_loot.dm b/code/modules/mining/lavaland/loot/ashdragon_loot.dm index a0ea3eb7639..21bc247b0df 100644 --- a/code/modules/mining/lavaland/loot/ashdragon_loot.dm +++ b/code/modules/mining/lavaland/loot/ashdragon_loot.dm @@ -120,18 +120,13 @@ return var/mob/living/carbon/human/H = user - var/random = rand(1,3) + var/random = rand(1,2) switch(random) if(1) to_chat(user, "Your flesh begins to melt! Miraculously, you seem fine otherwise.") H.set_species(/datum/species/skeleton) if(2) - to_chat(user, "Power courses through you! You can now shift your form at will.") - if(user.mind) - var/obj/effect/proc_holder/spell/targeted/shapeshift/dragon/D = new - user.mind.AddSpell(D) - if(3) to_chat(user, "You feel like you could walk straight through lava now.") H.weather_immunities |= "lava"