Files
Aurora.3/code/modules/client/preferences_notification.dm
Lohikar f6dc33a465 Newmap - SMC, Openturf, Arrivals Controller, and Mine Turf Improvements (#1958)
* Replace SSingulo with SScalamity; processing cleanup
- SScalamity now handles blobs as well as singularity-types.
- Processing subtypes have been simplified to not require a stop_processing definition.

* this is probably important

* Remove cascade disabling SSgarbage

* Fixed a bug where dust() did not qdel the target mob

* Misc fixes

* Fix decals surviving break-to-plating

* Subsystem flag tweaks

* Apparently subsystems are new'd before config is.

* Fix paper icons

* Speculative fix for insane lag

* Better machinery stat

* Make organs not use SSoverlay

* Misc bugfixes & tweaks

* Nightmode fixes

* Changelog for SMC

* Port /tg/'s improved MC crash handling

* Add some more SS Recover() procs

* supply_controller -> SScargo

* More New() -> Initialize()

* pAI and robot construction overlays

* Fix cargo unit tests

* Merge the DMM Suite's atom/New() into atoms_init

* Lighting pre-baking

* Lighting initialization logging

* Fix some bad SS init orders

* Fix SSlighting logging; rename Processes to MC

* Speculative fix for insane GC lag

* Prebaked openturf/icon_smooth & fix lighting prebake

* SS init status; SSatoms LATEQDEL

* Fix bug with MC init stat panel

* Fix parallax

* Misc

* Ignore SS_NO_DISPLAY during init

* apparently this is important

* REEEEEE

* Image GC fixes; broadcaster radio-new sanity

* RCON Cleanup

* Move pAI recruiter into subsystem

* Move global solars list into sun subsystem

* Make chickens not use a global

* Demote SSdisposals to SS_BACKGROUND; garbage-debug cleanup

* Speed up space init a little

* Fix bad timer flags on floor drying

* Subsystem panic-restart verb for mins

* Explosion speedup

* Minor subsystem & MC logging tweaks

* SSopenturf improvements

* Make pipenet actually initialize (whoops)

* Minor tweaks

* Implement lighting rounding

* comments are hard okay

* Minor lattice tweaks

* Fix some timer issues & better closet init

* Timer sanity

* Request console tweaks + Storage init sanity

* Minor SSmachiner RCON improvements

* Further reduce world-start timer count

* Standardize subsystem logging

* Garbage hard delete profiling from /tg/

* Timer hang detection & recovery

* Log machines that sleep in process() and fuck up SSmachinery

* Fix an issue with external airlocks sleeping in process()

* Failsafe logging

* Minor tweaks

* Revert "Request console tweaks + Storage init sanity"

This reverts commit 98d3579e35.

* Re-implement RC changes

* Fix SQL FT saving

* Fix SSmachinery sleep in disposals

* Minor SS tweaks

* Paper fixes

* Blood drying fixes

* Merge gameticker and SSticker

* Minor global list init cleanup

* Lagcheck biogenerator & bags

* Tweak SScargo init order; RIG Initialize()

* Caching tweaks

* Remove rogue comma

* Initialize fixes

* Lighting destroy cleanup

* Fix emagging airlocks

* Initial SSicon implementation

* Tweaks & Fixes

* Fire + Air alarm queued icon updates

* Overlays + Queued icon cleanup

* Runtime & background fixes

* Kill some meaningless set statements

* Kill some image qdels

* Bump up lighting rounding val

* Fix adv. scanner destroy runtimes

* Remove unneeded icon update limiting

* Move icon smoothing into helpers

* Show a warning if DM 510 compiles without memory leak hack enabled

* Re-organize subsystems & MC defines a little

* Airlock SFX

* Log of Changes

* Make SSicon_update disable itself when not doing anything

* Fix respawn verb runtime when used early in server-init

* Add more information to MC's stat_entry()

* Replace direct refernces to gcDestroyed with QDEL* macros

* plant_controller -> SSplants

* More plant tweaks

* Add more humor to changelog

* Move parallax globals into SSparallax

* Lighting responsiveness tweaks

* Fix parallax init order & better MC init panel stat

* Make mobs GC

* More overlays + Remove intercom spawn()

* SSfast_process; make pinpointers not use spawn-recursion to process
Also made the SM Cascade beach process with SSprocessing instead of a spawn loop.

* Update changelog

* Mob GC tweaks

* Del() cleanup

* Fix insomniac ZAS connection edges

* Minor pAI cleanup

* Convert more things to SSoverlay; fix duplicated overlay in field gens

* SM Bluespace turf tweaks

* Update SSgarbage debug globals list

* Human-type qdel tweaks

* Subsystem suspension; stat_entry improvements

* SQL Statistics cleanup

* Fix runtimes with ambrosia

* More disable() -> suspend(); fix nightmode again

* Human qdel fix; minor tweaks

* Update turbolift to work with StonedMC

* Make lifts use timers instead of a subsystem

* Make SSassets start earlier

* Convert the radio controller into a subsystem

* Fix some missing CHECK_TICKs in asteroid generation

* MC stat tweaks; make shouldnt_see a typecache

* Kill some redundant debug-controller entries

* radio_controller -> SSradio

* Better SSgarbage hard-del logging from /tg/ upstream

* Logging tweaks + GELF

* Misc client caching improvements

* Slime SSoverlay

* Oven icon fixes

* Implant fixes
- Death implants will no longer spam Common on death of user.
- Death implants should handle a deleted user better.

* Holder tweaks + Welding tool Initialize()

* Fix some bad subsystem logging

* Fix suit cooling units spawning without cells

* Starlight tweaks

* Gibber infinite gib fix

* More SSoverlay stuff

* Make crates use CUT_OVERLAY_IN

* Make SSarrivals suspend instead of disable

* Make openturf use split/phased tick checks

* Speculative fix for unwet timer runtimes

* Blood overlay tweaks/fixes

* Update crusher to play nice with SMC + SSoverlay

* Openturf improvements and fixes

* Minor turbolift tweaks

* Lighting performance improvements + ChangeTurf tweaks

* this is probably important

* Fix wall weld noises on changeturf

* More ChangeTurf tweaks

* Explosion tweaks

* Pre-game lobby tweaks

* Openturf tweaks

* Prevent admins from starting the game before init finishes

* Fix Travis

* Kill an unused var

* Fix ChangeTurf runtimes on openturfs

* Fixes

* Browser datum fixes, asset caching

* Update changelog

* Changelog

* Lobby tweaks

* Ticker tweaks; kill ticker var

* Further lobby tweaks

* Cascade tweaks

* air_master -> SSair

* Reduce overhead from radio autosay

* alarm_manager -> SSalarm

* bomb_processor -> SSexplosives

* corp_regs -> SSlaw

* ZAS overlay fixes

* Small wall icon optimization

* Fix effects master

* Assembly tweaks

* Megavend fixes

* Shuttle fixes

* Camera alert performance improvements

* Fix some world.log spam from lighting overlays

* Fix some Initialize() procs

* Openspace responsiveness tweaks

* Make HE pipes animate through openturfs

* Kill a spawn
2017-05-02 14:40:40 -04:00

199 lines
5.7 KiB
Plaintext

/*
* A simple datum for storing notifications for dispaly.
*/
/datum/client_notification
var/datum/preferences/owner = null
var/list/note_wrapper = list()
var/note_text = ""
var/proc_src = null
var/proc_name = ""
var/proc_args = null
var/persistent = 0
/datum/client_notification/New(var/datum/preferences/prefs, var/list/new_wrapper, var/new_text, var/new_persistence)
if (!prefs)
qdel(src)
return
if (!new_wrapper || new_wrapper.len != 2)
qdel(src)
return
if (!new_text)
qdel(src)
return
owner = prefs
note_wrapper = new_wrapper
note_text = new_text
note_text = replacetextEx(note_text, ":src_ref", "\ref[src]")
note_wrapper[1] = replacetextEx(note_wrapper[1], ":src_ref", "\ref[src]")
if (new_persistence)
persistent = new_persistence
/datum/client_notification/Destroy()
if (owner)
owner.notifications -= src
owner = null
return ..()
/*
* Associates a callback to be executed whenever a notification is dismissed.
*/
/datum/client_notification/proc/tie_callback(var/dismiss_proc_src, var/dismiss_proc, var/dismiss_proc_args)
if (!dismiss_proc_src || !dismiss_proc)
return
proc_src = dismiss_proc_src
proc_name = dismiss_proc
if (dismiss_proc_args)
proc_args = dismiss_proc_args
/*
* Returns the HTML required to display this alert.
*/
/datum/client_notification/proc/get_html()
var/html = "<div class=\"row\">[note_wrapper[1]]"
if (!persistent)
html += "<a href=\"#\" class=\"close\" data-dismiss=\"alert\" aria-label=\"close\">&times;</a>"
html += note_text
html += "[note_wrapper[2]]</div>"
return html
/*
* Dismisses the notification, executing the proc that was set up as necessary.
*/
/datum/client_notification/proc/dismiss()
if (proc_src && proc_name)
call(proc_src, proc_name)(proc_args)
if (!persistent)
qdel(src)
/*
* Adds a new notification datum for later processing.
*/
/datum/preferences/proc/new_notification(var/type, var/text, var/persistent, var/callback_src, var/callback_proc, var/callback_args)
if (!text)
return
var/list/wrapper
switch (type)
if ("success")
wrapper = list("<div class=\"alert alert-success\" notification=\":src_ref\">", "</div>")
if ("info")
wrapper = list("<div class=\"alert alert-info\" notification=\":src_ref\">", "</div>")
if ("warning")
wrapper = list("<div class=\"alert alert-warning\" notification=\":src_ref\">", "</div>")
if ("danger")
wrapper = list("<div class=\"alert alert-danger\" notification=\":src_ref\">", "</div>")
else
wrapper = list("<div class=\"alert alert-info\" notification=\":src_ref\">", "</div>")
var/datum/client_notification/note = new(src, wrapper, text, persistent)
if (callback_src && callback_proc)
note.tie_callback(callback_src, callback_proc, callback_args)
notifications += note
/*
* Gathers all notifications relevant to the client.
*/
/datum/preferences/proc/gather_notifications(var/client/user)
if (!user)
return
if (user.byond_version < config.client_warn_version)
var/version_warn = ""
version_warn += "<b>Your version of BYOND may be out of date!</b><br>"
version_warn += config.client_warn_message
version_warn += "Your version: [user.byond_version].<br>"
version_warn += "Required version to remove this message: [config.client_warn_version] or later.<br>"
version_warn += "Visit http://www.byond.com/download/ to get the latest version of BYOND."
new_notification("danger", version_warn)
if (custom_event_msg && custom_event_msg != "")
var/custom_event_warn = "<b><center>A custom event is taking place!</center></b><br>"
custom_event_warn += "<b>OOC Info:</b><br>[custom_event_msg]"
new_notification("danger", custom_event_warn)
if (lastchangelog != changelog_hash)
winset(user, "rpane.changelog", "background-color=#eaeaea;font-style=bold")
if (config.aggressive_changelog)
new_notification("info", "You have unread updates in the changelog.", callback_src = user, callback_proc = "changes")
else
new_notification("info", "You have unread updates in the changelog.")
if (config.sql_enabled)
var/list/warnings = user.warnings_gather()
if (warnings["unread"])
new_notification("danger", warnings["unread"], 1)
if (warnings["expired"])
new_notification("info", warnings["expired"])
var/linking = user.gather_linking_requests()
if (linking)
new_notification("info", linking, callback_src = user, callback_proc = "check_linking_requests")
var/cciaa_actions = count_ccia_actions(user)
if (cciaa_actions)
new_notification("info", cciaa_actions)
/*
* Helper proc for getting a count of active CCIA actions against the player's character.
*/
/datum/preferences/proc/count_ccia_actions(var/client/user)
if (!user)
return null
if (!establish_db_connection(dbcon))
error("Error initiatlizing database connection while counting CCIA actions.")
return null
var/DBQuery/prep_query = dbcon.NewQuery("SELECT id FROM ss13_characters WHERE ckey = :ckey")
prep_query.Execute(list(":ckey" = user.ckey))
var/list/chars = list()
while (prep_query.NextRow())
chars += text2num(prep_query.item[1])
if (!chars.len)
return null
var/DBQuery/query = dbcon.NewQuery({"SELECT
COUNT(act_chr.action_id) AS action_count
FROM ss13_ccia_action_char act_chr
JOIN ss13_characters chr ON act_chr.char_id = chr.id
JOIN ss13_ccia_actions act ON act_chr.action_id = act.id
WHERE
act_chr.char_id IN :char_id AND
(act.expires_at IS NULL OR act.expires_at >= CURRENT_DATE()) AND
act.deleted_at IS NULL;"})
query.Execute(list(":char_id" = chars))
if (query.NextRow())
var/action_count = text2num(query.item[1])
if (action_count == 0)
return null
var/string = "There are [action_count] active CCIA actions currently active against your character(s)."
return string
return null