diff --git a/cev_eris.dme b/cev_eris.dme index 277994e65a2..08721312f17 100644 --- a/cev_eris.dme +++ b/cev_eris.dme @@ -2639,6 +2639,7 @@ #include "code\modules\sanity\sanity_effects.dm" #include "code\modules\sanity\sanity_hallucinations.dm" #include "code\modules\sanity\sanity_lists.dm" +#include "code\modules\sanity\sanity_menu.dm" #include "code\modules\sanity\sanity_mob.dm" #include "code\modules\sanity_grain\sanity_grain.dm" #include "code\modules\scrap\extra_quality.dm" diff --git a/code/_onclick/hud/screen_objects/base_screen_objects.dm b/code/_onclick/hud/screen_objects/base_screen_objects.dm index 3f7ccf6fc63..af3b76f5425 100644 --- a/code/_onclick/hud/screen_objects/base_screen_objects.dm +++ b/code/_onclick/hud/screen_objects/base_screen_objects.dm @@ -452,8 +452,8 @@ if(!ishuman(parentmob)) return FALSE var/mob/living/carbon/human/H = parentmob - H.nano_ui_interact(H) - return TRUE + H?.sanity?.ui_interact(H) + return TRUE //--------------------------------------------------sanity end--------------------------------------------------------- //--------------------------------------------------nsa--------------------------------------------------------- diff --git a/code/modules/asset_cache/asset_list_items.dm b/code/modules/asset_cache/asset_list_items.dm index 12850a0b481..c46c1752770 100644 --- a/code/modules/asset_cache/asset_list_items.dm +++ b/code/modules/asset_cache/asset_list_items.dm @@ -23,6 +23,15 @@ "tgfont.css" = file("tgui/packages/tgfont/static/tgfont.css"), ) +/datum/asset/simple/sanity + assets = list( + "desire.png" = 'icons/ui_icons/sanity/desire.png', + "style.png" = 'icons/ui_icons/sanity/style.png', + "insight.png" = 'icons/ui_icons/sanity/insight.png', + "kneeling.png" = 'icons/ui_icons/sanity/kneeling.png', + "sanity.png" = 'icons/ui_icons/sanity/sanity.png' + ) + // /datum/asset/simple/headers // assets = list( // "alarm_green.gif" = 'icons/program_icons/alarm_green.gif', diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index ef346f65e85..54f0e0e8e17 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -1079,37 +1079,7 @@ var/list/rank_prefix = list(\ set desc = "Browse your character sanity." set category = "IC" set src = usr - nano_ui_interact(src) - -/mob/living/carbon/human/nano_ui_data() - var/list/data = list() - - data["style"] = get_total_style() - data["min_style"] = MIN_HUMAN_STYLE - data["max_style"] = MAX_HUMAN_STYLE - data["sanity"] = sanity.level - data["sanity_max_level"] = sanity.max_level - data["insight"] = sanity.insight - data["desires"] = sanity.desires - data["rest"] = sanity.resting - data["insight_rest"] = sanity.insight_rest - - var/obj/item/implant/core_implant/cruciform/C = get_core_implant(/obj/item/implant/core_implant/cruciform) - if(C) - data["cruciform"] = TRUE - data["righteous_life"] = C.righteous_life - - return data - -/mob/living/carbon/human/nano_ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null, force_open = 1, state = GLOB.default_state) - var/list/data = nano_ui_data() - - ui = SSnano.try_update_ui(user, user, ui_key, ui, data, force_open) - if(!ui) - ui = new(user, src, ui_key, "sanity.tmpl", name, 650, 550, state = state) - ui.auto_update_layout = 1 - ui.set_initial_data(data) - ui.open() + sanity?.ui_interact(src) /mob/living/carbon/human/verb/check_pulse() set category = "Object" diff --git a/code/modules/sanity/sanity_menu.dm b/code/modules/sanity/sanity_menu.dm new file mode 100644 index 00000000000..2f784ac0020 --- /dev/null +++ b/code/modules/sanity/sanity_menu.dm @@ -0,0 +1,44 @@ +/datum/sanity/ui_state(mob/user) + return GLOB.always_state + +/datum/sanity/ui_interact(mob/user, datum/tgui/ui) + ui = SStgui.try_update_ui(user, src, ui) + if(!ui) + ui = new(user, src, "Sanity", owner.name) + ui.set_autoupdate(TRUE) + ui.open() + +/datum/sanity/ui_assets(mob/user) + return list( + get_asset_datum(/datum/asset/simple/sanity) + ) + +/datum/sanity/ui_data(mob/user) + var/list/data = list() + + data["style"] = list( + "value" = owner.get_total_style(), + "min" = MIN_HUMAN_STYLE, + "max" = MAX_HUMAN_STYLE + ) + + data["sanity"] = list( + "value" = level, + "max" = max_level + ) + + data["desires"] = list( + "resting" = resting, + "desires" = desires, + "value" = insight_rest, + ) + + var/obj/item/implant/core_implant/cruciform/C = owner.get_core_implant(/obj/item/implant/core_implant/cruciform) + data["righteous"] = list( + "present" = C ? TRUE : FALSE, + "value" = C?.righteous_life + ) + + data["insight"] = insight + + return data diff --git a/nano/images/desire.png b/icons/ui_icons/sanity/desire.png similarity index 100% rename from nano/images/desire.png rename to icons/ui_icons/sanity/desire.png diff --git a/nano/images/insight.png b/icons/ui_icons/sanity/insight.png similarity index 100% rename from nano/images/insight.png rename to icons/ui_icons/sanity/insight.png diff --git a/nano/images/kneeling.png b/icons/ui_icons/sanity/kneeling.png similarity index 100% rename from nano/images/kneeling.png rename to icons/ui_icons/sanity/kneeling.png diff --git a/nano/images/sanity.png b/icons/ui_icons/sanity/sanity.png similarity index 100% rename from nano/images/sanity.png rename to icons/ui_icons/sanity/sanity.png diff --git a/nano/images/gangnam_style.png b/icons/ui_icons/sanity/style.png similarity index 100% rename from nano/images/gangnam_style.png rename to icons/ui_icons/sanity/style.png diff --git a/nano/templates/sanity.tmpl b/nano/templates/sanity.tmpl deleted file mode 100644 index 2993c39a70b..00000000000 --- a/nano/templates/sanity.tmpl +++ /dev/null @@ -1,138 +0,0 @@ -
{desc}+
{desc}+
{"Currently you don't have desires."}+ )} +
>1,f=23===i?n(2,-24)-n(2,-77):0,C=e<0||0===e&&1/e<0?1:0,g=0;for((e=t(e))!=e||e===Infinity?(d=e!=e?1:0,l=m):(l=o(r(e)/a),e*(s=n(2,-l))<1&&(l--,s*=2),(e+=l+h>=1?f/s:f*n(2,1-h))*s>=2&&(l++,s/=2),l+h>=m?(d=0,l=m):l+h>=1?(d=(e*s-1)*n(2,i),l+=h):(d=e*n(2,h-1)*n(2,i),l=0));i>=8;u[g++]=255&d,d/=256,i-=8);for(l=l<0;u[g++]=255&l,l/=256,p-=8);return u[--g]|=128*C,u},unpack:function(e,t){var o,r=e.length,a=8*r-t-1,i=(1<>1,l=a-7,d=r-1,s=e[d--],u=127&s;for(s>>=7;l>0;u=256*u+e[d],d--,l-=8);for(o=u&(1<<-l)-1,u>>=-l,l+=t;l>0;o=256*o+e[d],d--,l-=8);if(0===u)u=1-c;else{if(u===i)return o?NaN:s?-Infinity:Infinity;o+=n(2,t),u-=c}return(s?-1:1)*o*n(2,u-t)}}},50990:function(e,t,n){"use strict";var o=n(69691),r=n(77e3),a="".split;e.exports=o((function(){return!Object("z").propertyIsEnumerable(0)}))?function(e){return"String"==r(e)?a.call(e,""):Object(e)}:Object},22285:function(e,t,n){"use strict";var o=n(35611),r=n(18444);e.exports=function(e,t,n){var a,i;return r&&"function"==typeof(a=t.constructor)&&a!==n&&o(i=a.prototype)&&i!==n.prototype&&r(e,i),e}},89853:function(e,t,n){"use strict";var o=n(55935),r=Function.toString;"function"!=typeof o.inspectSource&&(o.inspectSource=function(e){return r.call(e)}),e.exports=o.inspectSource},40421:function(e,t,n){"use strict";var o=n(56174),r=n(90311),a=n(35611),i=n(28919),c=n(74217).f,l=n(78870),d=n(59995),s=n(41080),u=n(7056),p=!1,m=s("meta"),h=0,f=Object.isExtensible||function(){return!0},C=function(e){c(e,m,{value:{objectID:"O"+h++,weakData:{}}})},g=e.exports={enable:function(){g.enable=function(){},p=!0;var e=l.f,t=[].splice,n={};n[m]=1,e(n).length&&(l.f=function(n){for(var o=e(n),r=0,a=o.length;rp;p++)if((h=y(e[p]))&&h instanceof d)return h;return new d(!1)}s=u.call(e)}for(f=s.next;!(C=f.call(s)).done;){try{h=y(C.value)}catch(_){throw l(s),_}if("object"==typeof h&&h&&h instanceof d)return h}return new d(!1)}},61781:function(e,t,n){"use strict";var o=n(63518);e.exports=function(e){var t=e["return"];if(t!==undefined)return o(t.call(e)).value}},39881:function(e,t,n){"use strict";var o,r,a,i=n(69691),c=n(6863),l=n(52188),d=n(28919),s=n(17657),u=n(1986),p=s("iterator"),m=!1;[].keys&&("next"in(a=[].keys())?(r=c(c(a)))!==Object.prototype&&(o=r):m=!0);var h=o==undefined||i((function(){var e={};return o[p].call(e)!==e}));h&&(o={}),u&&!h||d(o,p)||l(o,p,(function(){return this})),e.exports={IteratorPrototype:o,BUGGY_SAFARI_ITERATORS:m}},82723:function(e){"use strict";e.exports={}},19997:function(e){"use strict";var t=Math.expm1,n=Math.exp;e.exports=!t||t(10)>22025.465794806718||t(10)<22025.465794806718||-2e-17!=t(-2e-17)?function(e){return 0==(e=+e)?e:e>-1e-6&&e<1e-6?e+e*e/2:n(e)-1}:t},43334:function(e,t,n){"use strict";var o=n(24305),r=Math.abs,a=Math.pow,i=a(2,-52),c=a(2,-23),l=a(2,127)*(2-c),d=a(2,-126);e.exports=Math.fround||function(e){var t,n,a=r(e),s=o(e);return a