diff --git a/SQL/aurora_schema.sql b/SQL/aurora_schema.sql index a6729e81..56ee1ca7 100644 --- a/SQL/aurora_schema.sql +++ b/SQL/aurora_schema.sql @@ -5,7 +5,7 @@ CREATE TABLE `aurora_customitems` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `ckey` VARCHAR(32) NOT NULL, - `character` VARCHAR(32) NOT NULL, + `real_name` VARCHAR(32) NOT NULL, `item` VARCHAR(124) NOT NULL, `job` TEXT NULL, -- Job restrictions go here. Can be left blank. Format is Job One,Job Two,Job Three Point Five PRIMARY KEY (`id`) @@ -32,4 +32,46 @@ CREATE TABLE `aurora_forms` ( `data` TEXT NOT NULL, -- The contents of the paper itself, formatted in BB `info` TEXT NULL, -- Info for further request, plain text PRIMARY KEY(`id`) +) ENGINE=INNODB DEFAULT CHARSET=LATIN1; + +-- ------------------------------ +-- Warnings table +-- tgstation.aurora_warnings +-- ------------------------------ +CREATE TABLE `aurora_warnings` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `time` DATETIME NOT NULL, + `severity` TINYINT(1) NOT NULL, + `reason` TEXT NOT NULL, + `notes` TEXT NULL, + `ckey` VARCHAR(32) NOT NULL, + `computerid` VARCHAR(32) NOT NULL, + `ip` VARCHAR(32) NOT NULL, + `a_ckey` VARCHAR(32) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=INNODB DEFAULT CHARSET=LATIN1; + +-- ------------------------------ +-- Station Directives table +-- tgstation.aurora_directives +-- ------------------------------ +CREATE TABLE `aurora_directives` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `name` VARCHAR(64) NOT NULL, + `data` TEXT NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=INNODB DEFAULT CHARSET=LATIN1; + +-- ------------------------------ +-- SQL based Newsfeed table +-- tgstation.aurora_news +-- ------------------------------ +CREATE TABLE `aurora_news` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `publishtime` INT(11) NOT NULL, + `channel` VARCHAR(64) NOT NULL, + `author` VARCHAR(64) NOT NULL, + `body` TEXT NOT NULL, + `notpublishing` TINYINT(1) DEFAULT NULL, + PRIMARY KEY (`id`) ) ENGINE=INNODB DEFAULT CHARSET=LATIN1; \ No newline at end of file diff --git a/aurora.dme b/aurora.dme index a1bd2503..28aa3018 100644 --- a/aurora.dme +++ b/aurora.dme @@ -839,6 +839,8 @@ #include "code\modules\aurora\duty officer.dm" #include "code\modules\aurora\intern.dm" #include "code\modules\aurora\recycler.dm" +#include "code\modules\aurora\sqlnews_controller.dm" +#include "code\modules\aurora\stationdirectives.dm" #include "code\modules\aurora\weldbackpack.dm" #include "code\modules\aurora\bridge_overhaul\chairs.dm" #include "code\modules\aurora\bridge_overhaul\desk_consoles.dm" diff --git a/code/__HELPERS/text.dm b/code/__HELPERS/text.dm index c1c15eca..3bbd38bf 100644 --- a/code/__HELPERS/text.dm +++ b/code/__HELPERS/text.dm @@ -346,4 +346,4 @@ proc/TextPreview(var/string,var/len=40) return sanitize(input) /proc/trim_strip_html_properly(var/input, var/max_length = MAX_MESSAGE_LEN) - return trim(strip_html_properly(input, max_length)) \ No newline at end of file + return trim(strip_html_properly(input, max_length)) diff --git a/code/controllers/configuration.dm b/code/controllers/configuration.dm index 0d7dea4f..bbe143b0 100644 --- a/code/controllers/configuration.dm +++ b/code/controllers/configuration.dm @@ -150,6 +150,7 @@ var/python_path = "" //Path to the python executable. Defaults to "python" on windows and "/usr/bin/env python2" on unix var/use_lib_nudge = 0 //Use the C library nudge instead of the python nudge. var/use_overmap = 0 + var/invasive_directives = 0 /datum/configuration/New() var/list/L = typesof(/datum/game_mode) - /datum/game_mode @@ -514,6 +515,9 @@ if("use_overmap") config.use_overmap = 1 + if("invasive_directives") + config.invasive_directives = 1 + else log_misc("Unknown setting in configuration: '[name]'") diff --git a/code/controllers/master_controller.dm b/code/controllers/master_controller.dm index 01178e8e..7d372cc5 100644 --- a/code/controllers/master_controller.dm +++ b/code/controllers/master_controller.dm @@ -57,6 +57,7 @@ datum/controller/game_controller/New() if(!emergency_shuttle) emergency_shuttle = new /datum/emergency_shuttle_controller() if(!shuttle_controller) shuttle_controller = new /datum/shuttle_controller() if(!delta_level) delta_level = new /datum/delta_level() + if(!sqlnews_controller) sqlnews_controller = new /datum/sqlnews() datum/controller/game_controller/proc/setup() world.tick_lag = config.Ticklag @@ -149,6 +150,7 @@ datum/controller/game_controller/proc/process() transfer_controller.process() shuttle_controller.process() process_newscaster() + sqlnews_controller.process() //AIR @@ -234,6 +236,9 @@ datum/controller/game_controller/proc/process() process_events() events_cost = (world.timeofday - timer) / 10 + //SQL NEWS + + //TICKER timer = world.timeofday last_thing_processed = ticker.type @@ -246,6 +251,7 @@ datum/controller/game_controller/proc/process() var/end_time = world.timeofday if(end_time < start_time) start_time -= 864000 //deciseconds in a day + sleep( round(minimum_ticks - (end_time - start_time),1) ) else sleep(10) diff --git a/code/controllers/verbs.dm b/code/controllers/verbs.dm index e0dbd4b2..3ad0d242 100644 --- a/code/controllers/verbs.dm +++ b/code/controllers/verbs.dm @@ -49,7 +49,7 @@ msg_scopes("Admin [key_name_admin(usr)] has restarted the [controller] controller.") return -/client/proc/debug_controller(controller in list("Master","Failsafe","Ticker","Lighting","Air","Jobs","Sun","Radio","Supply","Shuttles","Emergency Shuttle","Configuration","pAI", "Cameras", "Transfer Controller", "Gas Data", "Delta Level", "NanoUI")) +/client/proc/debug_controller(controller in list("Master","Failsafe","Ticker","Lighting","Air","Jobs","Sun","Radio","Supply","Shuttles","Emergency Shuttle","Configuration","pAI", "Cameras", "Transfer Controller", "Gas Data", "Delta Level", "NanoUI", "SQL News")) set category = "Debug" set name = "Debug Controller" set desc = "Debug the various periodic loop controllers for the game (be careful!)" @@ -110,6 +110,9 @@ if("NanoUI") debug_variables(nanomanager) feedback_add_details("admin_verv","DNanoUI") + if("SQL News") + debug_variables(sqlnews_controller) + feedback_add_details("admin_verb","DSQLNews") message_admins("Admin [key_name_admin(usr)] is debugging the [controller] controller.") return diff --git a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm index 936039dc..c3102af0 100644 --- a/code/game/gamemodes/game_mode.dm +++ b/code/game/gamemodes/game_mode.dm @@ -93,16 +93,16 @@ Implants; if((player.client)&&(player.ready)) playerC++ - msg_scopes("playerC: [playerC]") + msg_scopes("[src] playerC: [playerC]") if(master_mode=="secret") - msg_scopes("req [required_players_secret]") + msg_scopes("[src] req [required_players_secret]") if(playerC >= required_players_secret) return 1 else - msg_scopes("req [required_players]") + msg_scopes("[src] req [required_players]") if(playerC >= required_players) return 1 - msg_scopes("Nope, players not here or something") + msg_scopes("[src] Nope, players not here or something") return 0 @@ -323,6 +323,7 @@ Implants; for(var/datum/mind/player in candidates) for(var/job in restricted_jobs) if(player.assigned_role == job) + msg_scopes("[player.key] has a Restricted Job [job]") candidates -= player /*if(candidates.len < recommended_enemies) diff --git a/code/game/gamemodes/vampire/vampire_powers.dm b/code/game/gamemodes/vampire/vampire_powers.dm index 5fc4a3c3..b54efcc6 100644 --- a/code/game/gamemodes/vampire/vampire_powers.dm +++ b/code/game/gamemodes/vampire/vampire_powers.dm @@ -215,9 +215,9 @@ M.current << "You're blindfolded!" return for(var/mob/living/carbon/C in view(1)) - if(!C.vampire_affected(M)) - if(!C.get_species() == "Machine") - continue + if(C == M.current) continue //Don't stunn yourself + if(!C.vampire_affected(M) && !C.get_species() == "Machine") //Or machines + continue if(!M.current.vampire_can_reach(C, 1)) continue // C.Stun(8) C.Weaken(8) diff --git a/code/game/machinery/newscaster.dm b/code/game/machinery/newscaster.dm index 4e841bbe..a38fd36c 100644 --- a/code/game/machinery/newscaster.dm +++ b/code/game/machinery/newscaster.dm @@ -92,6 +92,7 @@ var/list/obj/machinery/newscaster/allCasters = list() //Global list that will co var/c_locked=0; //Will our new channel be locked to public submissions? var/hitstaken = 0 //Death at 3 hits from an item with force>=15 var/datum/feed_channel/viewing_channel = null + var/queryid luminosity = 0 anchored = 1 @@ -190,6 +191,7 @@ var/list/obj/machinery/newscaster/allCasters = list() //Global list that will co dat+= "
View Feed Channels" dat+= "
Submit new Feed story" dat+= "
Print newspaper" + dat+= "
NanoTrasen Station Directives" dat+= "
Re-scan User" dat+= "

