mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-12 18:51:53 +00:00
Upgrades policy config + policy verb. (#44296)
* Upgrades policy config + policy verb. * Better example and proper default value. * hr on top * Cleanup
This commit is contained in:
@@ -84,3 +84,7 @@
|
|||||||
|
|
||||||
#define STICKYBAN_DB_CACHE_TIME 10 SECONDS
|
#define STICKYBAN_DB_CACHE_TIME 10 SECONDS
|
||||||
#define STICKYBAN_ROGUE_CHECK_TIME 5
|
#define STICKYBAN_ROGUE_CHECK_TIME 5
|
||||||
|
|
||||||
|
|
||||||
|
#define POLICY_POLYMORPH "polymorph" //Shown to vicitm of staff of change and related effects.
|
||||||
|
#define POLICY_VERB_HEADER "policy_verb_header" //Shown on top of policy verb window
|
||||||
2
code/__HELPERS/config.dm
Normal file
2
code/__HELPERS/config.dm
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
/proc/get_policy(keyword)
|
||||||
|
return global.config.policy[keyword]
|
||||||
@@ -19,6 +19,7 @@
|
|||||||
var/list/mode_false_report_weight
|
var/list/mode_false_report_weight
|
||||||
|
|
||||||
var/motd
|
var/motd
|
||||||
|
var/policy
|
||||||
|
|
||||||
/datum/controller/configuration/proc/admin_reload()
|
/datum/controller/configuration/proc/admin_reload()
|
||||||
if(IsAdminAdvancedProcCall())
|
if(IsAdminAdvancedProcCall())
|
||||||
@@ -47,6 +48,7 @@
|
|||||||
break
|
break
|
||||||
loadmaplist(CONFIG_MAPS_FILE)
|
loadmaplist(CONFIG_MAPS_FILE)
|
||||||
LoadMOTD()
|
LoadMOTD()
|
||||||
|
LoadPolicy()
|
||||||
|
|
||||||
/datum/controller/configuration/proc/full_wipe()
|
/datum/controller/configuration/proc/full_wipe()
|
||||||
if(IsAdminAdvancedProcCall())
|
if(IsAdminAdvancedProcCall())
|
||||||
@@ -243,6 +245,34 @@
|
|||||||
var/tm_info = GLOB.revdata.GetTestMergeInfo()
|
var/tm_info = GLOB.revdata.GetTestMergeInfo()
|
||||||
if(motd || tm_info)
|
if(motd || tm_info)
|
||||||
motd = motd ? "[motd]<br>[tm_info]" : tm_info
|
motd = motd ? "[motd]<br>[tm_info]" : tm_info
|
||||||
|
/*
|
||||||
|
Policy file should be a json file with a single object.
|
||||||
|
Value is raw html.
|
||||||
|
|
||||||
|
Possible keywords :
|
||||||
|
Job titles / Assigned roles (ghost spawners for example) : Assistant , Captain , Ash Walker
|
||||||
|
Mob types : /mob/living/simple_animal/hostile/carp
|
||||||
|
Antagonist types : /datum/antagonist/highlander
|
||||||
|
Species types : /datum/species/lizard
|
||||||
|
special keywords defined in _DEFINES/admin.dm
|
||||||
|
|
||||||
|
Example config:
|
||||||
|
{
|
||||||
|
"Assistant" : "Don't kill everyone",
|
||||||
|
"/datum/antagonist/highlander" : "<b>Kill everyone</b>",
|
||||||
|
"Ash Walker" : "Kill all spacemans"
|
||||||
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
/datum/controller/configuration/proc/LoadPolicy()
|
||||||
|
policy = list()
|
||||||
|
var/rawpolicy = file2text("[directory]/policy.json")
|
||||||
|
if(rawpolicy)
|
||||||
|
var/parsed = json_decode(rawpolicy)
|
||||||
|
if(!parsed)
|
||||||
|
log_config("JSON parsing failure for policy.json")
|
||||||
|
else
|
||||||
|
policy = parsed
|
||||||
|
|
||||||
/datum/controller/configuration/proc/loadmaplist(filename)
|
/datum/controller/configuration/proc/loadmaplist(filename)
|
||||||
log_config("Loading config file [filename]...")
|
log_config("Loading config file [filename]...")
|
||||||
|
|||||||
@@ -35,10 +35,6 @@
|
|||||||
/datum/config_entry/keyed_list/midround_antag/ValidateListEntry(key_name, key_value)
|
/datum/config_entry/keyed_list/midround_antag/ValidateListEntry(key_name, key_value)
|
||||||
return key_name in config.modes
|
return key_name in config.modes
|
||||||
|
|
||||||
/datum/config_entry/keyed_list/policy
|
|
||||||
key_mode = KEY_MODE_TEXT
|
|
||||||
value_mode = VALUE_MODE_TEXT
|
|
||||||
|
|
||||||
/datum/config_entry/number/damage_multiplier
|
/datum/config_entry/number/damage_multiplier
|
||||||
config_entry_value = 1
|
config_entry_value = 1
|
||||||
integer = FALSE
|
integer = FALSE
|
||||||
|
|||||||
@@ -353,3 +353,25 @@ GLOBAL_VAR_INIT(normal_ooc_colour, "#002eb8")
|
|||||||
|
|
||||||
pct += delta
|
pct += delta
|
||||||
winset(src, "mainwindow.split", "splitter=[pct]")
|
winset(src, "mainwindow.split", "splitter=[pct]")
|
||||||
|
|
||||||
|
|
||||||
|
/client/verb/policy()
|
||||||
|
set name = "Show Policy"
|
||||||
|
set desc = "Show special server rules related to your current character."
|
||||||
|
set category = "OOC"
|
||||||
|
|
||||||
|
//Collect keywords
|
||||||
|
var/list/keywords = mob.get_policy_keywords()
|
||||||
|
var/header = get_policy(POLICY_VERB_HEADER)
|
||||||
|
var/list/policytext = list(header,"<hr>")
|
||||||
|
var/anything = FALSE
|
||||||
|
for(var/keyword in keywords)
|
||||||
|
var/p = get_policy(keyword)
|
||||||
|
if(p)
|
||||||
|
policytext += p
|
||||||
|
policytext += "<hr>"
|
||||||
|
anything = TRUE
|
||||||
|
if(!anything)
|
||||||
|
policytext += "No related rules found."
|
||||||
|
|
||||||
|
usr << browse(policytext.Join(""),"window=policy")
|
||||||
@@ -160,3 +160,7 @@
|
|||||||
return account
|
return account
|
||||||
|
|
||||||
return FALSE
|
return FALSE
|
||||||
|
|
||||||
|
/mob/living/carbon/human/get_policy_keywords()
|
||||||
|
. = ..()
|
||||||
|
. += "[dna.species.type]"
|
||||||
@@ -497,3 +497,12 @@ It's fairly easy to fix if dealing with single letters but not so much with comp
|
|||||||
|
|
||||||
if(HAS_TRAIT(src, TRAIT_DISSECTED))
|
if(HAS_TRAIT(src, TRAIT_DISSECTED))
|
||||||
. += "<span class='notice'>This body has been dissected and analyzed. It is no longer worth experimenting on.</span><br>"
|
. += "<span class='notice'>This body has been dissected and analyzed. It is no longer worth experimenting on.</span><br>"
|
||||||
|
|
||||||
|
/mob/proc/get_policy_keywords()
|
||||||
|
. = list()
|
||||||
|
. += "[type]"
|
||||||
|
if(mind)
|
||||||
|
. += mind.assigned_role
|
||||||
|
. += mind.special_role //In case there's something special leftover, try to avoid
|
||||||
|
for(var/datum/antagonist/A in mind.antag_datums)
|
||||||
|
. += "[A.type]"
|
||||||
@@ -278,7 +278,7 @@
|
|||||||
|
|
||||||
to_chat(new_mob, "<span class='warning'>Your form morphs into that of a [randomize].</span>")
|
to_chat(new_mob, "<span class='warning'>Your form morphs into that of a [randomize].</span>")
|
||||||
|
|
||||||
var/poly_msg = CONFIG_GET(keyed_list/policy)["polymorph"]
|
var/poly_msg = get_policy(POLICY_POLYMORPH)
|
||||||
if(poly_msg)
|
if(poly_msg)
|
||||||
to_chat(new_mob, poly_msg)
|
to_chat(new_mob, poly_msg)
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
## SERVER POLICIES ##
|
|
||||||
# Each line is pure html that gets sent to the user under certain conditions
|
|
||||||
|
|
||||||
# When a mob is polymorphed
|
|
||||||
POLYMORPH <span class='danger'>Note that you are allowed to act as an antagonist while transformed into a hostile mob, unless you volunteered for or sought out transformation.</span>
|
|
||||||
1
config/policy.json
Normal file
1
config/policy.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{}
|
||||||
@@ -113,6 +113,7 @@
|
|||||||
#include "code\__HELPERS\areas.dm"
|
#include "code\__HELPERS\areas.dm"
|
||||||
#include "code\__HELPERS\AStar.dm"
|
#include "code\__HELPERS\AStar.dm"
|
||||||
#include "code\__HELPERS\cmp.dm"
|
#include "code\__HELPERS\cmp.dm"
|
||||||
|
#include "code\__HELPERS\config.dm"
|
||||||
#include "code\__HELPERS\dates.dm"
|
#include "code\__HELPERS\dates.dm"
|
||||||
#include "code\__HELPERS\dna.dm"
|
#include "code\__HELPERS\dna.dm"
|
||||||
#include "code\__HELPERS\files.dm"
|
#include "code\__HELPERS\files.dm"
|
||||||
|
|||||||
Reference in New Issue
Block a user