Files
Bubberstation/code/game/objects/items_reskin.dm
necromanceranne b72368fd03 #87754: Batons have their stamina damage reduced by armor, get stun armor penetration, but not a test and actually intended to be merged (#88830)
## About The Pull Request

This PR is literally just
https://github.com/tgstation/tgstation/pull/87754 so you should probably
go read the contents of that PR to learn more.

### Sorry, No Stunsword in this PR.

Stunbaton inhand tips change color as the cell it has inside increases
in capacity. They also have different animations based on the cell, to
make it clearer which one you are looking at.


![image](https://github.com/user-attachments/assets/95be1499-47b7-4991-a3c1-03833f329d7f)

## Why It's Good For The Game

So, two things;

A) The test showed that there is more work to be done, but that this was
actually improving survivability to some degree against batons when
properly geared, while not necessarily impacting the average tider
arrest attempts. It didn't solve the issue of alleviating the need for
anti-baton knockdown tools, but it did help a bit. Enough that I think
this could be worked on further as a foundation for solving that
problem.

B) People have been asking me to, or have made it obvious that they
would like to see this actually merged into the game. So uh...here is
that PR if any maints care for it.

I think there is still more to do for testing and possible changes to
address the issues I was trying to investigate in the test. However, I
actually think this change could be an important step towards
accomplishing some of those changes. It isn't quite enough to start
pulling out baton resistance from various sources just yet, but it is a
start.

## Changelog
🆑 
balance: Batons now respect the armor worn by targets. Analog batons
respect MELEE armor. Cell-type batons respect ENERGY armor.
balance: Various batons have differing amounts of armour penetration
based on what type of baton it is.
balance: Heads of staff have color graded batons to denote penetration
power. Bronze (Quartermaster), Silver (Chief Engineer, Chief Medical
Officer, Head of Personnel, Research Director), Gold (Captain).
Contractor batons are equivalent to Gold.
balance: Cell-type batons gain armor penetration based on their cell's
quality. The better it is, the more it penetrates.
/🆑

---------

Co-authored-by: SmArtKar <44720187+SmArtKar@users.noreply.github.com>
2025-01-21 18:17:23 -05:00

96 lines
2.3 KiB
Plaintext

/// Called when alt clicked and the item has unique reskin options
/obj/item/proc/on_click_alt_reskin(datum/source, mob/user)
SIGNAL_HANDLER
if(!user.can_perform_action(src, NEED_DEXTERITY))
return NONE
if(!(obj_flags & INFINITE_RESKIN) && current_skin)
return NONE
INVOKE_ASYNC(src, PROC_REF(reskin_obj), user)
return CLICK_ACTION_SUCCESS
/**
* Checks if we should set up reskinning,
* by default if unique_reskin is set.
*
* Called on setup_reskinning().
* Inheritors should override this to add their own checks.
*/
/obj/item/proc/check_setup_reskinning()
SHOULD_CALL_PARENT(TRUE)
if(unique_reskin)
return TRUE
return FALSE
/**
* Registers signals and context for reskinning,
* if check_setup_reskinning() passes.
*
* Called on Initialize(...).
* Inheritors should override this to add their own setup steps,
* or to avoid double calling register_context().
*/
/obj/item/proc/setup_reskinning()
SHOULD_CALL_PARENT(FALSE)
if(!check_setup_reskinning())
return
RegisterSignal(src, COMSIG_CLICK_ALT, PROC_REF(on_click_alt_reskin))
register_context()
/**
* Reskins object based on a user's choice
*
* Arguments:
* * user The mob choosing a reskin option
*/
/obj/item/proc/reskin_obj(mob/user)
if(!LAZYLEN(unique_reskin))
return
var/list/items = list()
for(var/reskin_option in unique_reskin)
var/image/item_image = image(icon = src.icon, icon_state = unique_reskin[reskin_option])
items += list("[reskin_option]" = item_image)
sort_list(items)
var/pick = show_radial_menu(user, src, items, custom_check = CALLBACK(src, PROC_REF(check_reskin_menu), user), radius = 38, require_near = TRUE)
if(!pick)
return
if(!unique_reskin[pick])
return
current_skin = pick
icon_state = unique_reskin[pick]
if (unique_reskin_changes_base_icon_state)
base_icon_state = icon_state
if (unique_reskin_changes_inhand)
inhand_icon_state = icon_state
update_appearance()
to_chat(user, "[src] is now skinned as '[pick].'")
SEND_SIGNAL(src, COMSIG_OBJ_RESKIN, user, pick)
/**
* Checks if we are allowed to interact with a radial menu for reskins
*
* Arguments:
* * user The mob interacting with the menu
*/
/obj/item/proc/check_reskin_menu(mob/user)
if(QDELETED(src))
return FALSE
if(!(obj_flags & INFINITE_RESKIN) && current_skin)
return FALSE
if(!istype(user))
return FALSE
if(user.incapacitated)
return FALSE
return TRUE