Exit" if(src.securityCaster) @@ -413,6 +415,55 @@ var/list/obj/machinery/newscaster/allCasters = list() //Global list that will co if(21) dat+="Unable to print newspaper. Insufficient paper. Please notify maintenance personnel to refill machine storage.

" dat+="Return" + if(22) + dat += "
Station Directives
NanoTrasen
NSS Aurora

" + + establish_db_connection() + if(!dbcon.IsConnected()) + dat += text("
ERROR: Unable to contact external database.
") + error("SQL database connection failed. Attempted to fetch form information.") + + var/DBQuery/query = dbcon.NewQuery("SELECT id, name FROM aurora_directives") + query.Execute() + dat += "
" + dat += "" + + while(query.NextRow()) + var/id = text2num(query.item[1]) + var/name = query.item[2] + + var/bgcolor = "#e3e3e3" + if(id%2 == 0) + bgcolor = "white" + dat += "" + dat += "
Regarding Station Directives
Directive #[id][name]Review
" + dat += "
Return to Main Menu
" + if(23) + if(!queryid) + return //this should never happen + + var/DBQuery/searchquery = dbcon.NewQuery("SELECT id, name, data FROM aurora_directives WHERE id=[queryid]") + searchquery.Execute() + + while(searchquery.NextRow()) + var/id = searchquery.item[1] + var/name = searchquery.item[2] + var/data = searchquery.item[3] + + dat += "
Directive #[id]
'[name]'

