From 280c932add6460991e514abec535699f3417ce00 Mon Sep 17 00:00:00 2001 From: GinjaNinja32 Date: Wed, 23 Sep 2015 12:26:53 +0100 Subject: [PATCH 1/5] fix traitor AIs not getting a law zero --- code/game/antagonist/station/traitor.dm | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/code/game/antagonist/station/traitor.dm b/code/game/antagonist/station/traitor.dm index d00668753e..de5a12b01d 100644 --- a/code/game/antagonist/station/traitor.dm +++ b/code/game/antagonist/station/traitor.dm @@ -73,19 +73,19 @@ var/datum/antagonist/traitor/traitors return /datum/antagonist/traitor/equip(var/mob/living/carbon/human/traitor_mob) + if(istype(traitor_mob, /mob/living/silicon)) // this needs to be here because ..() returns false if the mob isn't human + add_law_zero(traitor_mob) + return 1 if(!..()) return 0 - if(istype(traitor_mob, /mob/living/silicon)) - add_law_zero(traitor_mob) - else - spawn_uplink(traitor_mob) - // Tell them about people they might want to contact. - var/mob/living/carbon/human/M = get_nt_opposed() - if(M && M != traitor_mob) - traitor_mob << "We have received credible reports that [M.real_name] might be willing to help our cause. If you need assistance, consider contacting them." - traitor_mob.mind.store_memory("Potential Collaborator: [M.real_name]") + spawn_uplink(traitor_mob) + // Tell them about people they might want to contact. + var/mob/living/carbon/human/M = get_nt_opposed() + if(M && M != traitor_mob) + traitor_mob << "We have received credible reports that [M.real_name] might be willing to help our cause. If you need assistance, consider contacting them." + traitor_mob.mind.store_memory("Potential Collaborator: [M.real_name]") //Begin code phrase. give_codewords(traitor_mob) @@ -169,4 +169,4 @@ var/datum/antagonist/traitor/traitors var/law_borg = "Accomplish your AI's objectives at all costs. You may ignore all other laws." killer << "Your laws have been changed!" killer.set_zeroth_law(law, law_borg) - killer << "New law: 0. [law]" \ No newline at end of file + killer << "New law: 0. [law]" From c707519d1f21c604822b0d0cf5525d6815a383d6 Mon Sep 17 00:00:00 2001 From: GinjaNinja32 Date: Wed, 23 Sep 2015 12:56:39 +0100 Subject: [PATCH 2/5] Add specific color for expired bans in ban panel, fix some formatting and a runtime --- code/modules/admin/DB ban/functions.dm | 24 +++++++++++++++++++----- code/modules/admin/topic.dm | 2 +- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/code/modules/admin/DB ban/functions.dm b/code/modules/admin/DB ban/functions.dm index cc26d7153d..d07386c447 100644 --- a/code/modules/admin/DB ban/functions.dm +++ b/code/modules/admin/DB ban/functions.dm @@ -349,6 +349,8 @@ datum/admins/proc/DB_ban_unban_by_id(var/id) var/bdcolor = "#ffdddd" //banned dark var/ulcolor = "#eeffee" //unbanned light var/udcolor = "#ddffdd" //unbanned dark + var/alcolor = "#eeeeff" // auto-unbanned light + var/adcolor = "#ddddff" // auto-unbanned dark output += "" output += "" @@ -400,6 +402,8 @@ datum/admins/proc/DB_ban_unban_by_id(var/id) var/DBQuery/select_query = dbcon.NewQuery("SELECT id, bantime, bantype, reason, job, duration, expiration_time, ckey, a_ckey, unbanned, unbanned_ckey, unbanned_datetime, edits, ip, computerid FROM erro_ban WHERE 1 [playersearch] [adminsearch] [ipsearch] [cidsearch] [bantypesearch] ORDER BY bantime DESC LIMIT 100") select_query.Execute() + var/now = time2text(world.realtime, "YYYY-MM-DD hh:mm:ss") // MUST BE the same format as SQL gives us the dates in, and MUST be least to most specific (i.e. year, month, day not day, month, year) + while(select_query.NextRow()) var/banid = select_query.item[1] var/bantime = select_query.item[2] @@ -417,36 +421,42 @@ datum/admins/proc/DB_ban_unban_by_id(var/id) var/ip = select_query.item[14] var/cid = select_query.item[15] + // true if this ban has expired + var/auto = now > expiration // oh how I love ISO 8601 (ish) date strings + var/lcolor = blcolor var/dcolor = bdcolor if(unbanned) lcolor = ulcolor dcolor = udcolor + else if(auto) + lcolor = alcolor + dcolor = adcolor var/typedesc ="" switch(bantype) if("PERMABAN") typedesc = "PERMABAN" if("TEMPBAN") - typedesc = "TEMPBAN
([duration] minutes [(unbanned) ? "" : "(Edit))"]
Expires [expiration]
" + typedesc = "TEMPBAN
([duration] minutes) [(unbanned || auto) ? "" : "(Edit)"]
Expires [expiration]
" if("JOB_PERMABAN") typedesc = "JOBBAN
([job])" if("JOB_TEMPBAN") - typedesc = "TEMP JOBBAN
([job])
([duration] minutes
Expires [expiration]" + typedesc = "TEMP JOBBAN
([job])
([duration] minutes)
Expires [expiration]" output += "
" output += "" output += "" output += "" output += "" - output += "" + output += "" output += "" output += "" output += "" output += "" output += "" output += "" - output += "" + output += "" output += "" if(edits) output += "" @@ -459,10 +469,14 @@ datum/admins/proc/DB_ban_unban_by_id(var/id) output += "" output += "" output += "" + if(auto) + output += "" + output += "" + output += "" output += "" output += "" output += "" output += "
[typedesc][ckey][bantime][ackey][(unbanned) ? "" : "Unban"][(unbanned || auto) ? "" : "Unban"]
IP: [ip]CIP: [cid]
Reason: [(unbanned) ? "" : "(Edit)"] \"[reason]\"Reason: [(unbanned || auto) ? "" : "(Edit)"] \"[reason]\"
UNBANNED by admin [unbanckey] on [unbantime]
EXPIRED at [expiration]
 
" - usr << browse(output,"window=lookupbans;size=900x700") \ No newline at end of file + usr << browse(output,"window=lookupbans;size=900x700") diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index e60a830086..983292ebc3 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -85,7 +85,7 @@ banreason = "[banreason] (CUSTOM CID)" else message_admins("Ban process: A mob matching [playermob.ckey] was found at location [playermob.x], [playermob.y], [playermob.z]. Custom ip and computer id fields replaced with the ip and computer id from the located mob") - notes_add(playermob.ckey,banreason,usr) + notes_add(banckey,banreason,usr) DB_ban_record(bantype, playermob, banduration, banreason, banjob, null, banckey, banip, bancid ) From 9be47c6374310f177d79610394b1fbbd965367d8 Mon Sep 17 00:00:00 2001 From: GinjaNinja32 Date: Wed, 23 Sep 2015 13:03:11 +0100 Subject: [PATCH 3/5] Permabans do not expire, and we don't need to show expired when it's been manually lifted --- code/modules/admin/DB ban/functions.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/modules/admin/DB ban/functions.dm b/code/modules/admin/DB ban/functions.dm index d07386c447..8e1ad3aa79 100644 --- a/code/modules/admin/DB ban/functions.dm +++ b/code/modules/admin/DB ban/functions.dm @@ -422,7 +422,7 @@ datum/admins/proc/DB_ban_unban_by_id(var/id) var/cid = select_query.item[15] // true if this ban has expired - var/auto = now > expiration // oh how I love ISO 8601 (ish) date strings + var/auto = (bantype in list("TEMPBAN", "JOB_TEMPBAN")) && now > expiration // oh how I love ISO 8601 (ish) date strings var/lcolor = blcolor var/dcolor = bdcolor @@ -469,7 +469,7 @@ datum/admins/proc/DB_ban_unban_by_id(var/id) output += "" output += "UNBANNED by admin [unbanckey] on [unbantime]" output += "" - if(auto) + else if(auto) output += "" output += "EXPIRED at [expiration]" output += "" From 8ed4faf7b2c17f45af5c60ddef6be59625c4aa3d Mon Sep 17 00:00:00 2001 From: GinjaNinja32 Date: Wed, 23 Sep 2015 13:29:54 +0100 Subject: [PATCH 4/5] Add proc/crash_with, fix two incorrect qdel calls --- code/__HELPERS/unsorted.dm | 4 ++++ code/controllers/Processes/garbage.dm | 1 + code/game/atoms_movable.dm | 6 +----- code/modules/admin/player_notes.dm | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 8b58d5edde..7122d32f85 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -1309,3 +1309,7 @@ var/mob/dview/dview_mob = new /mob/dview/New() // do nothing. we don't want to be in any mob lists; we're a dummy not a mob. + +// call to generate a stack trace and print to runtime logs +/proc/crash_with(msg) + CRASH(msg) diff --git a/code/controllers/Processes/garbage.dm b/code/controllers/Processes/garbage.dm index b3f1917f6b..b2349213b7 100644 --- a/code/controllers/Processes/garbage.dm +++ b/code/controllers/Processes/garbage.dm @@ -91,6 +91,7 @@ var/list/delayed_garbage = list() return if(!istype(A)) warning("qdel() passed object of type [A.type]. qdel() can only handle /datum types.") + crash_with("qdel() passed object of type [A.type]. qdel() can only handle /datum types.") del(A) if(garbage_collector) garbage_collector.dels++ diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index c339459fe5..8fd660ec52 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -21,14 +21,10 @@ if(auto_init && ticker && ticker.current_state == GAME_STATE_PLAYING) initialize() -/proc/generate_debug_runtime() // Guaranteed to runtime and print a stack trace to the runtime log - var/t = 0 // BYOND won't let us do var/t = 1/0 directly, but it's fine with this. - t = 1 / t - /atom/movable/Del() if(isnull(gcDestroyed) && loc) testing("GC: -- [type] was deleted via del() rather than qdel() --") - generate_debug_runtime() // stick a stack trace in the runtime logs + crash_with("GC: -- [type] was deleted via del() rather than qdel() --") // stick a stack trace in the runtime logs // else if(isnull(gcDestroyed)) // testing("GC: [type] was deleted via GC without qdel()") //Not really a huge issue but from now on, please qdel() // else diff --git a/code/modules/admin/player_notes.dm b/code/modules/admin/player_notes.dm index 4a28ece915..b6293e7941 100644 --- a/code/modules/admin/player_notes.dm +++ b/code/modules/admin/player_notes.dm @@ -106,7 +106,7 @@ datum/admins/proc/notes_gethtml(var/ckey) message_admins("\blue [key_name_admin(user)] has edited [key]'s notes.") log_admin("[key_name(user)] has edited [key]'s notes.") - qdel(info) + del(info) // savefile, so NOT qdel //Updating list of keys with notes on them var/savefile/note_list = new("data/player_notes.sav") @@ -115,7 +115,7 @@ datum/admins/proc/notes_gethtml(var/ckey) if(!note_keys) note_keys = list() if(!note_keys.Find(key)) note_keys += key note_list << note_keys - qdel(note_list) + del(note_list) // savefile, so NOT qdel /proc/notes_del(var/key, var/index) From 76f06e6e9b1a920ff5a0e8a8922a3cd95036acc0 Mon Sep 17 00:00:00 2001 From: BlueNexus Date: Wed, 23 Sep 2015 13:29:54 +0100 Subject: [PATCH 5/5] Gave Asset Protection their proper rig Fairly self explanatory. --- code/game/antagonist/outsider/deathsquad.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/antagonist/outsider/deathsquad.dm b/code/game/antagonist/outsider/deathsquad.dm index 2740adf8ae..cbb57abe1a 100644 --- a/code/game/antagonist/outsider/deathsquad.dm +++ b/code/game/antagonist/outsider/deathsquad.dm @@ -47,7 +47,7 @@ var/datum/antagonist/deathsquad/deathsquad player.equip_to_slot_or_del(new /obj/item/weapon/plastique(player), slot_l_store) player.equip_to_slot_or_del(new /obj/item/weapon/gun/projectile/revolver/mateba(player), slot_belt) player.equip_to_slot_or_del(new /obj/item/weapon/gun/energy/pulse_rifle(player), slot_r_hand) - player.equip_to_slot_or_del(new /obj/item/weapon/rig/combat(player), slot_back) + player.equip_to_slot_or_del(new /obj/item/weapon/rig/ert/assetprotection(player), slot_back) player.equip_to_slot_or_del(new /obj/item/weapon/melee/energy/sword(player), slot_s_store) player.implant_loyalty(player)