diff --git a/code/__defines/mobs.dm b/code/__defines/mobs.dm index 3fedc45b938..de8ddbf02a8 100644 --- a/code/__defines/mobs.dm +++ b/code/__defines/mobs.dm @@ -56,6 +56,11 @@ #define BP_PRE_HIGH_DIASTOLIC 85 #define BP_IDEAL_DIASTOLIC 60 +#define BLOOD_PRESSURE_HIGH 4 +#define BLOOD_PRESSURE_PRE_HIGH 3 +#define BLOOD_PRESSURE_IDEAL 2 +#define BLOOD_PRESSURE_LOW 1 + //intent flags, why wasn't this done the first time? #define I_HELP "help" #define I_DISARM "disarm" diff --git a/code/__defines/vueui.dm b/code/__defines/vueui.dm index a9f5f11a843..0c43f5b667d 100644 --- a/code/__defines/vueui.dm +++ b/code/__defines/vueui.dm @@ -2,6 +2,7 @@ #define VUEUI_SET_CHECK(a, b, c, d) if (a != b) { a = b; c = d; } #define VUEUI_SET_CHECK_IFNOTSET(a, b, c, d) if (a == null && a != b) { a = b; c = d; } #define VUEUI_SET_IFNOTSET(a, b, c, d) if (a == null) { a = b; c = d; } +#define VUEUI_SET_CHECK_LIST(a, b, c, d) if (!same_entries(a,b)) { a = b; c = d; } // Do not use for lists that contain lists #define THEME_TYPE_DARK 1 #define THEME_TYPE_LIGHT 0 diff --git a/code/_helpers/lists.dm b/code/_helpers/lists.dm index a09e7304877..b6b8e125772 100644 --- a/code/_helpers/lists.dm +++ b/code/_helpers/lists.dm @@ -55,7 +55,15 @@ if(istype(A, type)) .++ - +/proc/same_entries(var/list/first, var/list/second) + if(!islist(first) || !islist(second)) + return FALSE + if(length(first) != length(second)) + return FALSE + for(var/entry in first) + if(!(entry in second) || (first[entry] != second[entry])) + return FALSE + return TRUE //Removes any null entries from the list //Returns TRUE if the list had nulls, FALSE otherwise diff --git a/code/controllers/subsystems/ghostroles.dm b/code/controllers/subsystems/ghostroles.dm index 03a40de9d65..988eb6d2fee 100644 --- a/code/controllers/subsystems/ghostroles.dm +++ b/code/controllers/subsystems/ghostroles.dm @@ -121,8 +121,8 @@ VUEUI_SET_CHECK(data["spawners"][G.short_name]["enabled"], G.enabled, ., data) VUEUI_SET_CHECK(data["spawners"][G.short_name]["count"], G.count, ., data) VUEUI_SET_CHECK(data["spawners"][G.short_name]["max_count"], G.max_count, ., data) - VUEUI_SET_CHECK(data["spawners"][G.short_name]["tags"], G.tags, ., data) - VUEUI_SET_CHECK(data["spawners"][G.short_name]["spawnpoints"], G.spawnpoints, ., data) + VUEUI_SET_CHECK_LIST(data["spawners"][G.short_name]["tags"], G.tags, ., data) + VUEUI_SET_CHECK_LIST(data["spawners"][G.short_name]["spawnpoints"], G.spawnpoints, ., data) /datum/controller/subsystem/ghostroles/Topic(href, href_list) var/datum/vueui/ui = href_list["vueui"] diff --git a/code/game/machinery/adv_med.dm b/code/game/machinery/adv_med.dm index 892bb367f52..7085119818f 100644 --- a/code/game/machinery/adv_med.dm +++ b/code/game/machinery/adv_med.dm @@ -328,7 +328,44 @@ /obj/machinery/body_scanconsole/vueui_data_change(var/list/data, var/mob/user, var/datum/vueui/ui) if(!data) - data = list() + data = list( + "noscan" = null, + "nocons" = null, + "occupied" = null, + "invalid" = null, + "ipc" = null, + "stat" = null, + "name" = null, + "species" = null, + "brain_activity" = null, + "pulse" = null, + "blood_pressure" = null, + "blood_pressure_level" = null, + "blood_volume" = null, + "blood_o2" = null, + "rads" = null, + "cloneLoss" = null, + "oxyLoss" = null, + "bruteLoss" = null, + "fireLoss" = null, + "toxLoss" = null, + "paralysis" = null, + "bodytemp" = null, + "occupant" = null, + "norepiAmt" = null, + "soporAmt" = null, + "bicardAmt" = null, + "dexAmt" = null, + "dermAmt" = null, + "otherAmt" = null, + "bodyparts" = list(), + "organs" = list(), + "missingparts" = list(), + "hasmissing" = null, + "hasvirus" = null, + "hastgvirus" = null, + "tgvirus" = list() + ) var/mob/living/carbon/human/occupant if (connected) @@ -338,7 +375,7 @@ VUEUI_SET_CHECK(data["nocons"], !connected, ., data) VUEUI_SET_CHECK(data["occupied"], connected.occupant, ., data) VUEUI_SET_CHECK(data["invalid"], !!connected.check_species(), ., data) - VUEUI_SET_CHECK(data["ipc"], !!(occupant && isipc(occupant)), ., data) + VUEUI_SET_CHECK(data["ipc"], (occupant && isipc(occupant)), ., data) if (!data["invalid"]) var/datum/reagents/R = occupant.bloodstr @@ -381,21 +418,21 @@ VUEUI_SET_CHECK(data["paralysis"], occupant.paralysis, ., data) VUEUI_SET_CHECK(data["bodytemp"], occupant.bodytemperature, ., data) - VUEUI_SET_CHECK(data["occupant"], occupant, ., data) + VUEUI_SET_CHECK(data["occupant"], !!occupant, ., data) VUEUI_SET_CHECK(data["norepiAmt"], R.get_reagent_amount("norepinephrine"), ., data) VUEUI_SET_CHECK(data["soporAmt"], R.get_reagent_amount("stoxin"), ., data) VUEUI_SET_CHECK(data["bicardAmt"], R.get_reagent_amount("bicaridine"), ., data) VUEUI_SET_CHECK(data["dexAmt"], R.get_reagent_amount("dexalin"), ., data) VUEUI_SET_CHECK(data["dermAmt"], R.get_reagent_amount("dermaline"), ., data) VUEUI_SET_CHECK(data["otherAmt"], R.total_volume - (data["soporAmt"] + data["dexAmt"] + data["bicardAmt"] + data["norepiAmt"] + data["dermAmt"]), ., data) - VUEUI_SET_CHECK(data["bodyparts"], get_external_wound_data(occupant), ., data) - VUEUI_SET_CHECK(data["organs"], get_internal_wound_data(occupant), ., data) + VUEUI_SET_CHECK_LIST(data["bodyparts"], get_external_wound_data(occupant), ., data) + VUEUI_SET_CHECK_LIST(data["organs"], get_internal_wound_data(occupant), ., data) var/list/missing = get_missing_organs(occupant) - VUEUI_SET_CHECK(data["missingparts"], missing, ., data) - VUEUI_SET_CHECK(data["hasmissing"], !!missing.len, ., data) + VUEUI_SET_CHECK_LIST(data["missingparts"], missing, ., data) + VUEUI_SET_CHECK(data["hasmissing"], missing.len, ., data) VUEUI_SET_CHECK(data["hasvirus"], occupant.virus2.len || occupant.viruses.len, ., data) VUEUI_SET_CHECK(data["hastgvirus"], occupant.viruses.len, ., data) - VUEUI_SET_CHECK(data["tgvirus"], occupant.viruses, ., data) + VUEUI_SET_CHECK_LIST(data["tgvirus"], occupant.viruses, ., data) /obj/machinery/body_scanconsole/proc/get_internal_damage(var/obj/item/organ/internal/I) if(I.is_broken()) diff --git a/code/game/machinery/kitchen/microwave.dm b/code/game/machinery/kitchen/microwave.dm index 4d9953b6952..b013e4341bb 100644 --- a/code/game/machinery/kitchen/microwave.dm +++ b/code/game/machinery/kitchen/microwave.dm @@ -258,9 +258,9 @@ VUEUI_MONITOR_VARS(/obj/machinery/microwave, microwavemonitor) // if BYOND lists are smaller than UI, then something (or everything) was removed - wipe the list if(LAZYLEN(contents) < LAZYLEN(data["cookingobjs"])) - VUEUI_SET_CHECK(data["cookingobjs"], list(), ., data) + VUEUI_SET_CHECK_LIST(data["cookingobjs"], list(), ., data) if(LAZYLEN(reagents.reagent_list) < LAZYLEN(data["cookingreas"])) - VUEUI_SET_CHECK(data["cookingreas"], list(), ., data) + VUEUI_SET_CHECK_LIST(data["cookingreas"], list(), ., data) // build the list of objs and reagents if (LAZYLEN(contents)) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 9441ffaba1a..cfe8cd79362 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -1880,36 +1880,38 @@ //Works out blood pressure alert level -- not very accurate /mob/living/carbon/human/proc/get_blood_pressure_alert() var/list/bp = blood_pressure() - var/systolic_alert - var/diastolic_alert + // For a blood pressure, e.g. 120/80 + var/systolic_alert // this is the top number '120' -- highest pressure when heart beats + var/diastolic_alert // this is the bottom number '80' -- lowest pressure when heart relaxes switch(bp[1]) if(BP_HIGH_SYSTOLIC to INFINITY) - systolic_alert = 4 + systolic_alert = BLOOD_PRESSURE_HIGH if(BP_PRE_HIGH_SYSTOLIC to BP_HIGH_SYSTOLIC) - systolic_alert = 3 + systolic_alert = BLOOD_PRESSURE_PRE_HIGH if(BP_IDEAL_SYSTOLIC to BP_PRE_HIGH_SYSTOLIC) - systolic_alert = 2 + systolic_alert = BLOOD_PRESSURE_IDEAL if(-INFINITY to BP_IDEAL_SYSTOLIC) - systolic_alert = 1 + systolic_alert = BLOOD_PRESSURE_LOW switch(bp[2]) if(BP_HIGH_DIASTOLIC to INFINITY) - diastolic_alert = 4 + diastolic_alert = BLOOD_PRESSURE_HIGH if(BP_PRE_HIGH_DIASTOLIC to BP_HIGH_DIASTOLIC) - diastolic_alert = 3 + diastolic_alert = BLOOD_PRESSURE_PRE_HIGH if(BP_IDEAL_DIASTOLIC to BP_PRE_HIGH_DIASTOLIC) - diastolic_alert = 2 + diastolic_alert = BLOOD_PRESSURE_IDEAL if(-INFINITY to BP_IDEAL_DIASTOLIC) - diastolic_alert = 1 - if(systolic_alert == 4 || diastolic_alert == 4) - return 4 - if(systolic_alert == 3 || diastolic_alert == 3) - return 3 - if(systolic_alert == 1 || diastolic_alert == 1) - return 1 - if(systolic_alert <= 2 && diastolic_alert <= 2) - return 2 + diastolic_alert = BLOOD_PRESSURE_LOW + + if(systolic_alert == BLOOD_PRESSURE_HIGH || diastolic_alert == BLOOD_PRESSURE_HIGH) + return BLOOD_PRESSURE_HIGH + if(systolic_alert == BLOOD_PRESSURE_PRE_HIGH || diastolic_alert == BLOOD_PRESSURE_PRE_HIGH) + return BLOOD_PRESSURE_PRE_HIGH + if(systolic_alert == BLOOD_PRESSURE_LOW || diastolic_alert == BLOOD_PRESSURE_LOW) + return BLOOD_PRESSURE_LOW + if(systolic_alert <= BLOOD_PRESSURE_IDEAL && diastolic_alert <= BLOOD_PRESSURE_IDEAL) + return BLOOD_PRESSURE_IDEAL //Point at which you dun breathe no more. Separate from asystole crit, which is heart-related. /mob/living/carbon/human/nervous_system_failure() diff --git a/html/changelogs/bodyscanner-bugfixes.yml b/html/changelogs/bodyscanner-bugfixes.yml new file mode 100644 index 00000000000..36d303680e5 --- /dev/null +++ b/html/changelogs/bodyscanner-bugfixes.yml @@ -0,0 +1,6 @@ +author: mikomyazaki + +delete-after: True + +changes: + - bugfix: "Fixed some small bugs with new bodyscanner UI. Nothing that is noticable by players." \ No newline at end of file diff --git a/vueui/README.md b/vueui/README.md index b08dce43a77..c13e2cc928d 100644 --- a/vueui/README.md +++ b/vueui/README.md @@ -65,7 +65,7 @@ p { ``` ### Step 5: Compile and lint -This ui framework requires whole ui to be compiled for changes to be available. Compilation requires Node.js runtime, that is obtainable in various ways, most common is install from official site. To do initial dependency setup run `npm install` to gather all dependencies needed for ui. Single compilation can be done with `npm run build-dev`, but if you constantly do changes, then `npm run dev` is more convenient, as it compiles everything as soon as change is detected. To make client side code better, you should also lint code with command `npm run lint`. +This ui framework requires whole ui to be compiled for changes to be available. Compilation requires Node.js runtime (>=13.6.0), that is obtainable in various ways, most common is install from official site. To do initial dependency setup run `npm install` to gather all dependencies needed for ui. Single compilation can be done with `npm run build-dev`, but if you constantly do changes, then `npm run dev` is more convenient, as it compiles everything as soon as change is detected. To make client side code better, you should also lint code with command `npm run lint`. ### Step 6: Add built files to repository When changes are made to ui code updated compiled code is needed to be included with PR. To compile code for production run `npm run build` ## Ways to provide data to ui more easily @@ -87,9 +87,10 @@ This way is more primitive, but simpler and allows reverse data flow. Let's look . = newdata = list() VUEUI_SET_CHECK(newdata["uis_var_name"], objects_var_name, ., newdata) VUEUI_SET_CHECK(newdata["has_other_datum"], !!other_datum, ., newdata) + VUEUI_SET_CHECK_LIST(newdata["some_list"], other_list, ., newdata) VUEUI_SET_CHECK_IFNOTSET(newdata["text"], "[other_datum]", ., newdata) ``` -This code functionally is same as example that is provided for var monitors. Macro `VUEUI_SET_CHECK` compare if first two params are equal, if not, then it makes them equal, and also sets third parameter to fourth one (I this case it sets `.` to `newdata`, what makes it return data). `VUEUI_SET_CHECK_IFNOTSET` is almost exactly same, but it's checks if first var is not already set (is null), and if it is null, then it sets it. +This code functionally is same as example that is provided for var monitors. Macro `VUEUI_SET_CHECK` compare if first two params are equal, if not, then it makes them equal, and also sets third parameter to fourth one (I this case it sets `.` to `newdata`, what makes it return data). `VUEUI_SET_CHECK_LIST` should be used if the first two params are lists. `VUEUI_SET_CHECK_IFNOTSET` is almost exactly same, but it's checks if first var is not already set (is null), and if it is null, then it sets it. ### 3. Combination of both ```DM VUEUI_MONITOR_VARS(/datum/mydatum, mydatummonitor) diff --git a/vueui/src/components/view/mcomputer/medical/sensors.vue b/vueui/src/components/view/mcomputer/medical/sensors.vue index 0f7aadff805..3ca40c8536f 100644 --- a/vueui/src/components/view/mcomputer/medical/sensors.vue +++ b/vueui/src/components/view/mcomputer/medical/sensors.vue @@ -100,8 +100,8 @@ export default { } }, getChargeClass(cellCharge) { - if(cellCharge > 10) { - return "highlight" + if(cellCharge > 10) { + return "highlight" } return "bad" } diff --git a/vueui/src/components/view/medical/bodyscanner.vue b/vueui/src/components/view/medical/bodyscanner.vue index bd0ec73ac09..6cefdec6701 100644 --- a/vueui/src/components/view/medical/bodyscanner.vue +++ b/vueui/src/components/view/medical/bodyscanner.vue @@ -11,7 +11,7 @@ -