diff --git a/code/WorkInProgress/ZomgPonies/powerarmor/powerarmorcomponents.dm b/code/WorkInProgress/ZomgPonies/powerarmor/powerarmorcomponents.dm
index 4ba3c9ddb65..42cc7b4c444 100644
--- a/code/WorkInProgress/ZomgPonies/powerarmor/powerarmorcomponents.dm
+++ b/code/WorkInProgress/ZomgPonies/powerarmor/powerarmorcomponents.dm
@@ -74,18 +74,18 @@
if(!crit_fail)
if(prob(src.reliability)) return 1 //No failure
if(prob(src.reliability))
- for (var/mob/M in range(0,src.parent)) //Only a minor failure, enjoy your radiation.
+ for (var/mob/living/M in range(0,src.parent)) //Only a minor failure, enjoy your radiation.
if(src.parent in M.contents)
M << "Your armor feels pleasantly warm for a moment."
else
M << "You feel a warm sensation."
- M.radiation += rand(1,40)
+ M.apply_effect(-rand(1,40),IRRADIATE,0)
else
- for (var/mob/M in range(rand(1,4),src.parent)) //Big failure, TIME FOR RADIATION BITCHES
+ for (var/mob/living/M in range(rand(1,4),src.parent)) //Big failure, TIME FOR RADIATION BITCHES
if (src.parent in M.contents)
M << "Your armor's reactor overloads!"
M << "You feel a wave of heat wash over you."
- M.radiation += 100
+ M.apply_effect(100,IRRADIATE,0)
crit_fail = 1 //broken~
parent.powerdown(1)
spawn(50)
diff --git a/code/__HELPERS/type2type.dm b/code/__HELPERS/type2type.dm
index 76598fc6ec9..18a6601ed8e 100644
--- a/code/__HELPERS/type2type.dm
+++ b/code/__HELPERS/type2type.dm
@@ -85,44 +85,49 @@
// Concatenates a list of strings into a single string. A seperator may optionally be provided.
/proc/list2text(list/ls, sep)
- if(ls.len <= 1) return ls.len ? ls[1] : ""
- . = ""
- var/l = ls.len
- var/i = 0
+ if(ls.len <= 1) // Early-out code for empty or singleton lists.
+ return ls.len ? ls[1] : ""
- if(sep)
- #define S1 ls[++i]
- #define S4 S1, sep, S1, sep, S1, sep, S1
- #define S16 S4, sep, S4, sep, S4, sep, S4
- #define S64 S16, sep, S16, sep, S16, sep, S16
+ var/l = ls.len // Made local for sanic speed.
+ var/i = 0 // Incremented every time a list index is accessed.
- while(l-i >= 128)
- . = text("[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\
- [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\
- [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\
- [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\
- [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\
- [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\
- [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\
- [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]", ., S64, sep, S64)
- if(l-i >= 64)
- . = text("[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\
+ if(sep != null)
+ // Macros expand to long argument lists like so: sep, ls[++i], sep, ls[++i], sep, ls[++i], etc...
+ #define S1 sep, ls[++i]
+ #define S4 S1, S1, S1, S1
+ #define S16 S4, S4, S4, S4
+ #define S64 S16, S16, S16, S16
+
+ . = "[ls[++i]]" // Make sure the initial element is converted to text.
+
+ // Having the small concatenations come before the large ones boosted speed by an average of at least 5%.
+ if(l-1 & 0x01) // 'i' will always be 1 here.
+ . = text("[][][]", ., S1) // Append 1 element if the remaining elements are not a multiple of 2.
+ if(l-i & 0x02)
+ . = text("[][][][][]", ., S1, S1) // Append 2 elements if the remaining elements are not a multiple of 4.
+ if(l-i & 0x04)
+ . = text("[][][][][][][][][]", ., S4) // And so on....
+ if(l-i & 0x08)
+ . = text("[][][][][][][][][][][][][][][][][]", ., S4, S4)
+ if(l-i & 0x10)
+ . = text("[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]", ., S16)
+ if(l-i & 0x20)
+ . = text("[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\
+ [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]", ., S16, S16)
+ if(l-i & 0x40)
+ . = text("[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\
[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\
[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\
[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]", ., S64)
- if(l-i >= 32)
- . = text("[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\
- [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]", ., S16, sep, S16)
- if(l-i >= 16)
- . = text("[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]", ., S16)
- if(l-i >= 8)
- . = text("[][][][][][][][][][][][][][][][]", ., S4, sep, S4)
- if(l-i >= 4)
- . = text("[][][][][][][][]", ., S4)
- if(l-i >= 2)
- . = text("[][][][]", ., S1, sep, S1)
- if(l > i)
- . = text("[][][]", ., sep, S1)
+ while(l > i) // Chomp through the rest of the list, 128 elements at a time.
+ . = text("[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\
+ [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\
+ [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\
+ [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\
+ [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\
+ [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\
+ [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\
+ [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]", ., S64, S64)
#undef S64
#undef S16
@@ -130,71 +135,49 @@
#undef S1
else
+ // Macros expand to long argument lists like so: ls[++i], ls[++i], ls[++i], etc...
#define S1 ls[++i]
#define S4 S1, S1, S1, S1
#define S16 S4, S4, S4, S4
#define S64 S16, S16, S16, S16
- while(l-i >= 128)
+ . = "[ls[++i]]" // Make sure the initial element is converted to text.
+
+ if(l-1 & 0x01) // 'i' will always be 1 here.
+ . += S1 // Append 1 element if the remaining elements are not a multiple of 2.
+ if(l-i & 0x02)
+ . = text("[][][]", ., S1, S1) // Append 2 elements if the remaining elements are not a multiple of 4.
+ if(l-i & 0x04)
+ . = text("[][][][][]", ., S4) // And so on...
+ if(l-i & 0x08)
+ . = text("[][][][][][][][][]", ., S4, S4)
+ if(l-i & 0x10)
+ . = text("[][][][][][][][][][][][][][][][][]", ., S16)
+ if(l-i & 0x20)
+ . = text("[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]", ., S16, S16)
+ if(l-i & 0x40)
+ . = text("[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\
+ [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]", ., S64)
+ while(l > i) // Chomp through the rest of the list, 128 elements at a time.
. = text("[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\
[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\
[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\
[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]", ., S64, S64)
- if(l-i >= 64)
- . = text("[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]\
- [][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]", ., S64)
- if(l-i >= 32)
- . = text("[][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][][]", ., S16, S16)
- if(l-i >= 16)
- . = text("[][][][][][][][][][][][][][][][][]", ., S16)
- if(l-i >= 8)
- . = text("[][][][][][][][][]", ., S4, S4)
- if(l-i >= 4)
- . = text("[][][][][]", ., S4)
- if(l-i >= 2)
- . = text("[][][]", ., S1, S1)
- if(l > i)
- . += S1
#undef S64
#undef S16
#undef S4
#undef S1
-
//slower then list2text, but correctly processes associative lists.
-proc/tg_list2text(list/list, glue=",", assocglue=";")
+proc/tg_list2text(list/list, glue=",")
if(!istype(list) || !list.len)
return
var/output
for(var/i=1 to list.len)
- if(!isnull(list["[list[i]]"]))
- output += (i!=1? glue : null)+ "[list[i]]"+(i!=1? assocglue : null)+"[list["[list[i]]"]]"
- else
- output += (i!=1? glue : null)+ "[list[i]]"
+ output += (i!=1? glue : null)+(!isnull(list["[list[i]]"])?"[list["[list[i]]"]]":"[list[i]]")
return output
-proc/tg_text2list(text, glue=",", assocglue=";")
- var/length = length(glue)
- if(length < 1) return list(text)
- . = list()
- var/lastglue_found = 1
- var/foundglue
- var/foundassocglue
- var/searchtext
- do
- foundglue = findtext(text, glue, lastglue_found, 0)
- searchtext = copytext(text, lastglue_found, foundglue)
- foundassocglue = findtext(searchtext, assocglue, 1, 0)
- if(foundassocglue)
- var/sublist = copytext(searchtext, 1, foundassocglue)
- sublist[1] = copytext(searchtext, foundassocglue, 0)
- . += sublist
- else
- . += copytext(text, lastglue_found, foundglue)
- lastglue_found = foundglue + length
- while(foundglue)
-
//Converts a string into a list by splitting the string at each delimiter found. (discarding the seperator)
/proc/text2list(text, delimiter="\n")
diff --git a/code/game/objects/items/weapons/dna_injector.dm b/code/game/objects/items/weapons/dna_injector.dm
index 11e3d7d7f18..ff224067b11 100644
--- a/code/game/objects/items/weapons/dna_injector.dm
+++ b/code/game/objects/items/weapons/dna_injector.dm
@@ -63,9 +63,9 @@
else
return buf.dna.SetUIValue(real_block,val)
-/obj/item/weapon/dnainjector/proc/inject(mob/M as mob, mob/user as mob)
+/obj/item/weapon/dnainjector/proc/inject(mob/living/M as mob, mob/user as mob)
if(istype(M,/mob/living))
- M.radiation += rand(5,20)
+ M.apply_effect(rand(5,20),IRRADIATE,0)
if (!(M_NOCLONE in M.mutations)) // prevents drained people from having their DNA changed
// UI in syringe.
diff --git a/code/global.dm b/code/global.dm
index 3818db51cc1..f40c843e6b9 100644
--- a/code/global.dm
+++ b/code/global.dm
@@ -252,7 +252,7 @@ var/sqlfdbkdb = "test"
var/sqlfdbklogin = "root"
var/sqlfdbkpass = "bleh"
-var/sqllogging = 0 // Should we log deaths, population stats, etc?
+var/sqllogging = 1 // Should we log deaths, population stats, etc?
diff --git a/code/modules/client/client procs.dm b/code/modules/client/client procs.dm
index 220f70ac6e5..9bdd68f039a 100644
--- a/code/modules/client/client procs.dm
+++ b/code/modules/client/client procs.dm
@@ -171,8 +171,13 @@
else
src.DB_species_unlock("Slime People",45)
return
-
-
+ if(href_list["KarmaRefund"])
+ var/type = href_list["KarmaRefundType"]
+ var/job = href_list["KarmaRefund"]
+ var/cost = href_list["KarmaRefundCost"]
+ src.karmarefund(type,job,cost)
+ return
+
switch(href_list["_src_"])
if("holder") hsrc = holder
if("usr") hsrc = mob
diff --git a/code/modules/karma/karma.dm b/code/modules/karma/karma.dm
index 0f0c97f05c6..1fb2ec53999 100644
--- a/code/modules/karma/karma.dm
+++ b/code/modules/karma/karma.dm
@@ -52,6 +52,14 @@ var/list/karma_spenders = list()
set name = "Award Karma"
set desc = "Let the gods know whether someone's been nice. Can only be used once per round."
set category = "Special Verbs"
+
+ if(!ticker || !player_list.len)
+ usr << "\red You can't award karma until the game has started."
+ return
+
+ if(ticker.current_state == GAME_STATE_PREGAME)
+ usr << "\red You can't award karma until the game has started."
+ return
var/list/karma_list = list()
for(var/mob/M in player_list) if(M.client && M.mind)
@@ -65,16 +73,24 @@ var/list/karma_spenders = list()
return
var/pickedmob = input("Who would you like to award Karma to?", "Award Karma", null) as mob in karma_list
+
+ if(!istype(pickedmob, /mob))
+ usr << "\red That's not a mob."
+ return
+
spend_karma(pickedmob)
/mob/verb/spend_karma(var/mob/M)
set name = "Award Karma to Player"
set desc = "Let the gods know whether someone's been nice. Can only be used once per round."
+ set category = "Special Verbs"
- if(!istype(M, /mob))
- usr << "\red That's not a mob. You shouldn't have even been able to specify that. Please inform TLE post haste."
+ if(!M)
+ usr << "Please right click a mob to award karma directly, or use the 'Award Karma' verb to select a player from the player listing."
+ return
+ if(!istype(M, /mob))
+ usr << "\red That's not a mob."
return
-
if(!M.client)
usr << "\red That mob has no client connected at the moment."
return
@@ -85,9 +101,9 @@ var/list/karma_spenders = list()
if(a == src.key)
usr << "\red You've already spent your karma for the round."
return
- if(M.key == src.key)
- usr << "\red You can't spend karma on yourself!"
- return
+ //if(M.key == src.key)
+ //usr << "\red You can't spend karma on yourself!"
+ //return
if(M.client.address == src.client.address)
message_admins("\red Illegal karma spending detected from [src.key] to [M.key]. Using the same IP!")
log_game("\red Illegal karma spending detected from [src.key] to [M.key]. Using the same IP!")
@@ -113,13 +129,10 @@ var/list/karma_spenders = list()
sql_report_karma(src, M)
-
-
-
/client/verb/check_karma()
set name = "Check Karma"
set category = "Special Verbs"
- set desc = "Reports how much karma you have accrued"
+ set desc = "Reports how much karma you have accrued."
var/currentkarma=verify_karma()
usr << {"
You have [currentkarma] available."}
@@ -147,7 +160,6 @@ You've gained [totalkarma] total karma in your time here.
"}
usr << "Your total karma is: 0
"*/
return currentkarma
-
/client/verb/karmashop()
set name = "karmashop"
set desc = "Spend your hard-earned karma here"
@@ -156,12 +168,11 @@ You've gained [totalkarma] total karma in your time here.
"}
karmashopmenu()
return
-
/client/proc/karmashopmenu()
-
var/dat = "