Files
CHOMPStation2/code/modules/research/message_server.dm
Erthilo ac30f5f2d3 TG: Sieve stuff, this is a stupidly big commit, I'm sorry, I really am.
Full details in this thread:
http://nanotrasen.com/phpBB3/viewtopic.php?f=16&t=8898
And a summary of the most important bits:
-Door animations no longer desync and do the open-close-open thing. That's been
around so long most people don't even notice
-Welding tools no longer get their icons desynced
-Fixed unpowered mineral door runtimes
-Chemistry machines now require power to run
-Fixed the proc to apply radiation based on armor, which means that you can
actually not die of radiation as quickly if you wear armor that protects against
radiation
--By fixing this, it also fixed the singularity, so you might want to be careful
next time you run by it naked
--Also means that radiation events take armor into account. How great
-Hopefully have a bugfix to prevent borgs from using lag to enter the game
without an AI or laws, but I cannot test it myself other than that it didn't
break anything
-Disposal sound can only play once every couple of ticks, so no more ear-rape by
disposals!
-Lasertag guns can no longer be used to make lasergun turrets
-Cleaned up stray pixels on several doors and the lasertag guns

-Reworked how falsewalls work, now whenever you attack them with certain tools
(drills, welders, etc...) it instantly turns them into a wall and pushes the
attackby(), meaning you might not even notice that you just drilled down a
falsewall, and at the very least they are much more fitting
-Omni-directional PA console! Never have to worry about rotating that fucking
computer again, because now it does it itself!
-The Marisa robe that spawns in the theater no longer protects like armor
-Tweaked coefficient list for fake insulated gloves (misplaced punctuation
messed up the list a tad)
-Moved falsewalls out of 'transfer_valve.dm' and into 'structures.dm'
-Tweaked smoothwalls so it only connects walls with like minerals (only seen
effect is on the new walls)
--Also added appropriate signs to areas
-Reworked portable turrets to be a lot less laggy, now they determine the
projectile type once, then save it so they don't have to go through else if
chains every time they fire
-Added many sprites from WJohnston, but many are not fully implemented (Mostly
floor ones)
-Added a vending machine for engineering, the Engivend. Apparently it was needed
because of the lack of availability of the Autolathe or whatever.
-Added WJohnston's Dark Gygax sprites, then made a Death Squad Gygax out of
them. A bit tougher than the standard Gygax, improved battery, and is pre-fit
with gear, ideally for 'hit and run' tactics
-New Odysseus construction sprites, also removed the Odysseus Carapace in favor
of plasteel like the Ripley, meaning they in terms of construction, a Ripley is
equivalent to an Odysseus
-Added an 'is_hot()' proc, when called it returns the temperature of the item in
K, while taking into account things like whether or not the item is active or
whatever
-Rewrote the Experimental Welding Tool, now instead of having a super-sized
tank, it uses super-concentrated plasma that is turned into gas inside of it as
its fuel source. Meaning, it will never have to be refilled, but it takes time
for it to fill itself
-Added WJ's firelight sprites and code. Wanted to use them, but haven't had a
chance to really implement them, but still, they're there