" + dat += "
[data]
" + + dat += "
Return to Index
" + dat += "
Return to Main Menu
" + if(24) + dat += "
Regarding Station Directives

" + dat += "
The Station Directives are a set of specific orders and directives issued and enforced aboard a specific NanoTrasen Corporation installation. This terminal provides access to orders and directives enforced aboard the NSS Aurora. Note that these are only enforced upon NanoTrasen Employees, and not civilians or visitors, unless ruled otherwise by sector specific Central Command.

" + dat += "Overwriting power of general NanoTrasen Corporate Regulation is given to the Station Directives. Should a conflict emerge, the Station Directives active aboard the specific installation are to be adhered to, over Corporate Regulation.

" + dat += "Punishment for a violation of Station Directives should be escalated in the following fashion:
" + dat += "Dependant on the violation and actual crimes concerned, punishment may be escalated faster, with intent to ensure in the safety of station, equipment and crew.
" + dat += "During non-standard operation, and highly abnormal circumstances, Station Directives may be overlooked, for the sake of a less costly solution to the given emergency. Note that should a follow-on review find this solution to have been more detrimental, and the breach of Directives and Regulation be unwarranted, then such an act will be punished.
" + dat += "
Return to Index
" + dat += "
Return to Main Menu
" else dat+="I'm sorry to break your immersion. This shit's bugged. Report this bug to Agouri, polyxenitopalidou@gmail.com" @@ -693,6 +744,11 @@ var/list/obj/machinery/newscaster/allCasters = list() //Global list that will co src.screen = 12 src.updateUsrDialog() + else if(href_list["directivesview"]) + queryid = sanitizeSQL(href_list["directivesview"]) + screen = 23 + updateUsrDialog() + else if(href_list["refresh"]) src.updateUsrDialog() diff --git a/code/game/machinery/requests_console.dm b/code/game/machinery/requests_console.dm index 67bc6806..f4dcf090 100644 --- a/code/game/machinery/requests_console.dm +++ b/code/game/machinery/requests_console.dm @@ -41,6 +41,9 @@ var/list/obj/machinery/requests_console/allConsoles = list() // 9 = authentication before sending // 10 = send announcement // 11 = form database + // 12 = directive index + // 13 = directive view + // 14 = directive description var/silent = 0 // set to 1 for it not to beep all the time // var/hackState = 0 // 0 = not hacked @@ -56,6 +59,7 @@ var/list/obj/machinery/requests_console/allConsoles = list() var/dpt = ""; //the department which will be receiving the message var/priority = -1 ; //Priority of the message being sent var/SQLquery + var/queryid var/paperstock = 10 var/lid = 0 luminosity = 0 @@ -224,6 +228,58 @@ var/list/obj/machinery/requests_console/allConsoles = list() dat += text("
Reset Search") dat += text("
Back
") + if(12) //directive index + dat += "
Station Directives
NanoTrasen
NSS Aurora

