-
-
Notifications
You must be signed in to change notification settings - Fork 681
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplified bodyzone targeting preference #9845
Merged
itsmeow
merged 36 commits into
BeeStation:master
from
PowerfulBacon:Patch-application-improvements
Dec 19, 2023
Merged
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
09630f6
Zone selector for patches
PowerfulBacon d27e1f1
Preference
PowerfulBacon 56c8f38
Merge remote-tracking branch 'upstream/master' into Patch-application…
PowerfulBacon 4835b01
Adds in a generic bodyzone part getter
PowerfulBacon b919f8f
Combat zone targetting
PowerfulBacon 93c678a
Update mob_helpers.dm
PowerfulBacon 944ec8f
Fixes some mistakes
PowerfulBacon cd80d29
Bug fixes, makes the task not have a delay
PowerfulBacon 4155f7f
Makes the bodyzone wheel represent the positions of the limb
PowerfulBacon 7df3c03
Mechanical repair interaction
PowerfulBacon 95ce577
Adds in the flashlight interaction
PowerfulBacon 3470c60
Hotkeys can now be hidden based on the values of preferences
PowerfulBacon d9810c7
Scroll hotkey for cycling the selected area
PowerfulBacon 050453d
Surgery, cleans up the priority code and spelling mistake correction
PowerfulBacon 534a06d
Update mob_helpers.dm
PowerfulBacon 96f3e98
Fixes the logic in the technophile cult
PowerfulBacon a2cdb69
Voodoo Doll
PowerfulBacon b1f9afe
Update code/__DEFINES/preferences.dm
PowerfulBacon 7decb58
Review addresses
PowerfulBacon e1113ed
Adjacency checks
PowerfulBacon 91a2bf6
Merge branch 'Patch-application-improvements' of https://github.com/P…
PowerfulBacon 8f1fcc7
Changes the dropdown to buttons
PowerfulBacon 75d0e1b
Fix
PowerfulBacon 633a43f
Named parameter arguments
PowerfulBacon 3b557dd
Changes the required preference to a typepath
PowerfulBacon f8c4f00
Update _basemap.dm
PowerfulBacon 4dc5cef
Fixes wrong variable name
PowerfulBacon 6e2c126
You now have to be adjacent to medical items to use them as well as t…
PowerfulBacon e3d1f1c
You can't select a bodyzone to heal while healing
PowerfulBacon 0e04251
Removes the ERP message when using simplified zone targeting since it…
PowerfulBacon 430b982
Merge remote-tracking branch 'upstream/master' into Patch-application…
PowerfulBacon 477bd33
Fixes holoparasite missing parameters
PowerfulBacon 8fcf8d0
Merge branch 'master' into Patch-application-improvements
PowerfulBacon c0785af
Makes it so that mechanical repairs repeat
PowerfulBacon bcacdae
Fixes some linter catches
PowerfulBacon d1ba39b
Fixes surgery on groin being impossible
PowerfulBacon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,8 @@ | ||
#define IS_ORGANIC_LIMB(A) (A.bodytype & BODYTYPE_ORGANIC) | ||
|
||
#define BODYZONE_STYLE_DEFAULT 0 | ||
#define BODYZONE_STYLE_MEDICAL 1 | ||
|
||
#define BODYZONE_CONTEXT_COMBAT 0 | ||
#define BODYZONE_CONTEXT_INJECTION 1 | ||
#define BODYZONE_CONTEXT_ROBOTIC_LIMB_HEALING 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
|
||
#define NOT_PRESENT_COLOUR "#0d0d0d" | ||
#define FULL_HEALTH_COLOUR "#11ff00" | ||
#define LOW_DAMAGE_COLOUR "#d9ff00" | ||
#define POOR_HEALTH_COLOUR "#ff0000" | ||
|
||
/// Displays a UI around the target allowing the user to select which bodypart | ||
/// that they want to act on. | ||
/// Target: The location to show the user interface. | ||
/// Precise: Toggle to include groin, eyes and mouth. If true, implies hide_non_present will be forced to false. | ||
/// Icon Callback: The callback to run in order to get the selection zone overlay. | ||
/// If you want to wait for the result use: AWAIT(select_bodyzone(target)) | ||
/mob/proc/select_bodyzone_from_wheel(atom/target, precise = FALSE, datum/callback/icon_callback, override_zones = null) | ||
DECLARE_ASYNC | ||
if (!client || !client.prefs) | ||
ASYNC_RETURN(null) | ||
if (!icon_callback) | ||
icon_callback = CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(select_bodyzone_limb_default)) | ||
// Determine what parts we want to show | ||
var/list/bodyzone_options = list() | ||
var/list/parts = list(BODY_ZONE_HEAD, BODY_ZONE_L_ARM, BODY_ZONE_L_LEG, BODY_ZONE_CHEST, BODY_ZONE_R_LEG, BODY_ZONE_R_ARM) | ||
if (override_zones) | ||
parts = override_zones | ||
for (var/bodyzone in parts) | ||
var/image/created_image = image(icon = ui_style2icon(client.prefs?.read_player_preference(/datum/preference/choiced/ui_style)), icon_state = "zone_sel") | ||
var/selection_overlay = icon_callback.Invoke(src, target, bodyzone, FALSE) | ||
created_image.overlays += selection_overlay | ||
bodyzone_options[bodyzone] = created_image | ||
var/result = show_radial_menu(src, target, bodyzone_options, radius = 40, require_near = TRUE, tooltips = TRUE) | ||
|
||
// Disconnected or no result | ||
if (!result || !client) | ||
ASYNC_RETURN(null) | ||
|
||
// Let the user choose more zones | ||
var/list/suboptions = null | ||
if (precise && result == BODY_ZONE_HEAD) | ||
suboptions = list(BODY_ZONE_HEAD, BODY_ZONE_PRECISE_EYES, BODY_ZONE_PRECISE_MOUTH) | ||
else if (precise && result == BODY_ZONE_CHEST) | ||
suboptions = list(BODY_ZONE_CHEST, BODY_ZONE_PRECISE_GROIN) | ||
|
||
if (suboptions) | ||
bodyzone_options = list() | ||
for (var/bodyzone in suboptions) | ||
var/image/created_image = image(icon = ui_style2icon(client.prefs?.read_player_preference(/datum/preference/choiced/ui_style)), icon_state = "zone_sel") | ||
var/selection_overlay = icon_callback.Invoke(src, target, bodyzone, !(bodyzone in parts)) | ||
created_image.overlays += selection_overlay | ||
bodyzone_options[bodyzone] = created_image | ||
result = show_radial_menu(src, target, bodyzone_options, radius = 40, require_near = TRUE, tooltips = TRUE) | ||
|
||
// Disconnected or no result | ||
if (!result || !client) | ||
ASYNC_RETURN(null) | ||
if (!(result in parts) && !(result in suboptions)) | ||
ASYNC_RETURN(null) | ||
ASYNC_RETURN(result) | ||
|
||
/proc/select_bodyzone_limb_default( mob/user, atom/target, bodyzone, is_precise_part = FALSE) | ||
// Create the overlay | ||
var/image/selection_overlay = image(icon = 'icons/mob/zone_sel.dmi', icon_state = bodyzone) | ||
return selection_overlay | ||
|
||
/proc/select_bodyzone_limb_health(accurate_health = FALSE, mob/user, atom/target, bodyzone, is_precise_part = FALSE) | ||
// Get the colours | ||
var/list/healthy = rgb2num(FULL_HEALTH_COLOUR) | ||
var/list/damaged = rgb2num(LOW_DAMAGE_COLOUR) | ||
var/list/unhealthy = rgb2num(POOR_HEALTH_COLOUR) | ||
var/list/not_present = rgb2num(NOT_PRESENT_COLOUR) | ||
// Create the overlay | ||
var/image/selection_overlay = image(icon = 'icons/mob/zone_sel.dmi', icon_state = bodyzone) | ||
// If the target is a mob, then colour the parts according to the part's health | ||
if (isliving(target)) | ||
var/mob/living/living_target = target | ||
var/obj/item/bodypart/target_part = living_target.get_bodypart(bodyzone) | ||
// Determine what colour to make the indicator | ||
var/list/new_colour | ||
var/flash = FALSE | ||
if (!target_part) | ||
if (is_precise_part) | ||
new_colour = healthy | ||
else | ||
new_colour = not_present | ||
else | ||
// 0 = healthy, 1 = dead | ||
var/proportion = target_part.get_damage() / target_part.max_damage | ||
if (!accurate_health) | ||
proportion = proportion > 0 ? max(round(proportion, 1), 0.05) : 0 | ||
else | ||
if (target_part.burn_dam > 0) | ||
var/image/dam_indicator = image(icon = 'icons/mob/zone_dam.dmi', icon_state = "burn") | ||
dam_indicator.appearance_flags = RESET_COLOR | RESET_ALPHA | ||
selection_overlay.overlays += dam_indicator | ||
if (target_part.brute_dam > 0) | ||
var/image/dam_indicator = image(icon = 'icons/mob/zone_dam.dmi', icon_state = "brute") | ||
dam_indicator.appearance_flags = RESET_COLOR | RESET_ALPHA | ||
selection_overlay.overlays += dam_indicator | ||
if (proportion > 0) | ||
new_colour = list( | ||
proportion * unhealthy[1] + (1 - proportion) * damaged[1], | ||
proportion * unhealthy[2] + (1 - proportion) * damaged[2], | ||
proportion * unhealthy[3] + (1 - proportion) * damaged[3], | ||
) | ||
else | ||
new_colour = healthy | ||
flash = proportion >= 0.01 | ||
// Set the colour | ||
selection_overlay.color = list( | ||
new_colour[1] / 255, | ||
new_colour[2] / 255, | ||
new_colour[3] / 255, | ||
0, | ||
0, 1, 0, 0, | ||
0, 0, 1, 0, | ||
0, 0, 0, 1, | ||
) | ||
if (flash) | ||
animate(selection_overlay, time = 1 SECONDS, loop = -1, easing = SINE_EASING, color = list( | ||
new_colour[1] / 255, | ||
new_colour[2] / 255, | ||
new_colour[3] / 255, | ||
0, | ||
0, 1, 0, 0, | ||
0, 0, 1, 0, | ||
0, 0, 0, 2, | ||
)) | ||
animate(time = 1 SECONDS, loop = -1, easing = SINE_EASING, color = list( | ||
new_colour[1] / 255, | ||
new_colour[2] / 255, | ||
new_colour[3] / 255, | ||
0, | ||
0, 1, 0, 0, | ||
0, 0, 1, 0, | ||
0, 0, 0, 1, | ||
)) | ||
return selection_overlay | ||
|
||
/mob/proc/_is_holding(obj/item/item) | ||
return get_active_held_item() == item | ||
|
||
#undef NOT_PRESENT_COLOUR | ||
#undef FULL_HEALTH_COLOUR | ||
#undef POOR_HEALTH_COLOUR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you define something only to immediately rgb2num it why not define it in the correct format
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well the VS code plugin I have doesn't handle the byond specific list() format of colours compared to RGB colours, so it makes it a lot easier to see what colours have been defined.
Compared to
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need it in list() format? BYOND supports hex colors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am generating a colour matrix from it because the target icon is red instead of white
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change it to whiteee