Merge pull request #5754 from Citadel-Station-13/upstream-merge-35485

[MIRROR] Antagonist reputation system
This commit is contained in:
LetterJay
2018-03-04 00:31:41 -06:00
committed by GitHub
29 changed files with 246 additions and 20 deletions
@@ -92,6 +92,20 @@
/datum/config_entry/flag/allow_latejoin_antagonists // If late-joining players can be traitor/changeling
/datum/config_entry/flag/use_antag_rep // see game_options.txt for details
/datum/config_entry/number/antag_rep_maximum
config_entry_value = 200
min_val = 0
/datum/config_entry/number/default_antag_tickets
config_entry_value = 100
min_val = 0
/datum/config_entry/number/max_tickets_per_roll
config_entry_value = 100
min_val = 0
/datum/config_entry/number/midround_antag_time_check // How late (in minutes you want the midround antag system to stay on, setting this to 0 will disable the system)
config_entry_value = 60
min_val = 0
+2
View File
@@ -404,6 +404,8 @@ SUBSYSTEM_DEF(job)
else
M = H
SSpersistence.antag_rep_change[M.client.ckey] += job.antag_rep
to_chat(M, "<b>You are the [rank].</b>")
to_chat(M, "<b>As the [rank] you answer directly to [job.supervisors]. Special circumstances may change this.</b>")
to_chat(M, "<b>To speak on your departments radio, use the :h button. To see others, look closely at your headset.</b>")
+32
View File
@@ -1,3 +1,5 @@
#define FILE_ANTAG_REP "data/AntagReputation.json"
SUBSYSTEM_DEF(persistence)
name = "Persistence"
init_order = INIT_ORDER_PERSISTENCE
@@ -11,6 +13,8 @@ SUBSYSTEM_DEF(persistence)
var/list/saved_modes = list(1,2,3)
var/list/saved_trophies = list()
var/list/spawned_objects = list()
var/list/antag_rep = list()
var/list/antag_rep_change = list()
/datum/controller/subsystem/persistence/Initialize()
LoadSatchels()
@@ -18,6 +22,8 @@ SUBSYSTEM_DEF(persistence)
LoadChiselMessages()
LoadTrophies()
LoadRecentModes()
if(CONFIG_GET(flag/use_antag_rep))
LoadAntagReputation()
..()
/datum/controller/subsystem/persistence/proc/LoadSatchels()
@@ -152,6 +158,15 @@ SUBSYSTEM_DEF(persistence)
return
saved_modes = json["data"]
/datum/controller/subsystem/persistence/proc/LoadAntagReputation()
var/json = file2text(FILE_ANTAG_REP)
if(!json)
var/json_file = file(FILE_ANTAG_REP)
if(!fexists(json_file))
WARNING("Failed to load antag reputation. File likely corrupt.")
return
return
antag_rep = json_decode(json)
/datum/controller/subsystem/persistence/proc/SetUpTrophies(list/trophy_items)
for(var/A in GLOB.trophy_cases)
@@ -183,6 +198,8 @@ SUBSYSTEM_DEF(persistence)
CollectSecretSatchels()
CollectTrophies()
CollectRoundtype()
if(CONFIG_GET(flag/use_antag_rep))
CollectAntagReputation()
/datum/controller/subsystem/persistence/proc/CollectSecretSatchels()
satchel_blacklist = typecacheof(list(/obj/item/stack/tile/plasteel, /obj/item/crowbar))
@@ -253,3 +270,18 @@ SUBSYSTEM_DEF(persistence)
file_data["data"] = saved_modes
fdel(json_file)
WRITE_FILE(json_file, json_encode(file_data))
/datum/controller/subsystem/persistence/proc/CollectAntagReputation()
var/ANTAG_REP_MAXIMUM = CONFIG_GET(number/antag_rep_maximum)
for(var/p_ckey in antag_rep_change)
// var/start = antag_rep[p_ckey]
antag_rep[p_ckey] = max(0, min(antag_rep[p_ckey]+antag_rep_change[p_ckey], ANTAG_REP_MAXIMUM))
// WARNING("AR_DEBUG: [p_ckey]: Committed [antag_rep_change[p_ckey]] reputation, going from [start] to [antag_rep[p_ckey]]")
antag_rep_change = list()
fdel(FILE_ANTAG_REP)
text2file(json_encode(antag_rep), FILE_ANTAG_REP)