" + + establish_db_connection() + if(!dbcon.IsConnected()) + dat += text("
ERROR: Unable to contact external database.
") + error("SQL database connection failed. Attempted to fetch form information.") + + var/DBQuery/query = dbcon.NewQuery("SELECT id, name FROM aurora_directives") + query.Execute() + dat += "
" + dat += "" + + while(query.NextRow()) + var/id = text2num(query.item[1]) + var/name = query.item[2] + + var/bgcolor = "#e3e3e3" + if(id%2 == 0) + bgcolor = "white" + dat += "" + dat += "
Regarding Station Directives
Directive #[id][name]Review
" + dat += "
Return to Main Menu
" + + if(13) //directive view + if(!queryid) + return //this should never happen + + var/DBQuery/searchquery = dbcon.NewQuery("SELECT id, name, data FROM aurora_directives WHERE id=[queryid]") + searchquery.Execute() + + while(searchquery.NextRow()) + var/id = searchquery.item[1] + var/name = searchquery.item[2] + var/data = searchquery.item[3] + + dat += "
Directive #[id]
'[name]'

" + dat += "
[data]
" + + dat += "
Return to Index
" + dat += "
Return to Main Menu
" + + if(14) //directive description + dat += "
Regarding Station Directives

" + dat += "
The Station Directives are a set of specific orders and directives issued and enforced aboard a specific NanoTrasen Corporation installation. This terminal provides access to orders and directives enforced aboard the NSS Aurora. Note that these are only enforced upon NanoTrasen Employees, and not civilians or visitors, unless ruled otherwise by sector specific Central Command.

" + dat += "Overwriting power of general NanoTrasen Corporate Regulation is given to the Station Directives. Should a conflict emerge, the Station Directives active aboard the specific installation are to be adhered to, over Corporate Regulation.

" + dat += "Punishment for a violation of Station Directives should be escalated in the following fashion:
" + dat += "Dependant on the violation and actual crimes concerned, punishment may be escalated faster, with intent to ensure in the safety of station, equipment and crew.
" + dat += "During non-standard operation, and highly abnormal circumstances, Station Directives may be overlooked, for the sake of a less costly solution to the given emergency. Note that should a follow-on review find this solution to have been more detrimental, and the breach of Directives and Regulation be unwarranted, then such an act will be punished.
" + dat += "
Return to Index
" + dat += "
Return to Main Menu
" + else //main menu screen = 0 announceAuth = 0 @@ -236,6 +292,7 @@ var/list/obj/machinery/requests_console/allConsoles = list() dat += text("Request Assistance
") dat += text("Request Supplies
") dat += text("Relay Anonymous Information
") + dat += text("NanoTrasen Station Directives
") dat += text("NanoTrasen Corporate Form Database

") if(announcementConsole) dat += text("Send station-wide announcement

