Skip to content

Commit

Permalink
Boxing+ (tgstation#10008)
Browse files Browse the repository at this point in the history
* theft

* I like punching my own team

* Simplemobs have a stamina of 0, so ups required stamina to 10

* adds ishuman(), i can banish this if needed

* Adds heldgloves & boxing glove subtype for them

* oops

* oops 2

* oops 3

* spriteadd #1, steals tg punching bag which should be okay to do

* corporate issues fix

* review compliance, 1line changes

* touching up remove_gloves, not sure if I need to add QDEL_NULL to destroy() as well?

* final review compliance: adds rightglove/rightglove_path as suggested in review (I think), adds NODROP toggle on create_gloves

* adds clear-up QDEL_NULL on parent glove destroy

* i accidentally added a fucking-around map, removes it

* autodoc + nodrop compliance

* disable/enable bitfield

* fix: both hands receive gloves again, OR only checks until it finds a true condition

* adds KO

* OOPS

* actually adds sprites for different coloured boxing gloves

* early returns

* Apply suggestions from code review

Co-authored-by: BraveMole <bsouchu@gmail.com>

* Update code/modules/clothing/gloves/miscellaneous.dm

Co-authored-by: TiviPlus <57223640+TiviPlus@users.noreply.github.com>

Co-authored-by: BraveMole <bsouchu@gmail.com>
Co-authored-by: TiviPlus <57223640+TiviPlus@users.noreply.github.com>
  • Loading branch information
3 people authored Apr 28, 2022
1 parent 9355e81 commit f0f43d0
Show file tree
Hide file tree
Showing 6 changed files with 149 additions and 9 deletions.
2 changes: 2 additions & 0 deletions code/_onclick/item_attack.dm
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@
if(BURN)
if(apply_damage(power, BURN, user.zone_selected, get_soft_armor("fire", user.zone_selected)))
attack_message_local = "[attack_message_local] It burns!"
if(STAMINA)
apply_damage(power, STAMINA, user.zone_selected)

visible_message(span_danger("[attack_message]"),
span_userdanger("[attack_message_local]"), null, COMBAT_MESSAGE_RANGE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@

/obj/structure/closet/boxinggloves/Initialize()
. = ..()
new /obj/item/clothing/gloves/boxing/blue(src)
new /obj/item/clothing/gloves/boxing/green(src)
new /obj/item/clothing/gloves/boxing/yellow(src)
new /obj/item/clothing/gloves/boxing(src)
new /obj/item/clothing/gloves/heldgloves/boxing/blue(src)
new /obj/item/clothing/gloves/heldgloves/boxing/green(src)
new /obj/item/clothing/gloves/heldgloves/boxing/yellow(src)
new /obj/item/clothing/gloves/heldgloves/boxing(src)


/obj/structure/closet/masks
Expand Down
148 changes: 143 additions & 5 deletions code/modules/clothing/gloves/miscellaneous.dm
Original file line number Diff line number Diff line change
Expand Up @@ -69,31 +69,169 @@
permeability_coefficient = 0.9
siemens_coefficient = 0.9

//Special type of gloves. Alt click and you get some special nodrop gloves
/obj/item/clothing/gloves/heldgloves
name = "gloves"
/// What type of glove we use for the right hand
var/rightglove_path
/// What type of glove we use for the left hand
var/leftglove_path
/// The glove we're currently using in the right hand
var/obj/item/weapon/heldglove/rightglove
/// The glove we're currently using in the left hand
var/obj/item/weapon/heldglove/leftglove

/obj/item/clothing/gloves/heldgloves/Destroy()
QDEL_NULL(rightglove)
QDEL_NULL(leftglove)
return ..()

/obj/item/clothing/gloves/heldgloves/examine(mob/user)
. = ..()
. += "Alt-click the gloves when worn to strap them into your hands."

/obj/item/clothing/gloves/heldgloves/unequipped(mob/unequipper, slot)
. = ..()
remove_gloves(unequipper)
DISABLE_BITFIELD(flags_item, NODROP)

//We use alt-click to activate/deactive the gloves in-hand
/obj/item/clothing/gloves/heldgloves/AltClick(mob/user)
var/mob/living/carbon/human/wearer = user
if(wearer.gloves != src) //We have to be wearing the gloves first
return

if(remove_gloves(user))
DISABLE_BITFIELD(flags_item, NODROP)
return

/obj/item/clothing/gloves/boxing
user.drop_all_held_items() //Gloves require free hands
if(create_gloves(user))
ENABLE_BITFIELD(flags_item, NODROP) //Make sure the gloves aren't able to be taken off

/// Creates the held items for user and puts it in their hand
/obj/item/clothing/gloves/heldgloves/proc/create_gloves(mob/user)
if(user.l_hand || user.r_hand)
return FALSE

rightglove = new rightglove_path()
leftglove = new leftglove_path()

if(user.put_in_r_hand(rightglove, TRUE) && user.put_in_l_hand(leftglove, TRUE))
return TRUE

/// Removes gloves. Returns false if gloves are not currently worn
/obj/item/clothing/gloves/heldgloves/proc/remove_gloves(mob/user)
var/removed = FALSE
if(leftglove)
QDEL_NULL(leftglove)
removed = TRUE
if(rightglove)
QDEL_NULL(rightglove)
removed = TRUE
return removed

/obj/item/weapon/heldglove
name = "glove"
flags_item = NODROP

//Boxing gloves
/obj/item/clothing/gloves/heldgloves/boxing
name = "boxing gloves"
desc = "Because you really needed another excuse to punch your crewmates."
icon = 'icons/obj/clothing/boxing.dmi'
icon_state = "boxing"
item_state = "boxing"
rightglove_path = /obj/item/weapon/heldglove/boxing/hook
leftglove_path = /obj/item/weapon/heldglove/boxing/jab

/obj/item/clothing/gloves/boxing/attackby(obj/item/I, mob/user, params)
/obj/item/clothing/gloves/heldgloves/boxing/attackby(obj/item/I, mob/user, params)
if(iswirecutter(I) || istype(I, /obj/item/tool/surgery/scalpel))
to_chat(user, span_notice("That won't work."))
return
return ..()

/obj/item/clothing/gloves/boxing/green

/obj/item/weapon/heldglove/boxing
name = "boxing glove"
desc = "Because you really needed another excuse to punch your crewmates."
icon = 'icons/obj/clothing/boxing.dmi'
icon_state = "boxing"
item_state = "boxing"
damtype = STAMINA
force = 10
w_class = WEIGHT_CLASS_BULKY
hitsound = "punch"

/obj/item/weapon/heldglove/boxing/attack(mob/living/M, mob/living/user)
. = ..()
if(!ishuman(M))
return

var/mob/living/carbon/human/target = M
if(!(target.getStaminaLoss() > 10 && (target.stat != UNCONSCIOUS)))
return

playsound(loc, 'sound/effects/knockout.ogg', 25, FALSE)
target.balloon_alert_to_viewers("[target] collapses to the ground in exhaustion! K.O!", "You give up and collapse! K.O!")
target.Sleeping(10 SECONDS)

/obj/item/weapon/heldglove/boxing/hook
icon_state = "boxing_p"
attack_verb = list("punched")

/obj/item/weapon/heldglove/boxing/jab
icon_state = "boxing_j"
attack_verb = list("jabbed")


/obj/item/clothing/gloves/heldgloves/boxing/green
icon_state = "boxinggreen"
item_state = "boxinggreen"
rightglove_path = /obj/item/weapon/heldglove/boxing/hook/green
leftglove_path = /obj/item/weapon/heldglove/boxing/jab/green

/obj/item/weapon/heldglove/boxing/hook/green
icon_state = "boxing_p_g"

/obj/item/weapon/heldglove/boxing/jab/green
icon_state = "boxing_j_g"

/obj/item/clothing/gloves/boxing/blue
/obj/item/clothing/gloves/heldgloves/boxing/blue
icon_state = "boxingblue"
item_state = "boxingblue"
rightglove_path = /obj/item/weapon/heldglove/boxing/hook/blue
leftglove_path = /obj/item/weapon/heldglove/boxing/jab/blue

/obj/item/weapon/heldglove/boxing/hook/blue
icon_state = "boxing_p_b"

/obj/item/weapon/heldglove/boxing/jab/blue
icon_state = "boxing_j_b"

/obj/item/clothing/gloves/boxing/yellow
/obj/item/clothing/gloves/heldgloves/boxing/yellow
icon_state = "boxingyellow"
item_state = "boxingyellow"
rightglove_path = /obj/item/weapon/heldglove/boxing/hook/yellow
leftglove_path = /obj/item/weapon/heldglove/boxing/jab/yellow

/obj/item/weapon/heldglove/boxing/hook/yellow
icon_state = "boxing_p_y"

/obj/item/weapon/heldglove/boxing/jab/yellow
icon_state = "boxing_j_y"

//Punching bag. Both punches and attacking with weapons causes it to
/obj/structure/punching_bag
name = "punching bag"
desc = "A Nanotrasen punching bag. A common sight this far from Sol.\nCheap and flimsy, might break if hit by something too heavy."
max_integrity = 750 //This is going to get hit, a lot
icon = 'icons/obj/clothing/boxing.dmi'
icon_state = "punchingbag"

/obj/structure/punching_bag/attackby(obj/item/I, mob/user, params)
. = ..()
flick("[icon_state]-punch", src)

/obj/item/clothing/gloves/white
name = "white gloves"
Expand Down
Binary file added icons/obj/clothing/boxing.dmi
Binary file not shown.
Binary file modified icons/obj/clothing/gloves.dmi
Binary file not shown.
Binary file added sound/effects/knockout.ogg
Binary file not shown.

0 comments on commit f0f43d0

Please sign in to comment.