Make karma toggleable

Add in feedback message

Update client defines.dm

keep it as bool I guess

Update karma.dm

Make it persistent

Update karma.dm

Update karma.dm

Update preferences.dm

make it compile, include kyet's suggestions

fix some things with the help of dtx
This commit is contained in:
Couls
2019-03-05 20:26:43 -05:00
parent c1fa401d4c
commit 8bc511f50f
6 changed files with 27 additions and 4 deletions
+2 -1
View File
@@ -27,6 +27,7 @@
#define DONATOR_PUBLIC 32768
#define CHAT_NO_TICKETLOGS 65536
#define UI_DARKMODE 131072
#define DISABLE_KARMA 262144
#define TOGGLES_DEFAULT (CHAT_OOC|CHAT_DEAD|CHAT_GHOSTEARS|CHAT_GHOSTSIGHT|CHAT_PRAYER|CHAT_RADIO|CHAT_LOOC|MEMBER_PUBLIC|DONATOR_PUBLIC)
@@ -53,4 +54,4 @@
#define EXP_TYPE_SERVICE "Service"
#define EXP_TYPE_WHITELIST "Whitelist"
#define EXP_DEPT_TYPE_LIST list(EXP_TYPE_SERVICE, EXP_TYPE_MEDICAL, EXP_TYPE_ENGINEERING, EXP_TYPE_SCIENCE, EXP_TYPE_SECURITY, EXP_TYPE_COMMAND, EXP_TYPE_SILICON, EXP_TYPE_SPECIAL)
#define EXP_DEPT_TYPE_LIST list(EXP_TYPE_SERVICE, EXP_TYPE_MEDICAL, EXP_TYPE_ENGINEERING, EXP_TYPE_SCIENCE, EXP_TYPE_SECURITY, EXP_TYPE_COMMAND, EXP_TYPE_SILICON, EXP_TYPE_SPECIAL)
+1
View File
@@ -60,6 +60,7 @@
var/karma = 0
var/karma_spent = 0
var/karma_tab = 0
var/wants_karma = TRUE // let's just keep it true as default for obvious reasons
/////////////////////////////////////////////
// /vg/: MEDIAAAAAAAA
// Set on login.
+5 -1
View File
@@ -374,7 +374,11 @@
if(establish_db_connection())
to_chat(src, "<span class='info'>Changelog has changed since your last visit.</span>")
update_changelog_button()
if(prefs.toggles & DISABLE_KARMA) // activates if karma is disabled
if(establish_db_connection())
wants_karma = FALSE
to_chat(src,"<span class='notice'>You have disabled karma gains.") // reminds those who have it disabled
if(!void)
void = new()
@@ -55,7 +55,7 @@
ooccolor = sanitize_hexcolor(ooccolor, initial(ooccolor))
UI_style = sanitize_inlist(UI_style, list("White", "Midnight"), initial(UI_style))
default_slot = sanitize_integer(default_slot, 1, max_save_slots, initial(default_slot))
toggles = sanitize_integer(toggles, 0, 262143, initial(toggles))
toggles = sanitize_integer(toggles, 0, 524287, initial(toggles))
sound = sanitize_integer(sound, 0, 65535, initial(sound))
UI_style_color = sanitize_hexcolor(UI_style_color, initial(UI_style_color))
UI_style_alpha = sanitize_integer(UI_style_alpha, 0, 255, initial(UI_style_alpha))
@@ -218,4 +218,18 @@
activate_darkmode()
else
deactivate_darkmode()
feedback_add_details("admin_verb","TDarkmode") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
feedback_add_details("admin_verb","TDarkmode") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/verb/toggle_karma()
set name = "Toggle Karma Gains"
set category = "Special Verbs"
set desc = "This button will allow you to stop other people giving you karma."
if (prefs.toggles & DISABLE_KARMA)
wants_karma = FALSE
to_chat(usr, "<span class='notice'>You have disabled karma gains.")
else
wants_karma = TRUE
to_chat(usr, "<span class='notice'>You have enabled karma gains.")
prefs.toggles ^= DISABLE_KARMA
prefs.save_preferences(src)
return
+3
View File
@@ -85,6 +85,9 @@ var/list/karma_spenders = list()
log_game("Illegal karma spending attempt detected from [key] to [M.key]. Using the same IP!")
to_chat(src, "<span class='warning'>You can't spend karma on someone connected from the same IP.</span>")
return FALSE
if(!M.client.wants_karma)
to_chat(src, "<span class='warning'>That player has turned off incoming karma.")
return FALSE
return TRUE