") @@ -451,6 +508,12 @@ var/list/obj/machinery/requests_console/allConsoles = list() if(11) //form database SQLquery = "SELECT id, name, department FROM aurora_forms" screen = 11 + if(12) //directive index + screen = 12 + if(13) //directive view + screen = 13 + if(14) //directive description + screen = 14 else //main menu dpt = "" msgVerified = "" @@ -465,6 +528,11 @@ var/list/obj/machinery/requests_console/allConsoles = list() if("1") silent = 1 else silent = 0 + if(href_list["directivesview"]) + queryid = sanitizeSQL(href_list["directivesview"]) + screen = 13 + + updateUsrDialog() return diff --git a/code/game/objects/items/devices/PDA/PDA.dm b/code/game/objects/items/devices/PDA/PDA.dm index a420245f..07f6fabb 100644 --- a/code/game/objects/items/devices/PDA/PDA.dm +++ b/code/game/objects/items/devices/PDA/PDA.dm @@ -46,7 +46,7 @@ var/global/list/obj/item/device/pda/PDAs = list() var/newmessage = 0 //To remove hackish overlay check var/list/cartmodes = list(40, 42, 43, 433, 44, 441, 45, 451, 46, 48, 47, 49) // If you add more cartridge modes add them to this list as well. - var/list/no_auto_update = list(1, 40, 43, 44, 441, 45, 451) // These modes we turn off autoupdate + var/list/no_auto_update = list(1, 40, 43, 44, 441, 45, 451, 6, 61) // These modes we turn off autoupdate var/list/update_every_five = list(3, 41, 433, 46, 47, 48, 49) // These we update every 5 ticks var/obj/item/weapon/card/id/id = null //Making it possible to slot an ID card into the PDA so it can function as both. @@ -54,6 +54,8 @@ var/global/list/obj/item/device/pda/PDAs = list() var/obj/item/device/paicard/pai = null // A slot for a personal AI device + var/queryid //For general SQL queries ran from the PDA's interface. + /obj/item/device/pda/medical default_cartridge = /obj/item/weapon/cartridge/medical icon_state = "pda-m" @@ -466,6 +468,35 @@ var/global/list/obj/item/device/pda/PDAs = list() if(isnull(data["aircontents"])) data["aircontents"] = list("reading" = 0) + if(mode==6) //Station Directives + var/directives[0] + + establish_db_connection() + if(!dbcon.IsConnected()) + data["sqlcon"] = 1 + error("SQL database connection failed. Attempted to fetch form information.") + + var/DBQuery/query = dbcon.NewQuery("SELECT id, name FROM aurora_directives") + query.Execute() + + while(query.NextRow()) + var/id = query.item[1] + var/name = query.item[2] + + directives.Add(list(list("DirNo" = "[id]", "DirName" = "[name]"))) + + data["directives"] = directives + + if(mode==61) + var/DBQuery/searchquery = dbcon.NewQuery("SELECT id, name, data FROM aurora_directives WHERE id=[queryid]") + searchquery.Execute() + + while(searchquery.NextRow()) + data["DirNo"] = searchquery.item[1] + data["DirName"] = searchquery.item[2] + data["DirData"] = searchquery.item[3] + + // update the ui if it exists, returns null if no ui is passed/found ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open) if (!ui) @@ -571,6 +602,8 @@ var/global/list/obj/item/device/pda/PDAs = list() mode = 5 if("41") //Manifest mode = 41 + if("6") + mode = 6 //MAIN FUNCTIONS=================================== @@ -697,6 +730,11 @@ var/global/list/obj/item/device/pda/PDAs = list() ui.close() return 0 +//SQL/AURORA FUNCTIONS================================== + + if("View Directive") + queryid = sanitizeSQL(href_list["queryid"]) + mode = 61 //SYNDICATE FUNCTIONS=================================== diff --git a/code/modules/admin/verbs/modifyvariables.dm b/code/modules/admin/verbs/modifyvariables.dm index 51f5351a..cbe7f4fd 100644 --- a/code/modules/admin/verbs/modifyvariables.dm +++ b/code/modules/admin/verbs/modifyvariables.dm @@ -131,6 +131,7 @@ var/list/forbidden_varedit_object_types = list( if(!istype(L,/list)) src << "Not a List." var/list/locked = list("vars", "key", "ckey", "client", "firemut", "ishulk", "telekinesis", "xray", "virus", "viruses", "cuffed", "ka", "last_eaten", "urine", "poo", "icon", "icon_state") + var/list/forbidden = list("holder") //Why this way, fuck knows. var/list/names = sortList(L) var/variable = input("Which var?","Var") as null|anything in names + "(ADD VAR)" @@ -149,6 +150,9 @@ var/list/forbidden_varedit_object_types = list( if(variable in locked) if(!check_rights(R_DEBUG|R_DEV|R_FUN)) return + if(variable in forbidden) + if(!check_rights(R_SERVER)) return + if(isnull(variable)) usr << "Unable to determine variable type." @@ -290,8 +294,10 @@ var/list/forbidden_varedit_object_types = list( src << "A variable with this name ([param_var_name]) doesn't exist in this atom ([O])" return - if(param_var_name == "holder" || (param_var_name in locked)) + if(param_var_name in locked) if(!check_rights(R_DEBUG|R_DEV|R_FUN)) return + if(param_var_name == "holder") + if(!check_rights(R_SERVER)) return variable = param_var_name @@ -348,8 +354,10 @@ var/list/forbidden_varedit_object_types = list( if(!variable) return var_value = O.vars[variable] - if(variable == "holder" || (variable in locked)) + if(param_var_name in locked) if(!check_rights(R_DEBUG|R_DEV|R_FUN)) return + if(param_var_name == "holder") + if(!check_rights(R_SERVER)) return if(!autodetect_class) diff --git a/code/modules/aurora/duty officer.dm b/code/modules/aurora/duty officer.dm index 9a104d65..b5053b8b 100644 --- a/code/modules/aurora/duty officer.dm +++ b/code/modules/aurora/duty officer.dm @@ -124,6 +124,14 @@ M.equip_if_possible(new /obj/item/weapon/melee/telebaton(M), slot_l_store) M.equip_if_possible(new /obj/item/device/taperecorder(M), slot_r_store) + var /obj/item/weapon/storage/lockbox/lockbox = new(M) + lockbox.req_access = list(access_cent_captain) + lockbox.name = "A Duty Officer briefcase" + lockbox.desc = "A smart looking briefcase with a NT logo on the side" + lockbox.storage_slots = 8 + lockbox.max_combined_w_class = 16 + M.equip_if_possible(lockbox, slot_l_hand) + var/obj/item/device/pda/central/pda = new(M) pda.owner = M.real_name pda.ownjob = "Central Command Duty Officer" diff --git a/code/modules/aurora/sqlnews_controller.dm b/code/modules/aurora/sqlnews_controller.dm new file mode 100644 index 00000000..f3120494 --- /dev/null +++ b/code/modules/aurora/sqlnews_controller.dm @@ -0,0 +1,96 @@ +/* + * + *For housing code that's related to bringing news over at preset times from an SQL database into the game and publish them + * + *The basic premise is: + *This gets created in the master controller. + *It then starts checking and crawling down an organized SQL list. + *Releases news articles one after another, based on when they're meant to be released. + *It's recursive and kills itself once it runs to the end of it's list. + * + *TO DO: + *Make it create a new feed channel if specified. + * + */ + +var/global/datum/sqlnews/sqlnews_controller + +datum/sqlnews + var/count = 0 //arbitrary count variable, increased every time an article is pulled, for sorting SQL data. + var/time //publishtime, time in gametime + var/id //id, primary-key, of the news article that's destined for pulling. + var/running = 1 //whenever no results are found, this ticks over to a 0, and thus, no more updates. + +datum/sqlnews/proc/process() + if(!running == 1) //No more news, immediate kill and return. + return + + if(!id && !time) //No entry loaded, update and load one. + update() + return + + else if(time < world.time) //Running late! Time to publish the stored article! + publish() + return + +datum/sqlnews/proc/update() //Updates the stored variables and preppes it for a new run of publish() + establish_db_connection() + if(!dbcon.IsConnected()) + error("SQL database connection failed. Attempted to fetch news information.") + return + + var/DBQuery/query = dbcon.NewQuery("SELECT id, publishtime FROM aurora_news WHERE isnull(notpublishing) ORDER BY publishtime ASC LIMIT [count],1") + query.Execute() + + if(!query.RowCount()) + running = 0 + return + + while(query.NextRow()) + id = query.item[1] + time = text2num(query.item[2]) * 600 + + count++ + +datum/sqlnews/proc/publish() //Uses data stored from the update() proc and: pulls further information required to publish an article, publishes it. + if(!id) + return + + establish_db_connection() + if(!dbcon.IsConnected()) + error("SQL database connection failed. Attempted to fetch news information.") + return + + var/DBQuery/fetchquery = dbcon.NewQuery("SELECT channel, author, body FROM aurora_news WHERE id=[id]") + fetchquery.Execute() + + while(fetchquery.NextRow()) + var/channel = fetchquery.item[1] + var/author = fetchquery.item[2] + var/body = fetchquery.item[3] + + var/datum/feed_message/newMsg = new /datum/feed_message + newMsg.author = author + newMsg.body = body + + var/found //Do we need a new channel or not? + for(var/datum/feed_channel/FC in news_network.network_channels) + if(FC.channel_name == channel) + FC.messages += newMsg + found = 1 + + if(!found) + var/datum/feed_channel/NC = new /datum/feed_channel + NC.channel_name = channel + NC.author = author + NC.locked = 1 + NC.is_admin_channel = 1 + news_network.network_channels += NC + + NC.messages += newMsg + + for(var/obj/machinery/newscaster/NEWSCASTER in allCasters) + NEWSCASTER.newsAlert("[channel]") + + id = null + time = null \ No newline at end of file diff --git a/code/modules/aurora/stationdirectives.dm b/code/modules/aurora/stationdirectives.dm new file mode 100644 index 00000000..eeb2f3c0 --- /dev/null +++ b/code/modules/aurora/stationdirectives.dm @@ -0,0 +1,62 @@ +/* + * + *For housing procs and things related to the viewing of Station Directives. + *Later iterations may get bound through other DMs + * + */ + +/* + *Proc for fetching and displaying the Station Directives + */ + +/client/proc/directiveslookup(var/screen = 1, var/queryid="") + var/dat = "
Station Directives
NanoTrasen
NSS Aurora