-Turrets made with lasertag guns now fire their respective team's bolt
-The turrets also automatically target anyone on the opposing team (But will
continue to shoot at anyone, for shits n' giggles)
-Turrets get corresponding sprites based on team
-Shooting a turret with a different team's laser will disable it for 10 seconds
-You can also make ED-209's for your lasertag games/pissing off sec
-These are constructed just like a regular ED, but instead of a security vest
and taser, it requires a lasertag vest and gun (same colors)
-When geared for lasertag, They will not arrest anyone nor melee them, only
patrol (if set) and shoot
-They have their color schemes as well, and can be disabled just like turrets
-For both turrets and EDs, when geared for lasertag, they will not shoot anyone
on the ground, this was due to very quickly learning how fucking OP that was for
1 turret to stunlock 3 people for eternity
-And when they are geared for lasertag, both the turrets and EDs have their
access changed to maint, clown, and mime (This will not stop any of them from
being shot, however)
-As a side note, you can also make lasertag stationary turrets for any map-
related things

-Now walls are based on a plating system, meaning all walls have a girder with a
mineral plating on top of it.
-As of right now, usable minerals are Silver, Gold, Diamond, Uranium, Plasma,
and Sandstone (Lacking sprites for wood, *cough*)
-This also carries over to falsewalls, so you can make falsewalls out of any of
those minerals
-Also, this carries over to powered doors, meaning you can construct useful
doors out of minerals, so you could have actual diamond forts with doors
requiring access to get in or whatever
-All of these are standardized, and for the most part work just like regular
walls, meaning if you start slicing a wall, it will drop the mineral, or if you
drill it, or whatever
-What was mentioned with the smoothwall tweak above, only walls of the same
mineral will connect, so it all looks very nice
-Doors and walls made of uranium emit radiation when interacted with, with walls
causing a 'ripple' effect, so the more walls nearby, the more radiation you get
hit with
-Doors and walls made of plasma burn. It's a short, quick burn, but can easily
be compounded in large structures
--As a note on plasma walls, I cannot get atmos and plasma walls to play nice
(Since they are airless turfs), so I can't actually get them to ignite based on
air temperature, but when they do ignite, they will auto-magically ignite nearby
plasma walls, with a reduced temperature, meaning that if you want a massive
chain reaction over a huge area, you better use something a bit hotter than a
lighter
--Also, when plasma walls burn, they simply leave behind a girder, while doors
leave assemblies
-Lastly, for nearly any kind of destructive action, Diamond walls are much more
resilient, meaning they will take twice as long to be destroyed, and are immune
to the effects of thermite
(Also, sprites for plasma walls and uranium walls are shite right now, waiting
for replacements)
Update:
-Added cult walls as a 'mineral wall', meaning they will work on the same system
and 'ReplaceWithMineralWall("cult")' will change any turf into a cult wall,
hopefully for some cult-related activities soon

R&D stuff:
-Now instead of 1 sheet or ALL OF THE SHEETS, you enter a number as to how many
sheets you want (it's sanitized to hell as well)
-Minerals no longer multiply when inside RnD machines. (Who fucked that one up?
Goddamn)
-Mech fabricators are both deconstructable, and putting higher level parts
actually improve it, each 'Tier' up is equivalent to +1 tech levels for that, so
a High Powered Micro Laser would give the same bonus as +1 Material Research, a
Pico Manipulator would give the same bonus as +2 Engineering, etc
-Complete with a shitty opened Mech Fab sprite!
-And not shitty overlays so autolathe's animate the material that is put in
them, rather than give everything that's not glass the metal animation

LOL THE JOKES ON YOU I JUST COPY PASTED HIS TOPIC

added a few svn ignores, for thumbs.db and maps/backup
Revision: r3751
Author: 	 petethegoat
2012-06-19 21:37:44 +01:00

342 lines
8.9 KiB
Plaintext

/datum/data_pda_msg
var/recipient = "Unspecified" //name of the person
var/sender = "Unspecified" //name of the sender
var/message = "Blank" //transferred message
/datum/data_pda_msg/New(var/param_rec = "",var/param_sender = "",var/param_message = "")
if(param_rec)
recipient = param_rec
if(param_sender)
sender = param_sender
if(param_message)
message = param_message
/datum/data_rc_msg
var/rec_dpt = "Unspecified" //name of the person
var/send_dpt = "Unspecified" //name of the sender
var/message = "Blank" //transferred message
var/stamp = "Unstamped"
var/id_auth = "Unauthenticated"
var/priority = "Normal"
/datum/data_rc_msg/New(var/param_rec = "",var/param_sender = "",var/param_message = "",var/param_stamp = "",var/param_id_auth = "",var/param_priority)
if(param_rec)
rec_dpt = param_rec
if(param_sender)
send_dpt = param_sender
if(param_message)
message = param_message
if(param_stamp)
stamp = param_stamp
if(param_id_auth)
id_auth = param_id_auth
if(param_priority)
switch(param_priority)
if(1)
priority = "Normal"
if(2)
priority = "High"
if(3)
priority = "Extreme"
else
priority = "Undetermined"
/obj/machinery/message_server
icon = 'research.dmi'
icon_state = "server"
name = "Messaging Server"
density = 1
anchored = 1.0
use_power = 1
idle_power_usage = 10
active_power_usage = 100
var/list/datum/data_pda_msg/pda_msgs = list()
var/list/datum/data_rc_msg/rc_msgs = list()
var/active = 1
/obj/machinery/message_server/process()
if((stat & (BROKEN|NOPOWER)) && active)
active = 0
return
update_icon()
return
/obj/machinery/message_server/proc/send_pda_message(var/recipient = "",var/sender = "",var/message = "")
pda_msgs += new/datum/data_pda_msg(recipient,sender,message)
/obj/machinery/message_server/proc/send_rc_message(var/recipient = "",var/sender = "",var/message = "",var/stamp = "", var/id_auth = "", var/priority = 1)
rc_msgs += new/datum/data_rc_msg(recipient,sender,message,stamp,id_auth)
/obj/machinery/message_server/attack_hand(user as mob)
// user << "\blue There seem to be some parts missing from this server. They should arrive on the station in a few days, give or take a few CentCom delays."
user << "You toggle PDA message passing from [active ? "On" : "Off"] to [active ? "Off" : "On"]"
active = !active
update_icon()
return
/obj/machinery/message_server/update_icon()
if((stat & (BROKEN|NOPOWER)))
icon_state = "server-nopower"
else if (!active)
icon_state = "server-off"
else
icon_state = "server-on"
return
/datum/feedback_variable
var/variable
var/value
var/details
New(var/param_variable,var/param_value = 0)
variable = param_variable
value = param_value
proc/inc(var/num = 1)
if(isnum(value))
value += num
else
value = text2num(value)
if(isnum(value))
value += num
else
value = num
proc/dec(var/num = 1)
if(isnum(value))
value -= num
else
value = text2num(value)
if(isnum(value))
value -= num
else
value = -num
proc/set_value(var/num)
if(isnum(num))
value = num
proc/get_value()
return value
proc/get_variable()
return variable
proc/set_details(var/text)
if(istext(text))
details = text
proc/add_details(var/text)
if(istext(text))
if(!details)
details = text
else
details += " [text]"
proc/get_details()
return details
proc/get_parsed()
return list(variable,value,details)
var/obj/machinery/blackbox_recorder/blackbox
/obj/machinery/blackbox_recorder
icon = 'stationobjs.dmi'
icon_state = "blackbox"
name = "Blackbox Recorder"
density = 1
anchored = 1.0
use_power = 1
idle_power_usage = 10
active_power_usage = 100
var/list/messages = list() //Stores messages of non-standard frequencies
var/list/messages_admin = list()
var/list/msg_common = list()
var/list/msg_science = list()
var/list/msg_command = list()
var/list/msg_medical = list()
var/list/msg_engineering = list()
var/list/msg_security = list()
var/list/msg_deathsquad = list()
var/list/msg_syndicate = list()
var/list/msg_mining = list()
var/list/msg_cargo = list()
var/list/datum/feedback_variable/feedback = new()
//Only one can exsist in the world!
New()
if(blackbox)
if(istype(blackbox,/obj/machinery/blackbox_recorder))
del(src)
blackbox = src
Del()
var/turf/T = locate(1,1,2)
if(T)
blackbox = null
var/obj/machinery/blackbox_recorder/BR = new/obj/machinery/blackbox_recorder(T)
BR.msg_common = msg_common
BR.msg_science = msg_science
BR.msg_command = msg_command
BR.msg_medical = msg_medical
BR.msg_engineering = msg_engineering
BR.msg_security = msg_security
BR.msg_deathsquad = msg_deathsquad
BR.msg_syndicate = msg_syndicate
BR.msg_mining = msg_mining
BR.msg_cargo = msg_cargo
BR.feedback = feedback
BR.messages = messages
BR.messages_admin = messages_admin
if(blackbox != BR)
blackbox = BR
..()
proc/find_feedback_datum(var/variable)
for(var/datum/feedback_variable/FV in feedback)
if(FV.get_variable() == variable)
return FV
var/datum/feedback_variable/FV = new(variable)
feedback += FV
return FV
proc/get_round_feedback()
return feedback
proc/round_end_data_gathering()
var/pda_msg_amt = 0
var/rc_msg_amt = 0
for(var/obj/machinery/message_server/MS in world)
if(MS.pda_msgs.len > pda_msg_amt)
pda_msg_amt = MS.pda_msgs.len
if(MS.rc_msgs.len > rc_msg_amt)
rc_msg_amt = MS.rc_msgs.len
/*
feedback_set_details("radio_usage","")
feedback_add_details("radio_usage","COM-[msg_common.len]")
feedback_add_details("radio_usage","SCI-[msg_science.len]")
feedback_add_details("radio_usage","HEA-[msg_command.len]")
feedback_add_details("radio_usage","MED-[msg_medical.len]")
feedback_add_details("radio_usage","ENG-[msg_engineering.len]")
feedback_add_details("radio_usage","SEC-[msg_security.len]")
feedback_add_details("radio_usage","DTH-[msg_deathsquad.len]")
feedback_add_details("radio_usage","SYN-[msg_syndicate.len]")
feedback_add_details("radio_usage","MIN-[msg_mining.len]")
feedback_add_details("radio_usage","CAR-[msg_cargo.len]")
feedback_add_details("radio_usage","OTH-[messages.len]")
feedback_add_details("radio_usage","PDA-[pda_msg_amt]")
feedback_add_details("radio_usage","RC-[rc_msg_amt]")
feedback_set_details("round_end","[time2text(world.realtime)]") //This one MUST be the last one that gets set.
*/
//This proc is only to be called at round end.
proc/save_all_data_to_sql()
if(!feedback) return
round_end_data_gathering() //round_end time logging and some other data processing
var/user = sqlfdbklogin
var/pass = sqlfdbkpass
var/db = sqlfdbkdb
var/address = sqladdress
var/port = sqlport
var/DBConnection/dbcon = new()
dbcon.Connect("dbi:mysql:[db]:[address]:[port]","[user]","[pass]")
if(!dbcon.IsConnected()) return
var/round_id
var/DBQuery/query = dbcon.NewQuery("SELECT MAX(round_id) AS round_id FROM erro_feedback")
query.Execute()
while(query.NextRow())
round_id = query.item[1]
if(!isnum(round_id))
round_id = text2num(round_id)
round_id++
for(var/datum/feedback_variable/FV in feedback)
var/sql = "INSERT INTO erro_feedback VALUES (null, Now(), [round_id], \"[FV.get_variable()]\", [FV.get_value()], \"[FV.get_details()]\")"
var/DBQuery/query_insert = dbcon.NewQuery(sql)
query_insert.Execute()
dbcon.Disconnect()
// Sanitize inputs to avoid SQL injection attacks
proc/sql_sanitize_text(var/text)
text = dd_replacetext(text, "'", "''")
text = dd_replacetext(text, ";", "")
text = dd_replacetext(text, "&", "")
return text
proc/feedback_set(var/variable,var/value)
if(!blackbox) return
variable = sql_sanitize_text(variable)
var/datum/feedback_variable/FV = blackbox.find_feedback_datum(variable)
if(!FV) return
FV.set_value(value)
proc/feedback_inc(var/variable,var/value)
if(!blackbox) return
variable = sql_sanitize_text(variable)
var/datum/feedback_variable/FV = blackbox.find_feedback_datum(variable)
if(!FV) return
FV.inc(value)
proc/feedback_dec(var/variable,var/value)
if(!blackbox) return
variable = sql_sanitize_text(variable)
var/datum/feedback_variable/FV = blackbox.find_feedback_datum(variable)
if(!FV) return
FV.dec(value)
proc/feedback_set_details(var/variable,var/details)
if(!blackbox) return
variable = sql_sanitize_text(variable)
details = sql_sanitize_text(details)
var/datum/feedback_variable/FV = blackbox.find_feedback_datum(variable)
if(!FV) return
FV.set_details(details)
proc/feedback_add_details(var/variable,var/details)
if(!blackbox) return
variable = sql_sanitize_text(variable)
details = sql_sanitize_text(details)
var/datum/feedback_variable/FV = blackbox.find_feedback_datum(variable)
if(!FV) return
FV.add_details(details)