From e3e1cc24131ccabc0582f41a79158ee023bd0d5a Mon Sep 17 00:00:00 2001 From: dastrukar <3derid@gmail.com> Date: Thu, 30 Dec 2021 02:21:57 +0800 Subject: [PATCH 1/5] Medical: Port Alternative Trauma Kit UI --- medical/module/traumakit/traumakit.zsc | 267 +++++++++++++++++++++---- 1 file changed, 228 insertions(+), 39 deletions(-) diff --git a/medical/module/traumakit/traumakit.zsc b/medical/module/traumakit/traumakit.zsc index 643367f4..a647f522 100644 --- a/medical/module/traumakit/traumakit.zsc +++ b/medical/module/traumakit/traumakit.zsc @@ -47,14 +47,10 @@ class UaS_TraumaKit : HDWeapon { override void DoEffect() { if (!(owner.player.readyweapon is 'UaS_TraumaKit')) { return; } - statusMessage = "--- \cyTrauma Kit\c- ---\n"; - - if (patient) { statusMessage = statusmessage.."Treating \cg"..patient.player.getusername().."\n\n"; } - else { statusMessage = statusmessage.."\n\n"; } + statusMessage = ""; // This is used for tools to display stuff SetHelpText(); SetPatient(); - WoundList(); CycleWounds(); CycleTools(); HandleSupplies(); @@ -83,10 +79,234 @@ class UaS_TraumaKit : HDWeapon { break; } - if (currentWound) { statusmessage = statusmessage..currentWound.WoundStatus().."\n"; } - TickMessages(); - A_WeaponMessage(statusMessage); + } + + override void DrawHUDStuff(HDStatusBar sb, HDWeapon hdw, HDPlayerPawn hpl) { + if (!patient) return; + // Floats for precision (also required for centering) + int notuas_hudscale = 1; //temp + float textHeight = sb.pSmallFont.mFont.GetHeight() * notuas_hudscale; + float padding = 2 * notuas_hudscale; + float padStep = textHeight + padding; + float halfStep = padStep / 2; + float baseOffset = (-7 * textHeight) + (-3 * padding); + Vector2 hudScale = (notuas_hudscale, notuas_hudscale); + + // Header + sb.DrawString( + sb.pSmallFont, + "--- \cyTrauma Kit\c- ---", + (0, baseOffset), + sb.DI_SCREEN_CENTER | sb.DI_TEXT_ALIGN_CENTER, + Font.CR_GRAY, + scale: hudScale + ); + sb.DrawString( + sb.pSmallFont, + "Treating \cg" .. patient.player.GetUsername(), + (0, baseOffset + textHeight), + sb.DI_SCREEN_CENTER | sb.DI_TEXT_ALIGN_CENTER, + Font.CR_GRAY, + scale: hudScale + ); + + // Wound List + int woundListOffsetX = -12; + float woundListOffsetY = baseOffset + (3 * textHeight) + (3 * padStep); + + if (wh.critWounds.Size() == 0) { + sb.DrawString( + sb.pSmallFont, + "No treatable wounds", + (0, woundListOffsetY), + sb.DI_SCREEN_CENTER | sb.DI_TEXT_ALIGN_CENTER, + Font.CR_GRAY, + scale: hudScale + ); + } else { + Array wounds; + int idx = (currentWound)? wh.critWounds.Find(currentWound) : 0; + int loopMin = Min(idx - 2, wh.critWounds.Size() - 5); + int loopMax = Max(idx + 2, 4); + + // Compile list + for (int i = loopMin; i <= loopMax; i++) { + if (i < 0 || i > wh.critWounds.Size() - 1) continue; + + string textColor; + if (GetAverageStatus(wh.critWounds[i]) >= 15) { + textColor = (i == idx)? "\ca" : "\cr"; // Red / Dark Red + } else { + textColor = (i == idx)? "\cd" : "\cq"; // Green / Dark Green + } + + string pointer = (i == idx)? " <" : ""; + wounds.push(textColor..wh.critWounds[i].description..pointer); + woundListOffsetY -= halfStep; + } + woundListOffsetY += halfStep; // accommodation + + // Top overflow dot + if (loopMin > 0) { + sb.DrawString( + sb.pSmallFont, + ". . .", + (woundListOffsetX, woundListOffsetY - padStep), + sb.DI_SCREEN_CENTER | sb.DI_TEXT_ALIGN_RIGHT, + Font.CR_GRAY, + scale: hudScale + ); + } + + // The actual list + for (int i = 0; i < wounds.Size(); i++) { + sb.DrawString( + sb.pSmallFont, + wounds[i], + (woundListOffsetX, woundListOffsetY), + sb.DI_SCREEN_CENTER | sb.DI_TEXT_ALIGN_RIGHT, + scale: hudScale + ); + + woundListOffsetY += padStep; + } + + // Bottom overflow dot + if (loopMax < wh.critWounds.Size() - 1) { + sb.DrawString( + sb.pSmallFont, + ". . .", + (woundListOffsetX, woundListOffsetY), + sb.DI_SCREEN_CENTER | sb.DI_TEXT_ALIGN_RIGHT, + Font.CR_GRAY, + scale: hudScale + ); + } + } + + // Wound info + if (currentWound) { + int woundInfoOffsetX = 12; + float woundInfoOffsetY = baseOffset + (3 * textHeight) + (3 * padStep); + Array status; + if (currentWound.open <= 0) { + status.Push("-The wound is "..GetStatusColor(currentWound.open).."closed\c-."); + } + else { + status.Push("-The wound is "..GetStatusColor(currentWound.open).."open"); + + string tmpStr; + + // Painkillers + tmpStr = "not numbed."; + if (currentWound.painkiller >= 75) tmpStr = "numbed"; + else if (currentWound.painkiller >= 50) tmpStr = "mostly numbed"; + else if (currentWound.painkiller >= 25) tmpStr = "somewhat numbed"; + + status.Push("-It is "..GetStatusColor(100 - currentWound.painkiller)..tmpStr); + woundInfoOffsetY -= halfStep; + + // Dirty + if (currentWound.dirty >= 0) + { + tmpStr = "completely clean"; + if (currentWound.dirty >= 65) { tmpStr = "filthy"; } + else if (currentWound.dirty >= 55) { tmpStr = "very dirty"; } + else if (currentWound.dirty >= 45) { tmpStr = "somewhat dirty"; } + else if (currentWound.dirty >= 35) { tmpStr = "a bit dirty"; } + else if (currentWound.dirty >= 25) { tmpStr = "almost clean"; } + else if (currentWound.dirty >= 15) { tmpStr = "acceptably clean"; } + + status.Push("-It is "..GetStatusColor(currentWound.dirty)..tmpStr); + woundInfoOffsetY -= halfStep; + } + + // Obstructions + if (currentWound.obstructed >= 0) + { + tmpStr = "no apparent obstructions"; + if (currentWound.obstructed >= 55) { tmpStr = "many obstructions"; } + else if (currentWound.obstructed >= 45) { tmpStr = "several obstructions"; } + else if (currentWound.obstructed >= 35) { tmpStr = "a few obstructions"; } + else if (currentWound.obstructed >= 25) { tmpStr = "some obstructions"; } + else if (currentWound.obstructed >= 15) { tmpStr = "very little obstructions"; } + + status.Push("-There are "..GetStatusColor(currentWound.obstructed)..tmpStr); + woundInfoOffsetY -= halfStep; + } + + // Cavity + if (currentWound.cavity >= 0) + { + tmpStr = "no treatable tissue damage"; + if (currentWound.cavity >= 85) { tmpStr = "severe tissue damage"; } + else if (currentWound.cavity >= 65) { tmpStr = "significant tissue damage"; } + else if (currentWound.cavity >= 45) { tmpStr = "moderate tissue damage"; } + else if (currentWound.cavity >= 25) { tmpStr = "some tissue damage"; } + else if (currentWound.cavity >= 15) { tmpStr = "little tissue damage"; } + + status.Push("-There is "..GetStatusColor(currentWound.cavity)..tmpStr); + woundInfoOffsetY -= halfStep; + } + } + + for (int i = 0; i < status.Size(); i++) + { + sb.DrawString( + sb.pSmallFont, + status[i], + (woundInfoOffsetX, woundInfoOffsetY), + sb.DI_SCREEN_CENTER | sb.DI_TEXT_ALIGN_LEFT, + Font.CR_GRAY, + scale: hudScale + ); + + woundInfoOffsetY += padStep; + } + } + + // Tool info + float toolInfoOffset = baseOffset + (4 * textHeight) + (7 * padStep); + Array trueStatusMessage; + statusMessage.Split(trueStatusMessage, "\n"); // temporary workaround + + for (int i = 0; i < trueStatusMessage.Size(); i++) { + sb.DrawString( + sb.pSmallFont, + trueStatusMessage[i], + (0, toolInfoOffset), + sb.DI_SCREEN_CENTER | sb.DI_TEXT_ALIGN_CENTER, + scale: hudScale + ); + + toolInfoOffset += textHeight; + } + } + + ui int GetAverageStatus(WoundInfo wi) { + int retvalue, counted; + if (wi.dirty >= 0) { retvalue += wi.dirty; counted++; } + if (wi.obstructed >= 0) { retvalue += wi.obstructed; counted++;} + if (wi.cavity >= 0) { retvalue += wi.cavity; counted++;} + if (wi.open >= 0) { retvalue += wi.open; counted++;} + //retvalue += infection; + retvalue /= counted; + return retvalue; + } + + ui string GetStatusColor(int amount) { + if (amount >= 90) { return "\cm"; } // Black + if (amount >= 80) { return "\cr"; } // Dark Red + if (amount >= 70) { return "\ca"; } // Brick + if (amount >= 60) { return "\cx"; } // Fire + if (amount >= 50) { return "\ci"; } // Orange + if (amount >= 40) { return "\ck"; } // Yellow + if (amount >= 30) { return "\cs"; } // Dark Brown + if (amount >= 20) { return "\cq"; } // Dark Green + if (amount >= 10) { return "\cd"; } // Green + if (amount >= 0) { return "\cd"; } // Grey (wait, isn't this green?) + return "\cj"; // White } // Somewhat copied from HD, largely rewritten @@ -142,37 +362,6 @@ class UaS_TraumaKit : HDWeapon { } } - void WoundList() { - if (wh.critwounds.size() == 0) { - statusmessage = statusmessage.."No treatable wounds\n\n"; - return; - } - int idx = 0; - if (currentWound) { - idx = wh.critwounds.Find(currentWound); - } - int loopmin = min(idx - 2, wh.critwounds.size() - 5); - int loopmax = max(idx + 2, 4); - if (loopmin > 0) { statusmessage = statusmessage..". . .\n"; } - else { statusmessage = statusmessage.."\n"; } - for (int i = loopmin; i <= loopmax; i++) { - if(i<0 || i > wh.critwounds.size()-1) { continue; } - string hilite; - if (currentWound && i == idx) { - if (currentWound.AverageStatus() >= 15) { hilite = "\ca"; } - else { hilite = "\cd"; } - } - else { - if (wh.critwounds[i].AverageStatus() >= 15) { hilite = "\cr"; } - else { hilite = "\cq"; } - } - statusmessage = statusmessage..hilite..wh.critwounds[i].description.."\n"; - } - if (loopmax < wh.critwounds.size() - 1) { statusmessage = statusmessage..". . .\n"; } - else { statusmessage = statusmessage.."\n"; } - statusmessage = statusmessage.."\n"; - } - void CycleWounds() { if (wh.critwounds.size() == 0) { return; } int idx = 0; From 9c35672eeaeefeef72a7910dbcbf71dba533bcfc Mon Sep 17 00:00:00 2001 From: dastrukar <3derid@gmail.com> Date: Thu, 30 Dec 2021 02:32:21 +0800 Subject: [PATCH 2/5] Medical: Add variable "avgstat" for WoundInfo The problem with getting the average status with a function is that you can't use the function if you're trying to use it from a UI scope. Since copying the whole function just to put a UI scope on it isn't that great of an idea, I've decided to just add a variable instead, and make the function just update the variable. --- medical/module/medical_wound.zsc | 13 +++++++------ medical/module/traumakit/traumakit.zsc | 13 +------------ 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/medical/module/medical_wound.zsc b/medical/module/medical_wound.zsc index d852eb66..6ecbea77 100644 --- a/medical/module/medical_wound.zsc +++ b/medical/module/medical_wound.zsc @@ -9,6 +9,7 @@ class WoundInfo : thinker { int size; int infection; int pain; + int avgstat; bool clear; override void PostBeginPlay() { @@ -17,6 +18,7 @@ class WoundInfo : thinker { } void TickWound() { + UpdateAverageStatus(); timer = max(timer - 1, 0); pain = max(pain - 1, 0); pain = max(pain - painkiller / 20, 0); @@ -31,7 +33,7 @@ class WoundInfo : thinker { random[uas_wi](0, 15)) / 3; // Wound heals some points - if (toHeal >= AverageStatus()) { + if (toHeal >= avgstat) { if (open > 0) { open--; } if (cavity > 0) { cavity--; } if (dirty > 0) { dirty--; } @@ -40,11 +42,11 @@ class WoundInfo : thinker { } // Infection increases - if (toHeal <= (AverageStatus() + infection)) { + if (toHeal <= (avgstat + infection)) { infection = min(infection + 1, 100); } - if (AverageStatus() == 0) { + if (avgstat == 0) { clear = true; } timer = random[uas_wi](2,5) * (35 + open); @@ -59,15 +61,14 @@ class WoundInfo : thinker { // Status methods extend class WoundInfo { - int AverageStatus() { + void UpdateAverageStatus() { int retvalue, counted; if (dirty >= 0) { retvalue += dirty; counted++; } if (obstructed >= 0) { retvalue += obstructed; counted++;} if (cavity >= 0) { retvalue += cavity; counted++;} if (open >= 0) { retvalue += open; counted++;} //retvalue += infection; - retvalue /= counted; - return retvalue; + avgstat = retvalue / counted; } string WoundStatus () { diff --git a/medical/module/traumakit/traumakit.zsc b/medical/module/traumakit/traumakit.zsc index a647f522..53030562 100644 --- a/medical/module/traumakit/traumakit.zsc +++ b/medical/module/traumakit/traumakit.zsc @@ -135,7 +135,7 @@ class UaS_TraumaKit : HDWeapon { if (i < 0 || i > wh.critWounds.Size() - 1) continue; string textColor; - if (GetAverageStatus(wh.critWounds[i]) >= 15) { + if (wh.critWounds[i].avgstat >= 15) { textColor = (i == idx)? "\ca" : "\cr"; // Red / Dark Red } else { textColor = (i == idx)? "\cd" : "\cq"; // Green / Dark Green @@ -284,17 +284,6 @@ class UaS_TraumaKit : HDWeapon { } } - ui int GetAverageStatus(WoundInfo wi) { - int retvalue, counted; - if (wi.dirty >= 0) { retvalue += wi.dirty; counted++; } - if (wi.obstructed >= 0) { retvalue += wi.obstructed; counted++;} - if (wi.cavity >= 0) { retvalue += wi.cavity; counted++;} - if (wi.open >= 0) { retvalue += wi.open; counted++;} - //retvalue += infection; - retvalue /= counted; - return retvalue; - } - ui string GetStatusColor(int amount) { if (amount >= 90) { return "\cm"; } // Black if (amount >= 80) { return "\cr"; } // Dark Red From 64317eb1cfbfd982fde76a69d315de24fde1665d Mon Sep 17 00:00:00 2001 From: dastrukar <3derid@gmail.com> Date: Thu, 30 Dec 2021 03:02:08 +0800 Subject: [PATCH 3/5] Medical: Clean up Removed hudScale mainly because it doesn't really work that well. WoundStatus and other status text related functions were removed because the status text stuff is already handled in DrawHUDStuff. --- medical/module/medical_wound.zsc | 63 -------------------------- medical/module/traumakit/traumakit.zsc | 35 ++++++-------- 2 files changed, 13 insertions(+), 85 deletions(-) diff --git a/medical/module/medical_wound.zsc b/medical/module/medical_wound.zsc index 6ecbea77..4c794fd8 100644 --- a/medical/module/medical_wound.zsc +++ b/medical/module/medical_wound.zsc @@ -70,69 +70,6 @@ extend class WoundInfo { //retvalue += infection; avgstat = retvalue / counted; } - - string WoundStatus () { - string status; - if (open <= 0) { status = "The wound is "..statuscolor(open).."closed\c-,\nand cannot be treated further.\n"; return status; } - else { status = "The wound is "..statuscolor(open).."open\c-\n"; } - - status = status..numbstatus()..dirtystatus()..obstructstatus()..cavitystatus(); - - return status; - } - - string numbstatus() { - - if (painkiller >= 75) { return "It is "..statuscolor(100-painkiller).."numbed\c-\n"; } - if (painkiller >= 50) { return "It is "..statuscolor(100-painkiller).."mostly numbed\c-\n"; } - if (painkiller >= 25) { return "It is "..statuscolor(100-painkiller).."somewhat numbed\c-\n"; } - return "It is "..statuscolor(100-painkiller).."not numbed.\n"; - } - - string dirtystatus() { - if (dirty < 0) { return ""; } - if (dirty >= 65) { return "It is "..statuscolor(dirty).."filthy\n"; } - if (dirty >= 55) { return "It is "..statuscolor(dirty).."very dirty\n"; } - if (dirty >= 45) { return "It is "..statuscolor(dirty).."somewhat dirty\n"; } - if (dirty >= 35) { return "It is "..statuscolor(dirty).."a bit dirty\n"; } - if (dirty >= 25) { return "It is "..statuscolor(dirty).."almost clean\n"; } - if (dirty >= 15) { return "It is "..statuscolor(dirty).."acceptably clean\n"; } - return "It is "..statuscolor(dirty).."completely clean\n"; - } - - string obstructstatus() { - if (obstructed < 0) { return ""; } - if (obstructed >= 55) { return "There are "..statuscolor(obstructed).."many obstructions\n"; } - if (obstructed >= 45) { return "There are "..statuscolor(obstructed).."several obstructions\n"; } - if (obstructed >= 35) { return "There are "..statuscolor(obstructed).."a few obstructions\n"; } - if (obstructed >= 25) { return "There are "..statuscolor(obstructed).."some obstructions\n"; } - if (obstructed >= 15) { return "It appears "..statuscolor(obstructed).."mostly free of obstructions\n"; } - return "There are "..statuscolor(obstructed).."no apparent obstructions\n"; - } - - string cavitystatus() { - if (cavity < 0) { return ""; } - if (cavity >= 85) { return "There is "..statuscolor(cavity).."severe tissue damage\n"; } - if (cavity >= 65) { return "There is "..statuscolor(cavity).."significant tissue damage\n"; } - if (cavity >= 45) { return "There is "..statuscolor(cavity).."moderate tissue damage\n"; } - if (cavity >= 25) { return "There is "..statuscolor(cavity).."some tissue damage\n"; } - if (cavity >= 15) { return "There is "..statuscolor(cavity).."little tissue damage\n"; } - return "There is "..statuscolor(cavity).."no treatable tissue damage\n"; - } - - string statuscolor(int amount) { - if (amount >= 90) { return "\cm"; } // black - else if (amount >= 80) { return "\cr"; } // dark red - else if (amount >= 70) { return "\ca"; } // brick - else if (amount >= 60) { return "\cx"; } // fire - else if (amount >= 50) { return "\ci"; } // orange - else if (amount >= 40) { return "\ck"; } // yellow - else if (amount >= 30) { return "\cs"; } // dark brown - else if (amount >= 20) { return "\cq"; } // dark green - else if (amount >= 10) { return "\cd"; } // green - else if (amount >= 0) { return "\cd"; } // grey - return "\cj"; // white - } } // Static methods diff --git a/medical/module/traumakit/traumakit.zsc b/medical/module/traumakit/traumakit.zsc index 53030562..166f951b 100644 --- a/medical/module/traumakit/traumakit.zsc +++ b/medical/module/traumakit/traumakit.zsc @@ -85,13 +85,11 @@ class UaS_TraumaKit : HDWeapon { override void DrawHUDStuff(HDStatusBar sb, HDWeapon hdw, HDPlayerPawn hpl) { if (!patient) return; // Floats for precision (also required for centering) - int notuas_hudscale = 1; //temp - float textHeight = sb.pSmallFont.mFont.GetHeight() * notuas_hudscale; - float padding = 2 * notuas_hudscale; + float textHeight = sb.pSmallFont.mFont.GetHeight(); + float padding = 2; float padStep = textHeight + padding; float halfStep = padStep / 2; - float baseOffset = (-7 * textHeight) + (-3 * padding); - Vector2 hudScale = (notuas_hudscale, notuas_hudscale); + float baseOffset = (-7 * textHeight) + (-3 * padding); // Start calculating from center of screen? // Header sb.DrawString( @@ -99,16 +97,14 @@ class UaS_TraumaKit : HDWeapon { "--- \cyTrauma Kit\c- ---", (0, baseOffset), sb.DI_SCREEN_CENTER | sb.DI_TEXT_ALIGN_CENTER, - Font.CR_GRAY, - scale: hudScale + Font.CR_GRAY ); sb.DrawString( sb.pSmallFont, "Treating \cg" .. patient.player.GetUsername(), (0, baseOffset + textHeight), sb.DI_SCREEN_CENTER | sb.DI_TEXT_ALIGN_CENTER, - Font.CR_GRAY, - scale: hudScale + Font.CR_GRAY ); // Wound List @@ -121,8 +117,7 @@ class UaS_TraumaKit : HDWeapon { "No treatable wounds", (0, woundListOffsetY), sb.DI_SCREEN_CENTER | sb.DI_TEXT_ALIGN_CENTER, - Font.CR_GRAY, - scale: hudScale + Font.CR_GRAY ); } else { Array wounds; @@ -154,8 +149,7 @@ class UaS_TraumaKit : HDWeapon { ". . .", (woundListOffsetX, woundListOffsetY - padStep), sb.DI_SCREEN_CENTER | sb.DI_TEXT_ALIGN_RIGHT, - Font.CR_GRAY, - scale: hudScale + Font.CR_GRAY ); } @@ -165,8 +159,7 @@ class UaS_TraumaKit : HDWeapon { sb.pSmallFont, wounds[i], (woundListOffsetX, woundListOffsetY), - sb.DI_SCREEN_CENTER | sb.DI_TEXT_ALIGN_RIGHT, - scale: hudScale + sb.DI_SCREEN_CENTER | sb.DI_TEXT_ALIGN_RIGHT ); woundListOffsetY += padStep; @@ -179,8 +172,7 @@ class UaS_TraumaKit : HDWeapon { ". . .", (woundListOffsetX, woundListOffsetY), sb.DI_SCREEN_CENTER | sb.DI_TEXT_ALIGN_RIGHT, - Font.CR_GRAY, - scale: hudScale + Font.CR_GRAY ); } } @@ -190,6 +182,7 @@ class UaS_TraumaKit : HDWeapon { int woundInfoOffsetX = 12; float woundInfoOffsetY = baseOffset + (3 * textHeight) + (3 * padStep); Array status; + if (currentWound.open <= 0) { status.Push("-The wound is "..GetStatusColor(currentWound.open).."closed\c-."); } @@ -258,8 +251,7 @@ class UaS_TraumaKit : HDWeapon { status[i], (woundInfoOffsetX, woundInfoOffsetY), sb.DI_SCREEN_CENTER | sb.DI_TEXT_ALIGN_LEFT, - Font.CR_GRAY, - scale: hudScale + Font.CR_GRAY ); woundInfoOffsetY += padStep; @@ -269,15 +261,14 @@ class UaS_TraumaKit : HDWeapon { // Tool info float toolInfoOffset = baseOffset + (4 * textHeight) + (7 * padStep); Array trueStatusMessage; - statusMessage.Split(trueStatusMessage, "\n"); // temporary workaround + statusMessage.Split(trueStatusMessage, "\n"); // it just works for (int i = 0; i < trueStatusMessage.Size(); i++) { sb.DrawString( sb.pSmallFont, trueStatusMessage[i], (0, toolInfoOffset), - sb.DI_SCREEN_CENTER | sb.DI_TEXT_ALIGN_CENTER, - scale: hudScale + sb.DI_SCREEN_CENTER | sb.DI_TEXT_ALIGN_CENTER ); toolInfoOffset += textHeight; From 8f2328f4e3e506288501901cccc4cc9f64389e6f Mon Sep 17 00:00:00 2001 From: dastrukar <3derid@gmail.com> Date: Thu, 30 Dec 2021 08:58:23 +0800 Subject: [PATCH 4/5] Medical: Notify if no wounds are selected --- medical/module/traumakit/traumakit.zsc | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/medical/module/traumakit/traumakit.zsc b/medical/module/traumakit/traumakit.zsc index 166f951b..cad04721 100644 --- a/medical/module/traumakit/traumakit.zsc +++ b/medical/module/traumakit/traumakit.zsc @@ -130,13 +130,14 @@ class UaS_TraumaKit : HDWeapon { if (i < 0 || i > wh.critWounds.Size() - 1) continue; string textColor; + bool selected = (currentWound && i == idx); if (wh.critWounds[i].avgstat >= 15) { - textColor = (i == idx)? "\ca" : "\cr"; // Red / Dark Red + textColor = (selected)? "\ca" : "\cr"; // Red / Dark Red } else { - textColor = (i == idx)? "\cd" : "\cq"; // Green / Dark Green + textColor = (selected)? "\cd" : "\cq"; // Green / Dark Green } - string pointer = (i == idx)? " <" : ""; + string pointer = (selected)? " <" : ""; wounds.push(textColor..wh.critWounds[i].description..pointer); woundListOffsetY -= halfStep; } @@ -178,9 +179,9 @@ class UaS_TraumaKit : HDWeapon { } // Wound info + int woundInfoOffsetX = 12; + float woundInfoOffsetY = baseOffset + (3 * textHeight) + (3 * padStep); if (currentWound) { - int woundInfoOffsetX = 12; - float woundInfoOffsetY = baseOffset + (3 * textHeight) + (3 * padStep); Array status; if (currentWound.open <= 0) { @@ -256,6 +257,14 @@ class UaS_TraumaKit : HDWeapon { woundInfoOffsetY += padStep; } + } else { + sb.DrawString( + sb.pSmallFont, + "-No wounds selected-", + (woundInfoOffsetX, woundInfoOffsetY), + sb.DI_SCREEN_CENTER | sb.DI_TEXT_ALIGN_LEFT, + Font.CR_DARKGRAY + ); } // Tool info From ae5123f07d63d8d521a123346a5138504d9035f1 Mon Sep 17 00:00:00 2001 From: dastrukar <3derid@gmail.com> Date: Thu, 30 Dec 2021 09:15:41 +0800 Subject: [PATCH 5/5] Medical: formatting --- medical/module/traumakit/traumakit.zsc | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/medical/module/traumakit/traumakit.zsc b/medical/module/traumakit/traumakit.zsc index cad04721..e4beeba3 100644 --- a/medical/module/traumakit/traumakit.zsc +++ b/medical/module/traumakit/traumakit.zsc @@ -202,8 +202,7 @@ class UaS_TraumaKit : HDWeapon { woundInfoOffsetY -= halfStep; // Dirty - if (currentWound.dirty >= 0) - { + if (currentWound.dirty >= 0) { tmpStr = "completely clean"; if (currentWound.dirty >= 65) { tmpStr = "filthy"; } else if (currentWound.dirty >= 55) { tmpStr = "very dirty"; } @@ -217,8 +216,7 @@ class UaS_TraumaKit : HDWeapon { } // Obstructions - if (currentWound.obstructed >= 0) - { + if (currentWound.obstructed >= 0) { tmpStr = "no apparent obstructions"; if (currentWound.obstructed >= 55) { tmpStr = "many obstructions"; } else if (currentWound.obstructed >= 45) { tmpStr = "several obstructions"; } @@ -231,8 +229,7 @@ class UaS_TraumaKit : HDWeapon { } // Cavity - if (currentWound.cavity >= 0) - { + if (currentWound.cavity >= 0) { tmpStr = "no treatable tissue damage"; if (currentWound.cavity >= 85) { tmpStr = "severe tissue damage"; } else if (currentWound.cavity >= 65) { tmpStr = "significant tissue damage"; } @@ -245,8 +242,7 @@ class UaS_TraumaKit : HDWeapon { } } - for (int i = 0; i < status.Size(); i++) - { + for (int i = 0; i < status.Size(); i++) { sb.DrawString( sb.pSmallFont, status[i],