" + dat += "
OOC Information:
These directives mock the Standard Operating Procedure which would otherwise be in place aboard the station. They are not enforced out of character wise, however, you may find your character penalized in-game for not following them.

" + + establish_db_connection() + if(!dbcon.IsConnected()) + dat += text("
ERROR: Unable to contact external database.
") + error("SQL database connection failed. Attempted to fetch form information.") + + switch(screen) + if(1) + var/DBQuery/query = dbcon.NewQuery("SELECT id, name FROM aurora_directives") + query.Execute() + dat += "
" + dat += "" + + while(query.NextRow()) + var/id = text2num(query.item[1]) + var/name = query.item[2] + + var/bgcolor = "#e3e3e3" + if(id%2 == 0) + bgcolor = "white" + dat += "" + dat += "
Regarding Station Directives
Directive #[id][name]Review
" + if(2) + if(!queryid) + return //this should never happen + + var/DBQuery/searchquery = dbcon.NewQuery("SELECT id, name, data FROM aurora_directives WHERE id=[queryid]") + searchquery.Execute() + + while(searchquery.NextRow()) + var/id = searchquery.item[1] + var/name = searchquery.item[2] + var/data = searchquery.item[3] + + dat += "
Directive #[id]
'[name]'

" + dat += "
[data]
" + + dat += "
Return to Index
" + if(3) + dat += "
Regarding Station Directives

