diff --git a/SQL/aurora_schema.sql b/SQL/aurora_schema.sql index a30eeb7a..c33433bd 100644 --- a/SQL/aurora_schema.sql +++ b/SQL/aurora_schema.sql @@ -120,40 +120,3 @@ CREATE TABLE `ss13_santa` ( `gift_assigned` varchar(255) DEFAULT NULL, PRIMARY KEY (`character_name`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; - --- ------------------------------ --- SQL based connection log --- tgstation.ss13_connection_log --- ------------------------------ -CREATE TABLE `ss13_connection_log` ( - `id` INT UNSIGNED NOT NULL AUTO_INCREMENT, - `datetime` DATETIME NOT NULL, - `serverip` VARCHAR(32) NOT NULL, - `ckey` VARCHAR(32) NOT NULL, - `ip` VARCHAR(32) NOT NULL, - `computerid` VARCHAR(32) NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; - --- ------------------------------ --- SQL based whitelist index --- tgstation.ss13_whitelist_statuses --- ------------------------------ -CREATE TABLE `ss13_whitelist_statuses` ( - `flag` INT(10) UNSIGNED NOT NULL, - `status_name` VARCHAR(32) NOT NULL, - PRIMARY KEY (`flag`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; - --- ------------------------------ --- SQL based whitelist modification log --- tgstation.ss13_whitelist_log --- ------------------------------ -CREATE TABLE `ss13_whitelist_log` ( - `id` INT UNSIGNED NOT NULL AUTO_INCREMENT, - `datetime` DATETIME NOT NULL, - `user` VARCHAR(32) NOT NULL, - `action_method` VARCHAR(32) NOT NULL DEFAULT 'Game Server', - `action` VARCHAR(32) NOT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; diff --git a/SQL/feedback_schema.sql b/SQL/feedback_schema.sql index 4208a579..bb2baf83 100644 --- a/SQL/feedback_schema.sql +++ b/SQL/feedback_schema.sql @@ -61,7 +61,6 @@ CREATE TABLE `ss13_player` ( `ip` varchar(18) NOT NULL, `computerid` varchar(32) NOT NULL, `lastadminrank` varchar(32) NOT NULL DEFAULT 'Player', - `whitelist_status` INT(11) UNSIGNED NOT NULL DEFAULT '0', PRIMARY KEY (`id`), UNIQUE KEY `ckey` (`ckey`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 ; @@ -118,4 +117,4 @@ CREATE TABLE `ss13_privacy` ( `ckey` varchar(32) NOT NULL, `option` varchar(128) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 ; +) ENGINE=InnoDB DEFAULT CHARSET=latin1 ; \ No newline at end of file diff --git a/code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm b/code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm index f74d2285..fe0f0308 100644 --- a/code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm +++ b/code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm @@ -120,14 +120,14 @@ if(pressure_delta > 0.5) if(pump_direction) //internal -> external if (node1 && (environment.temperature || air1.temperature)) - var/transfer_moles = calculate_transfer_moles(air1, environment) + var/transfer_moles = calculate_transfer_moles(air1, environment, pressure_delta) power_draw = pump_gas(src, air1, environment, transfer_moles, power_rating) if(power_draw >= 0 && network1) network1.update = 1 else //external -> internal if (node2 && (environment.temperature || air2.temperature)) - var/transfer_moles = calculate_transfer_moles(environment, air2, (network2)? network2.volume : 0) + var/transfer_moles = calculate_transfer_moles(environment, air2, pressure_delta, (network2)? network2.volume : 0) //limit flow rate from turfs transfer_moles = min(transfer_moles, environment.total_moles*air2.volume/environment.volume) //group_multiplier gets divided out here diff --git a/code/ATMOSPHERICS/components/unary/vent_pump.dm b/code/ATMOSPHERICS/components/unary/vent_pump.dm index 9f1b492e..ecb2eebe 100644 --- a/code/ATMOSPHERICS/components/unary/vent_pump.dm +++ b/code/ATMOSPHERICS/components/unary/vent_pump.dm @@ -26,6 +26,7 @@ var/area_uid var/id_tag = null + var/hibernate = 0 //Do we even process? var/pump_direction = 1 //0 = siphoning, 1 = releasing var/external_pressure_bound = EXTERNAL_PRESSURE_BOUND @@ -88,7 +89,7 @@ /obj/machinery/atmospherics/unary/vent_pump/engine name = "Engine Core Vent" power_channel = ENVIRON - power_rating = 15000 //15 kW ~ 20 HP + power_rating = 30000 //15 kW ~ 20 HP /obj/machinery/atmospherics/unary/vent_pump/engine/New() ..() @@ -150,8 +151,8 @@ /obj/machinery/atmospherics/unary/vent_pump/process() ..() - last_power_draw = 0 - last_flow_rate = 0 + if (hibernate) + return 1 if (!node) use_power = 0 @@ -168,15 +169,26 @@ if((environment.temperature || air_contents.temperature) && pressure_delta > 0.5) if(pump_direction) //internal -> external - var/transfer_moles = calculate_transfer_moles(air_contents, environment) + var/transfer_moles = calculate_transfer_moles(air_contents, environment, pressure_delta) power_draw = pump_gas(src, air_contents, environment, transfer_moles, power_rating) else //external -> internal - var/transfer_moles = calculate_transfer_moles(environment, air_contents, (network)? network.volume : 0) + var/transfer_moles = calculate_transfer_moles(environment, air_contents, pressure_delta, (network)? network.volume : 0) //limit flow rate from turfs transfer_moles = min(transfer_moles, environment.total_moles*air_contents.volume/environment.volume) //group_multiplier gets divided out here power_draw = pump_gas(src, environment, air_contents, transfer_moles, power_rating) + else + //If we're in an area that is fucking ideal, and we don't have to do anything, chances are we won't next tick either so why redo these calculations? + //JESUS FUCK. THERE ARE LITERALLY 250 OF YOU MOTHERFUCKERS ON ZLEVEL ONE AND YOU DO THIS SHIT EVERY TICK WHEN VERY OFTEN THERE IS NO REASON TO + + if(pump_direction && pressure_checks == PRESSURE_CHECK_EXTERNAL && controller_iteration > 10) //99% of all vents + //Fucking hibernate because you ain't doing shit. + hibernate = 1 + spawn(rand(100,200)) //hibernate for 10 or 20 seconds randomly + hibernate = 0 + + if (power_draw >= 0) last_power_draw = power_draw use_power(power_draw) @@ -238,54 +250,41 @@ initial_loc.air_vent_names[id_tag] = new_name src.name = new_name initial_loc.air_vent_info[id_tag] = signal.data - radio_connection.post_signal(src, signal, radio_filter_out) - return 1 - - /obj/machinery/atmospherics/unary/vent_pump/initialize() ..() - //some vents work his own spesial way radio_filter_in = frequency==1439?(RADIO_FROM_AIRALARM):null radio_filter_out = frequency==1439?(RADIO_TO_AIRALARM):null if(frequency) set_frequency(frequency) - /obj/machinery/atmospherics/unary/vent_pump/receive_signal(datum/signal/signal) if(stat & (NOPOWER|BROKEN)) return + hibernate = 0 //log_admin("DEBUG \[[world.timeofday]\]: /obj/machinery/atmospherics/unary/vent_pump/receive_signal([signal.debug_print()])") if(!signal.data["tag"] || (signal.data["tag"] != id_tag) || (signal.data["sigtype"]!="command")) return 0 - if(signal.data["purge"] != null) pressure_checks &= ~1 pump_direction = 0 - if(signal.data["stabalize"] != null) pressure_checks |= 1 pump_direction = 1 - if(signal.data["power"] != null) use_power = text2num(signal.data["power"]) - if(signal.data["power_toggle"] != null) use_power = !use_power - if(signal.data["checks"] != null) if (signal.data["checks"] == "default") pressure_checks = pressure_checks_default else pressure_checks = text2num(signal.data["checks"]) - if(signal.data["checks_toggle"] != null) pressure_checks = (pressure_checks?0:3) - if(signal.data["direction"] != null) pump_direction = text2num(signal.data["direction"]) - if(signal.data["set_internal_pressure"] != null) if (signal.data["set_internal_pressure"] == "default") internal_pressure_bound = internal_pressure_bound_default @@ -295,7 +294,6 @@ text2num(signal.data["set_internal_pressure"]), ONE_ATMOSPHERE*50 ) - if(signal.data["set_external_pressure"] != null) if (signal.data["set_external_pressure"] == "default") external_pressure_bound = external_pressure_bound_default @@ -305,32 +303,25 @@ text2num(signal.data["set_external_pressure"]), ONE_ATMOSPHERE*50 ) - if(signal.data["adjust_internal_pressure"] != null) internal_pressure_bound = between( 0, internal_pressure_bound + text2num(signal.data["adjust_internal_pressure"]), ONE_ATMOSPHERE*50 ) - if(signal.data["adjust_external_pressure"] != null) - - external_pressure_bound = between( 0, external_pressure_bound + text2num(signal.data["adjust_external_pressure"]), ONE_ATMOSPHERE*50 ) - if(signal.data["init"] != null) name = signal.data["init"] return - if(signal.data["status"] != null) spawn(2) broadcast_status() return //do not update_icon - //log_admin("DEBUG \[[world.timeofday]\]: vent_pump/receive_signal: unknown command \"[signal.data["command"]]\"\n[signal.debug_print()]") spawn(2) broadcast_status() @@ -368,13 +359,11 @@ user << "You are too far away to read the gauge." if(welded) user << "It seems welded shut." - /obj/machinery/atmospherics/unary/vent_pump/power_change() var/old_stat = stat ..() if(old_stat != stat) update_icon() - /obj/machinery/atmospherics/unary/vent_pump/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob) if (!istype(W, /obj/item/weapon/wrench)) return ..() @@ -400,14 +389,12 @@ "You hear ratchet.") new /obj/item/pipe(loc, make_from=src) del(src) - /obj/machinery/atmospherics/unary/vent_pump/Del() if(initial_loc) initial_loc.air_vent_info -= id_tag initial_loc.air_vent_names -= id_tag ..() return - /* Alt-click to vent crawl - Monkeys, aliens, slimes and mice. This is a little buggy but somehow that just seems to plague ventcrawl. diff --git a/code/controllers/configuration.dm b/code/controllers/configuration.dm index 1a60f756..4080c325 100644 --- a/code/controllers/configuration.dm +++ b/code/controllers/configuration.dm @@ -88,8 +88,6 @@ var/aurorawikiurl var/githuburl - var/whitelists_on_sql = 0 //Changes how whitelists are handled. SQL connection required to run this! - //Alert level description var/alert_desc_green = "All threats to the station have passed. Security may not have weapons visible, privacy laws are once again fully enforced." var/alert_desc_blue_upto = "The station has received reliable information about possible hostile activity on the station. Security staff may have weapons visible, random searches are permitted." @@ -530,9 +528,6 @@ if("topic_safe_address") topic_safe_address = value - if ("whitelists_on_sql") - config.whitelists_on_sql = 1 - else log_misc("Unknown setting in configuration: '[name]'") diff --git a/code/defines/procs/dbcore.dm b/code/defines/procs/dbcore.dm index af387497..ddc7191e 100644 --- a/code/defines/procs/dbcore.dm +++ b/code/defines/procs/dbcore.dm @@ -48,45 +48,45 @@ DBConnection var/server = "" var/port = 3306 -DBConnection/New(dbi_handler, username, password_handler, cursor_handler) - dbi = dbi_handler - user = username - password = password_handler - default_cursor = cursor_handler +DBConnection/New(dbi_handler,username,password_handler,cursor_handler) + src.dbi = dbi_handler + src.user = username + src.password = password_handler + src.default_cursor = cursor_handler _db_con = _dm_db_new_con() -DBConnection/proc/Connect(dbi_handler = dbi, user_handler = user, password_handler = password, cursor_handler) - if (!sqllogging) - return 0 - if (!src) - return 0 - cursor_handler = default_cursor - if (!cursor_handler) - cursor_handler = Default_Cursor - return _dm_db_connect(_db_con,dbi_handler, user_handler, password_handler, cursor_handler, null) - -DBConnection/proc/Disconnect() - return _dm_db_close(_db_con) - -DBConnection/proc/IsConnected() +DBConnection/proc/Connect(dbi_handler=src.dbi,user_handler=src.user,password_handler=src.password,cursor_handler) if(!sqllogging) return 0 + if(!src) return 0 + cursor_handler = src.default_cursor + if(!cursor_handler) cursor_handler = Default_Cursor + return _dm_db_connect(_db_con,dbi_handler,user_handler,password_handler,cursor_handler,null) + +DBConnection/proc/Disconnect() return _dm_db_close(_db_con) + +DBConnection/proc/IsConnected() + if(!sqllogging) return 0 var/success = _dm_db_is_connected(_db_con) return success -DBConnection/proc/Quote(str) - return _dm_db_quote(_db_con,str) - -DBConnection/proc/ErrorMsg() - return _dm_db_error_msg(_db_con) +DBConnection/proc/Quote(str) return _dm_db_quote(_db_con,str) +DBConnection/proc/ErrorMsg() return _dm_db_error_msg(_db_con) DBConnection/proc/SelectDB(database_name,dbi) if(IsConnected()) Disconnect() //return Connect("[dbi?"[dbi]":"dbi:mysql:[database_name]:[DB_SERVER]:[DB_PORT]"]",user,password) - return Connect("[dbi?"[dbi]":"dbi:mysql:[database_name]:[sqladdress]:[sqlport]"]", user, password) + return Connect("[dbi?"[dbi]":"dbi:mysql:[database_name]:[sqladdress]:[sqlport]"]",user,password) +DBConnection/proc/NewQuery(sql_query,cursor_handler=src.default_cursor) return new/DBQuery(sql_query,src,cursor_handler) + + +DBQuery/New(sql_query,DBConnection/connection_handler,cursor_handler) + if(sql_query) src.sql = sql_query + if(connection_handler) src.db_connection = connection_handler + if(cursor_handler) src.default_cursor = cursor_handler + _db_query = _dm_db_new_query() + return ..() -DBConnection/proc/NewQuery(sql_query, cursor_handler = default_cursor) - return new/DBQuery(sql_query, src, cursor_handler) DBQuery var/sql // The sql query being executed. @@ -98,53 +98,34 @@ DBQuery var/DBConnection/db_connection var/_db_query -DBQuery/New(var/sql_query, var/DBConnection/connection_handler, var/cursor_handler) - if (sql_query) - sql = sql_query - if (connection_handler) - db_connection = connection_handler - if (cursor_handler) - default_cursor = cursor_handler - _db_query = _dm_db_new_query() - return ..() +DBQuery/proc/Connect(DBConnection/connection_handler) src.db_connection = connection_handler -DBQuery/proc/Connect(DBConnection/connection_handler) - db_connection = connection_handler - -DBQuery/proc/Execute(var/list/argumentList = null, var/passNotFound = 0, sql_query = sql, cursor_handler = default_cursor) +DBQuery/proc/Execute(sql_query=src.sql,cursor_handler=default_cursor) Close() + return _dm_db_execute(_db_query,sql_query,db_connection._db_con,cursor_handler,null) - if (argumentList) - parseArguments(argumentList, passNotFound) +DBQuery/proc/NextRow() return _dm_db_next_row(_db_query,item,conversions) - return _dm_db_execute(_db_query, sql_query, db_connection._db_con, cursor_handler, null) +DBQuery/proc/RowsAffected() return _dm_db_rows_affected(_db_query) -DBQuery/proc/NextRow() - return _dm_db_next_row(_db_query,item,conversions) +DBQuery/proc/RowCount() return _dm_db_row_count(_db_query) -DBQuery/proc/RowsAffected() - return _dm_db_rows_affected(_db_query) - -DBQuery/proc/RowCount() - return _dm_db_row_count(_db_query) - -DBQuery/proc/ErrorMsg() - return _dm_db_error_msg(_db_query) +DBQuery/proc/ErrorMsg() return _dm_db_error_msg(_db_query) DBQuery/proc/Columns() - if (!columns) + if(!columns) columns = _dm_db_columns(_db_query,/DBColumn) return columns DBQuery/proc/GetRowData() var/list/columns = Columns() var/list/results - if (columns.len) + if(columns.len) results = list() - for (var/C in columns) - results += C + for(var/C in columns) + results+=C var/DBColumn/cur_col = columns[C] - results[C] = item[(cur_col.position+1)] + results[C] = src.item[(cur_col.position+1)] return results DBQuery/proc/Close() @@ -157,49 +138,11 @@ DBQuery/proc/Quote(str) return db_connection.Quote(str) DBQuery/proc/SetConversion(column,conversion) - if (istext(column)) - column = columns.Find(column) - if (!conversions) - conversions = new/list(column) - else if (conversions.len < column) - conversions.len = column + if(istext(column)) column = columns.Find(column) + if(!conversions) conversions = new/list(column) + else if(conversions.len < column) conversions.len = column conversions[column] = conversion -/* Works similarly to the PDO object's Execute() method in PHP. -* Insert a list of keys/values, it searches the SQL syntax for the keys, -* and replaces them with sanitized versions of the values. -* Can be called independently, or through dbcon.Execute(), where the list would be the first argument. -* passNotFound controls whether or not is passes keys not found in the SQL query. -* Keys are /case-sensitive/, be careful! -* Returns FALSE upon failure, TRUE otherwise, so it can be used in checks and so on. -* - Skull132 -*/ -DBQuery/proc/parseArguments(var/list/argumentList, var/passNotFound = 0) - if (!sql || !argumentList || !argumentList.len) - return 0 - - for (var/placeholder in argumentList) - if (!findtextEx(sql, placeholder)) - if (passNotFound) - continue - else - return 0 - - var/argument = argumentList[placeholder] - - if (isnull(argument)) - argument = "NULL" - else if (istext(argument)) - argument = dbcon.Quote(argument) - else if (isnum(argument)) - argument = "'[argument]'" - else - return 0 - - sql = replacetextEx(sql, placeholder, argument) - - return 1 - DBColumn var/name @@ -210,45 +153,32 @@ DBColumn var/length var/max_length -DBColumn/New(name_handler, table_handler, position_handler, type_handler, flag_handler, length_handler, max_length_handler) - name = name_handler - table = table_handler - position = position_handler - sql_type = type_handler - flags = flag_handler - length = length_handler - max_length = max_length_handler +DBColumn/New(name_handler,table_handler,position_handler,type_handler,flag_handler,length_handler,max_length_handler) + src.name = name_handler + src.table = table_handler + src.position = position_handler + src.sql_type = type_handler + src.flags = flag_handler + src.length = length_handler + src.max_length = max_length_handler return ..() -DBColumn/proc/SqlTypeName(type_handler = sql_type) - switch (type_handler) - if (TINYINT) - return "TINYINT" - if (SMALLINT) - return "SMALLINT" - if (MEDIUMINT) - return "MEDIUMINT" - if (INTEGER) - return "INTEGER" - if (BIGINT) - return "BIGINT" - if (FLOAT) - return "FLOAT" - if (DOUBLE) - return "DOUBLE" - if (DATE) - return "DATE" - if (DATETIME) - return "DATETIME" - if (TIMESTAMP) - return "TIMESTAMP" - if (TIME) - return "TIME" - if (STRING) - return "STRING" - if (BLOB) - return "BLOB" +DBColumn/proc/SqlTypeName(type_handler=src.sql_type) + switch(type_handler) + if(TINYINT) return "TINYINT" + if(SMALLINT) return "SMALLINT" + if(MEDIUMINT) return "MEDIUMINT" + if(INTEGER) return "INTEGER" + if(BIGINT) return "BIGINT" + if(FLOAT) return "FLOAT" + if(DOUBLE) return "DOUBLE" + if(DATE) return "DATE" + if(DATETIME) return "DATETIME" + if(TIMESTAMP) return "TIMESTAMP" + if(TIME) return "TIME" + if(STRING) return "STRING" + if(BLOB) return "BLOB" #undef Default_Cursor diff --git a/code/game/jobs/whitelist.dm b/code/game/jobs/whitelist.dm index 599517ce..f9bb469f 100644 --- a/code/game/jobs/whitelist.dm +++ b/code/game/jobs/whitelist.dm @@ -3,36 +3,18 @@ var/list/whitelist = list() /hook/startup/proc/loadWhitelist() - if (config.usewhitelist) + if(config.usewhitelist) load_whitelist() return 1 /proc/load_whitelist() - if (config.whitelists_on_sql) - establish_db_connection() - - if (!dbcon.IsConnected()) - //Continue with the old code if it fails. Stop and return if it succeeds. - log_misc("Database connection failed. Reverting to legacy system.") - config.whitelists_on_sql = 0 - else - return - whitelist = file2list(WHITELISTFILE) - if (!whitelist.len) - whitelist = null - -/proc/check_whitelist(mob/M) - if (config.whitelists_on_sql) - var/head_of_staff_whitelist = 1 - if (M.client && M.client.whitelist_status) - return (M.client.whitelist_status & head_of_staff_whitelist) + if(!whitelist.len) whitelist = null +/proc/check_whitelist(mob/M /*, var/rank*/) + if(!whitelist) return 0 - else - if (!whitelist) - return 0 - return ("[M.ckey]" in whitelist) + return ("[M.ckey]" in whitelist) /var/list/alien_whitelist = list() @@ -42,22 +24,6 @@ var/list/whitelist = list() return 1 /proc/load_alienwhitelist() - if (config.whitelists_on_sql) - establish_db_connection() - - if (!dbcon.IsConnected()) - log_misc("Database connection failed. Reverting to legacy system.") - config.whitelists_on_sql = 0 - else - var/DBQuery/query = dbcon.NewQuery("SELECT status_name, flag FROM ss13_whitelist_statuses") - query.Execute() - - for (query.NextRow()) - if (query.item[1] in whitelisted_species) - whitelisted_species[query.item[1]] = text2num(query.item[2]) - - return - var/text = file2text("config/alienwhitelist.txt") if (!text) log_misc("Failed to load config/alienwhitelist.txt") @@ -66,26 +32,19 @@ var/list/whitelist = list() //todo: admin aliens /proc/is_alien_whitelisted(mob/M, var/species) - if (!config.usealienwhitelist) + if(!config.usealienwhitelist) return 1 - - if (!M || !species) + if(species == "human" || species == "Human") + return 1 +// if(check_rights(R_ADMIN, 0)) +// return 1 + if(!alien_whitelist) return 0 - - if (species == "human" || species == "Human") - return 1 - - if (config.whitelists_on_sql) - if (M.client && M.client.whitelist_status) - return (M.client.whitelist_status & whitelisted_species[species]) - - else - if (!alien_whitelist) - return 0 + if(M && species) for (var/s in alien_whitelist) - if (findtext(s, "[M.ckey] - [species]")) + if(findtext(s,"[M.ckey] - [species]")) return 1 - if (findtext(s, "[M.ckey] - All")) + if(findtext(s,"[M.ckey] - All")) return 1 return 0 diff --git a/code/game/machinery/embedded_controller/airlock_program.dm b/code/game/machinery/embedded_controller/airlock_program.dm index 8cb3abb9..f85f09a5 100644 --- a/code/game/machinery/embedded_controller/airlock_program.dm +++ b/code/game/machinery/embedded_controller/airlock_program.dm @@ -22,6 +22,8 @@ var/state = STATE_IDLE var/target_state = TARGET_NONE + var/waiting_ticks = 0 + var/waiting_ticks_target = 2 // By default, we wait for two ticks before actually signalling the pump to do it's thing. This is to ensure ZAS registers the doors have closed, and we don't leak air. /datum/computer/file/embedded_program/airlock/New(var/obj/machinery/embedded_controller/M) ..(M) @@ -109,10 +111,14 @@ var/shutdown_pump = 0 switch(command) if("cycle_ext") - begin_cycle_out() + //only respond to these commands if the airlock isn't already doing something + //prevents the controller from getting confused and doing strange things + if(state == target_state) + begin_cycle_out() if("cycle_int") - begin_cycle_in() + if(state == target_state) + begin_cycle_in() if("cycle_ext_door") cycleDoors(TARGET_OUTOPEN) @@ -122,14 +128,6 @@ if("abort") stop_cycling() - /* - //dont do this. If the airlock can't get enough air to pressurize the person inside is stuck - state = STATE_PRESSURIZE - target_state = TARGET_NONE - memory["target_pressure"] = ONE_ATMOSPHERE - signalPump(tag_airpump, 1, 1, memory["target_pressure"]) - process() - */ if("force_ext") toggleDoor(memory["exterior_status"], tag_exterior_door, memory["secure"], "toggle") @@ -140,11 +138,9 @@ if("purge") memory["purge"] = !memory["purge"] if(memory["purge"]) - toggleDoor(memory["exterior_status"], tag_exterior_door, 1, "close") - toggleDoor(memory["interior_status"], tag_interior_door, 1, "close") - state = STATE_DEPRESSURIZE + close_doors() + state = STATE_PREPARE target_state = TARGET_NONE - signalPump(tag_airpump, 1, 0, 0) if("secure") memory["secure"] = !memory["secure"] @@ -184,16 +180,21 @@ switch(state) if(STATE_PREPARE) if (check_doors_secured()) + if(waiting_ticks < waiting_ticks_target) + waiting_ticks++ + return + else + waiting_ticks = 0 var/chamber_pressure = memory["chamber_sensor_pressure"] var/target_pressure = memory["target_pressure"] if(memory["purge"]) + //purge apparently means clearing the airlock chamber to vacuum (then refilling, handled later) target_pressure = 0 + state = STATE_DEPRESSURIZE + signalPump(tag_airpump, 1, 0, 0) //send a signal to start depressurizing - if(memory["purge"]) - target_pressure = 0 - - if(chamber_pressure <= target_pressure) + else if(chamber_pressure <= target_pressure) state = STATE_PRESSURIZE signalPump(tag_airpump, 1, 1, target_pressure) //send a signal to start pressurizing @@ -201,40 +202,37 @@ state = STATE_DEPRESSURIZE signalPump(tag_airpump, 1, 0, target_pressure) //send a signal to start depressurizing - //Check for vacuum - this is set after the pumps so the pumps are aiming for 0 - if(!memory["target_pressure"]) - memory["target_pressure"] = ONE_ATMOSPHERE * 0.05 + //Make sure the airlock isn't aiming for pure vacuum - an impossibility + memory["target_pressure"] = max(target_pressure, ONE_ATMOSPHERE * 0.05) if(STATE_PRESSURIZE) if(memory["chamber_sensor_pressure"] >= memory["target_pressure"] * 0.95) - cycleDoors(target_state) - - state = STATE_IDLE - target_state = TARGET_NONE - + //not done until the pump has reported that it's off if(memory["pump_status"] != "off") signalPump(tag_airpump, 0) //send a signal to stop pumping + else + cycleDoors(target_state) + state = STATE_IDLE + target_state = TARGET_NONE if(STATE_DEPRESSURIZE) - if(memory["purge"]) - if(memory["chamber_sensor_pressure"] <= ONE_ATMOSPHERE * 0.05) - state = STATE_PRESSURIZE - signalPump(tag_airpump, 1, 1, memory["target_pressure"]) + if(memory["chamber_sensor_pressure"] <= memory["target_pressure"] * 1.05) + if(memory["purge"]) + memory["purge"] = 0 + memory["target_pressure"] = memory["internal_sensor_pressure"] + state = STATE_PREPARE + target_state = TARGET_NONE - - else if(memory["chamber_sensor_pressure"] <= memory["target_pressure"] * 1.05) - cycleDoors(target_state) - - state = STATE_IDLE - target_state = TARGET_NONE - - //send a signal to stop pumping - if(memory["pump_status"] != "off") + else if(memory["pump_status"] != "off") signalPump(tag_airpump, 0) + else + cycleDoors(target_state) + state = STATE_IDLE + target_state = TARGET_NONE - memory["processing"] = state != target_state + memory["processing"] = (state != target_state) return 1 @@ -321,7 +319,6 @@ datum/computer/file/embedded_program/airlock/proc/signal_mech_sensor(var/command /*---------------------------------------------------------- toggleDoor() - Sends a radio command to a door to either open or close. If the command is 'toggle' the door will be sent a command that reverses it's current state. diff --git a/code/modules/client/client defines.dm b/code/modules/client/client defines.dm index f026c743..cdd394f4 100644 --- a/code/modules/client/client defines.dm +++ b/code/modules/client/client defines.dm @@ -46,6 +46,5 @@ var/player_age = "Requires database" //So admins know why it isn't working - Used to determine how old the account is - in days. var/related_accounts_ip = "Requires database" //So admins know why it isn't working - Used to determine what other accounts previously logged in from this ip var/related_accounts_cid = "Requires database" //So admins know why it isn't working - Used to determine what other accounts previously logged in from this computer id - var/whitelist_status = 0 //Used to determine what whitelists the player has access to. Bitflag field. preload_rsc = 0 // This is 0 so we can set it to an URL once the player logs in and have them download the resources from a different server. diff --git a/code/modules/client/client procs.dm b/code/modules/client/client procs.dm index 135262c9..f461943b 100644 --- a/code/modules/client/client procs.dm +++ b/code/modules/client/client procs.dm @@ -225,14 +225,15 @@ if(!dbcon.IsConnected()) return - var/DBQuery/query = dbcon.NewQuery("SELECT id, datediff(Now(),firstseen) as age, whitelist_status FROM ss13_player WHERE ckey = :ckey") - query.Execute(list(":ckey" = ckey)) + var/sql_ckey = sql_sanitize_text(src.ckey) + + var/DBQuery/query = dbcon.NewQuery("SELECT id, datediff(Now(),firstseen) as age FROM ss13_player WHERE ckey = '[sql_ckey]'") + query.Execute() var/sql_id = 0 player_age = 0 // New players won't have an entry so knowing we have a connection we set this to zero to be updated if their is a record. while(query.NextRow()) sql_id = query.item[1] player_age = text2num(query.item[2]) - whitelist_status = text2num(query.item[3]) break var/DBQuery/query_ip = dbcon.NewQuery("SELECT ckey FROM ss13_player WHERE ip = '[address]'") @@ -260,19 +261,24 @@ if(src.holder) admin_rank = src.holder.rank + var/sql_ip = sql_sanitize_text(src.address) + var/sql_computerid = sql_sanitize_text(src.computer_id) + var/sql_admin_rank = sql_sanitize_text(admin_rank) + + if(sql_id) //Player already identified previously, we need to just update the 'lastseen', 'ip' and 'computer_id' variables - var/DBQuery/query_update = dbcon.NewQuery("UPDATE ss13_player SET lastseen = Now(), ip = :ip, computerid = :computer_id, lastadminrank = :admin_rank WHERE id = :id") - query_update.Execute(list(":ip" = address, ":computer_id" = computer_id, ":admin_rank" = admin_rank, ":id" = sql_id)) + var/DBQuery/query_update = dbcon.NewQuery("UPDATE ss13_player SET lastseen = Now(), ip = '[sql_ip]', computerid = '[sql_computerid]', lastadminrank = '[sql_admin_rank]' WHERE id = [sql_id]") + query_update.Execute() else //New player!! Need to insert all the stuff - var/DBQuery/query_insert = dbcon.NewQuery("INSERT INTO ss13_player (id, ckey, firstseen, lastseen, ip, computerid, lastadminrank) VALUES (null, :ckey, Now(), Now(), :ip, :computer_id, :admin_rank)") - query_insert.Execute(list(":ckey" = ckey, ":ip" = address, ":computer_id" = computer_id, ":admin_rank" = admin_rank)) + var/DBQuery/query_insert = dbcon.NewQuery("INSERT INTO ss13_player (id, ckey, firstseen, lastseen, ip, computerid, lastadminrank) VALUES (null, '[sql_ckey]', Now(), Now(), '[sql_ip]', '[sql_computerid]', '[sql_admin_rank]')") + query_insert.Execute() //Logging player access var/serverip = "[world.internet_address]:[world.port]" - var/DBQuery/query_accesslog = dbcon.NewQuery("INSERT INTO `ss13_connection_log`(`id`, `datetime`, `serverip`, `ckey`, `ip`, `computerid`) VALUES(null, Now(), :server_ip, :ckey, :ip, :computer_id);") - query_accesslog.Execute(list(":server_ip" = serverip, ":ckey" = ckey, ":ip" = address, ":computer_id" = computer_id)) + var/DBQuery/query_accesslog = dbcon.NewQuery("INSERT INTO `ss13_connection_log`(`id`,`datetime`,`serverip`,`ckey`,`ip`,`computerid`) VALUES(null,Now(),'[serverip]','[sql_ckey]','[sql_ip]','[sql_computerid]');") + query_accesslog.Execute() #undef TOPIC_SPAM_DELAY diff --git a/code/modules/detectivework/forensics.dm b/code/modules/detectivework/forensics.dm index 6bd1f103..52ac4436 100644 --- a/code/modules/detectivework/forensics.dm +++ b/code/modules/detectivework/forensics.dm @@ -3,7 +3,7 @@ /obj/item/weapon/storage/box/swabs name = "box of swab kits" desc = "Sterilized equipment within. Do not contaminate." - icon = 'forensics.dmi' + icon = 'icons/obj/forensics.dmi' icon_state = "dnakit" storage_slots=14 can_hold = list("/obj/item/weapon/forensics/swab") @@ -29,7 +29,7 @@ /obj/item/weapon/forensics/swab name = "swab kit" desc = "A sterilized cotton swab and vial used to take forensic samples." - icon = 'forensics.dmi' + icon = 'icons/obj/forensics.dmi' icon_state = "swab" flags = FPRINT | TABLEPASS | CONDUCT | NOBLUDGEON w_class = 1.0 @@ -132,7 +132,7 @@ /obj/item/weapon/storage/briefcase/crimekit name = "Crime Scene Kit" desc = "A stainless steel-plated carrycase for all your forensic needs. Feels heavy." - icon = 'forensics.dmi' + icon = 'icons/obj/forensics.dmi' icon_state = "case" item_state = "case" storage_slots=14 @@ -156,7 +156,7 @@ /obj/item/weapon/forensics/slide name = "microscope slide" desc = "A pair of thin glass panes used in the examination of samples beneath a microscope." - icon = 'forensics.dmi' + icon = 'icons/obj/forensics.dmi' icon_state = "slide" flags = FPRINT | TABLEPASS | CONDUCT | NOBLUDGEON w_class = 1.0 @@ -219,7 +219,7 @@ /obj/machinery/microscope name = "high powered electron microscope" desc = "A highly advanced microscope capable of zooming up to 3000x." - icon = 'forensics.dmi' + icon = 'icons/obj/forensics.dmi' icon_state = "microscope" anchored = 1 var/obj/item/weapon/forensics/sample = null @@ -367,7 +367,7 @@ /obj/item/weapon/forensics/powder name = "fingerprint powder" desc = "A jar containing aluminum powder and a specialized brush." - icon = 'forensics.dmi' + icon = 'icons/obj/forensics.dmi' icon_state = "dust" var/list/complete_prints = list() var/stored = list() @@ -432,7 +432,7 @@ /obj/item/weapon/forensics/fiberkit name = "Fiber Collection Kit" desc = "A magnifying glass and tweezers. Used to lift suit fibers." - icon = 'forensics.dmi' + icon = 'icons/obj/forensics.dmi' icon_state = "m_glass" var/list/fibers_complete = list() var/stored = list()