" + dat += "
The Station Directives are a set of specific orders and directives issued and enforced aboard a specific NanoTrasen Corporation installation. This terminal provides access to orders and directives enforced aboard the NSS Aurora. Note that these are only enforced upon NanoTrasen Employees, and not civilians or visitors, unless ruled otherwise by sector specific Central Command.

" + dat += "Overwriting power of general NanoTrasen Corporate Regulation is given to the Station Directives. Should a conflict emerge, the Station Directives active aboard the specific installation are to be adhered to, over Corporate Regulation.

" + dat += "Punishment for a violation of Station Directives should be escalated in the following fashion:
" + dat += "Dependant on the violation and actual crimes concerned, punishment may be escalated faster, with intent to ensure in the safety of station, equipment and crew.
" + dat += "During non-standard operation, and highly abnormal circumstances, Station Directives may be overlooked, for the sake of a less costly solution to the given emergency. Note that should a follow-on review find this solution to have been more detrimental, and the breach of Directives and Regulation be unwarranted, then such an act will be punished.
" + dat += "
Return to Index
" + + usr << browse("[dat]", "window=station_directives;size=400x400") \ No newline at end of file diff --git a/code/modules/client/client procs.dm b/code/modules/client/client procs.dm index 693fb45d..d7456e40 100644 --- a/code/modules/client/client procs.dm +++ b/code/modules/client/client procs.dm @@ -66,6 +66,19 @@ if("prefs") return prefs.process_link(usr,href_list) if("vars") return view_var_Topic(href,href_list,hsrc) + //Station Directives screen switch + switch(text2num(href_list["directivescreen"])) + if(null) + if(1) + directiveslookup(1) + if(3) + directiveslookup(3) + //2 should not be reachable through here. + + if(href_list["directiveview"]) + var/queryid = sanitizeSQL(href_list["directiveview"]) + directiveslookup(2, queryid) + ..() //redirect to hsrc.Topic() /client/proc/handle_spam_prevention(var/message, var/mute_type) diff --git a/code/modules/mob/new_player/new_player.dm b/code/modules/mob/new_player/new_player.dm index 84d7fabf..545330a8 100644 --- a/code/modules/mob/new_player/new_player.dm +++ b/code/modules/mob/new_player/new_player.dm @@ -38,10 +38,15 @@ output += "

Observe

" + //Station Directives + if(config.invasive_directives) + output += "

Station Directives

" + if(!IsGuestKey(src.key)) establish_db_connection() if(dbcon.IsConnected()) + var/isadmin = 0 if(src.client && src.client.holder) isadmin = 1 @@ -59,7 +64,7 @@ output += "" - src << browse(output,"window=playersetup;size=210x240;can_close=0") + src << browse(output,"window=playersetup;size=210x260;can_close=0") return Stat() @@ -275,6 +280,9 @@ if(!isnull(href_list["option_[optionid]"])) //Test if this optionid was selected vote_on_poll(pollid, optionid, 1) + if(href_list["showdirectives"]) + client.directiveslookup() + proc/IsJobAvailable(rank) var/datum/job/job = job_master.GetJob(rank) if(!job) return 0 diff --git a/html/changelog.html b/html/changelog.html index 10668a1c..46dc21c1 100644 --- a/html/changelog.html +++ b/html/changelog.html @@ -56,6 +56,15 @@ should be listed in the changelog upon commit though. Thanks. --> +
+

16 March 2015

+

Skull132 updated:

+ +
+

08 March 2015

SoundScopes updated:

diff --git a/nano/templates/pda.tmpl b/nano/templates/pda.tmpl index 590b5f0c..b455b53b 100644 --- a/nano/templates/pda.tmpl +++ b/nano/templates/pda.tmpl @@ -69,6 +69,7 @@ Used In File(s): \code\game\objects\items\devices\PDA\PDA.dm {{:helper.link('Notekeeper', 'note', {'choice' : "1"}, null, 'fixedLeftWide')}} {{:helper.link('Messenger', data.newMessage ? 'mail-closed' : 'mail-open', {'choice' : "2"}, null, 'fixedLeftWide')}} {{:helper.link('Crew Manifest', 'contact', {'choice' : "41"}, null, 'fixedLeftWide')}} + {{:helper.link('Station Directives', 'folder-collapsed', {'choice' : "6"}, null, 'fixedLeftWide')}}

@@ -944,7 +945,38 @@ Used In File(s): \code\game\objects\items\devices\PDA\PDA.dm {{/if}} {{/for}} + + {{else data.mode == 6}} +
+ {{if data.sqlcon==1}} + Unable to access Station Directives + {{else}} +
+ {{for data.directives}} + + {{/for}} +
Directive #{{:value.DirNo}}{{:value.DirName}}{{:helper.link('Review', null, {'choice' : "View Directive", 'queryid' : value.DirNo}, null, 'fixedLeft')}}
+ {{/if}} +
+ + {{else data.mode == 61}} +
+
+ Directive #{{:data.DirNo}}: +
+
+ '{{:data.DirName}}' +
+
+
+
+
+ {{:data.DirData}} +
+
+
{{/if}} + {{else}}







No Owner information found, please swipe ID