From dfb85e6460c5e2fde344b6113ef9dd577e830ba9 Mon Sep 17 00:00:00 2001
From: Henri215 <77684085+Henri215@users.noreply.github.com>
Date: Sat, 26 Nov 2022 01:50:17 -0300
Subject: [PATCH] Preparing for the summer: baseball and dodgeballs! (#19627)
* welcome to the space jam
* Apply suggestions from code review
Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com>
* review suggestions
* conflict solve mistake
* Apply suggestions from code review
Co-authored-by: Sirryan2002 <80364400+Sirryan2002@users.noreply.github.com>
* Update code/game/objects/items/sport.dm
Co-authored-by: Sirryan2002 <80364400+Sirryan2002@users.noreply.github.com>
* Apply suggestions from code review
Co-authored-by: Sirryan2002 <80364400+Sirryan2002@users.noreply.github.com>
* wear suit check
Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com>
Co-authored-by: Sirryan2002 <80364400+Sirryan2002@users.noreply.github.com>
---
.../machinery/computer/HolodeckControl.dm | 52 ------------
code/game/objects/items/misc.dm | 14 ----
code/game/objects/items/sport.dm | 83 +++++++++++++++++++
.../crates_lockers/closets/fitness.dm | 2 +
code/modules/admin/verbs/onlyoneteam.dm | 8 +-
.../supply/supply_packs/pack_miscellaneous.dm | 8 +-
paradise.dme | 1 +
7 files changed, 95 insertions(+), 73 deletions(-)
create mode 100644 code/game/objects/items/sport.dm
diff --git a/code/game/machinery/computer/HolodeckControl.dm b/code/game/machinery/computer/HolodeckControl.dm
index 16098d157cf..86aed4efbda 100644
--- a/code/game/machinery/computer/HolodeckControl.dm
+++ b/code/game/machinery/computer/HolodeckControl.dm
@@ -511,58 +511,6 @@
add_fingerprint(user)
return
-//BASKETBALL OBJECTS
-/obj/item/beach_ball/holoball
- icon = 'icons/obj/basketball.dmi'
- icon_state = "basketball"
- name = "basketball"
- item_state = "basketball"
- desc = "Here's your chance, do your dance at the Space Jam."
- w_class = WEIGHT_CLASS_BULKY //Stops people from hiding it in their bags/pockets
-
-/obj/item/beach_ball/holoball/baseball
- icon_state = "baseball"
- name = "baseball"
- item_state = "baseball"
- desc = "Take me out to the ball game."
-
-/obj/structure/holohoop
- name = "basketball hoop"
- desc = "Boom, Shakalaka!"
- icon = 'icons/obj/basketball.dmi'
- icon_state = "hoop"
- anchored = TRUE
- density = TRUE
- pass_flags = LETPASSTHROW
-
-/obj/structure/holohoop/attackby(obj/item/W as obj, mob/user as mob, params)
- if(istype(W, /obj/item/grab) && get_dist(src,user)<2)
- var/obj/item/grab/G = W
- if(G.state<2)
- to_chat(user, "You need a better grip to do that!")
- return
- G.affecting.loc = src.loc
- G.affecting.Weaken(10 SECONDS)
- visible_message("[G.assailant] dunks [G.affecting] into [src]!")
- qdel(W)
- return
- else if(isitem(W) && get_dist(src,user)<2)
- user.drop_item(src)
- visible_message("[user] dunks [W] into [src]!")
- return
-
-
-/obj/structure/holohoop/hitby(atom/movable/AM, skipcatch, hitpush, blocked, datum/thrownthing/throwingdatum)
- if(isitem(AM) && !istype(AM,/obj/item/projectile))
- if(prob(50))
- AM.forceMove(get_turf(src))
- visible_message("Swish! [AM] lands in [src].")
- else
- visible_message("[AM] bounces off of [src]'s rim!")
- return ..()
- else
- return ..()
-
/obj/machinery/readybutton
name = "Ready Declaration Device"
desc = "This device is used to declare ready. If all devices in an area are ready, the event will begin!"
diff --git a/code/game/objects/items/misc.dm b/code/game/objects/items/misc.dm
index bd693b99d6c..5e7d5be4e60 100644
--- a/code/game/objects/items/misc.dm
+++ b/code/game/objects/items/misc.dm
@@ -10,20 +10,6 @@
/obj/item/mouse_drag_pointer = MOUSE_ACTIVE_POINTER
-/obj/item/beach_ball
- icon = 'icons/misc/beach.dmi'
- icon_state = "ball"
- name = "beach ball"
- item_state = "beachball"
- density = FALSE
- anchored = FALSE
- w_class = WEIGHT_CLASS_TINY
- force = 0.0
- throwforce = 0.0
- throw_speed = 1
- throw_range = 20
- flags = CONDUCT
-
/obj/item/petcollar
name = "pet collar"
desc = "The latest fashion accessory for your favorite pets!"
diff --git a/code/game/objects/items/sport.dm b/code/game/objects/items/sport.dm
new file mode 100644
index 00000000000..3587b2bec3b
--- /dev/null
+++ b/code/game/objects/items/sport.dm
@@ -0,0 +1,83 @@
+/obj/item/beach_ball
+ name = "beach ball"
+ icon = 'icons/misc/beach.dmi'
+ desc = "An inflatable ball of fun, enjoyed on many beaches."
+ icon_state = "ball"
+ item_state = "beachball"
+ density = FALSE
+ anchored = FALSE
+ w_class = WEIGHT_CLASS_NORMAL
+ force = 0
+ throwforce = 0
+ throw_speed = 1
+ throw_range = 20
+ flags = CONDUCT
+
+/obj/item/beach_ball/baseball
+ name = "baseball"
+ desc = "Take me out to the ball game."
+ icon = 'icons/obj/basketball.dmi'
+ icon_state = "baseball"
+ item_state = "baseball"
+ w_class = WEIGHT_CLASS_SMALL
+
+/obj/item/beach_ball/dodgeball
+ name = "dodgeball"
+ desc = "Used for playing the most violent and degrading of childhood games. This one is connected to the laser tag armour system."
+ icon = 'icons/obj/basketball.dmi'
+ icon_state = "dodgeball"
+ item_state = "dodgeball"
+ var/list/suit_types = list(/obj/item/clothing/suit/redtag, /obj/item/clothing/suit/bluetag)
+
+/obj/item/beach_ball/dodgeball/throw_impact(atom/hit_atom)
+ . = ..()
+ var/mob/living/carbon/human/M = hit_atom
+ if(ishuman(hit_atom) && (M.wear_suit?.type in suit_types))
+ if(M.r_hand == src || M.l_hand == src)
+ return
+ playsound(src, 'sound/items/dodgeball.ogg', 50, 1)
+ M.KnockDown(6 SECONDS)
+
+/obj/item/beach_ball/holoball
+ name = "basketball"
+ desc = "Here's your chance, do your dance at the Space Jam."
+ icon = 'icons/obj/basketball.dmi'
+ icon_state = "basketball"
+ item_state = "basketball"
+ w_class = WEIGHT_CLASS_BULKY //Stops people from hiding it in their bags/pockets
+
+/obj/structure/holohoop
+ name = "basketball hoop"
+ desc = "Boom, Shakalaka!"
+ icon = 'icons/obj/basketball.dmi'
+ icon_state = "hoop"
+ anchored = TRUE
+ density = TRUE
+ pass_flags = LETPASSTHROW
+
+/obj/structure/holohoop/attackby(obj/item/W, mob/user, params)
+ if(istype(W, /obj/item/grab) && get_dist(src, user) <= 1)
+ var/obj/item/grab/G = W
+ if(G.state < GRAB_AGGRESSIVE)
+ to_chat(user, "You need a better grip to do that!")
+ return
+ G.affecting.forceMove(loc)
+ G.affecting.Weaken(10 SECONDS)
+ visible_message("[G.assailant] dunks [G.affecting] into [src]!")
+ qdel(W)
+ return
+ else if(isitem(W) && get_dist(src,user) <= 1)
+ user.drop_item(src)
+ visible_message("[user] dunks [W] into [src]!")
+ return
+
+/obj/structure/holohoop/hitby(atom/movable/AM, skipcatch, hitpush, blocked, datum/thrownthing/throwingdatum)
+ if(isitem(AM) && !istype(AM, /obj/item/projectile))
+ if(prob(50))
+ AM.forceMove(get_turf(src))
+ visible_message("Swish! [AM] lands in [src].")
+ else
+ visible_message("[AM] bounces off of [src]'s rim!")
+ return ..()
+ else
+ return ..()
diff --git a/code/game/objects/structures/crates_lockers/closets/fitness.dm b/code/game/objects/structures/crates_lockers/closets/fitness.dm
index 3442db03398..cb5bd4a3c77 100644
--- a/code/game/objects/structures/crates_lockers/closets/fitness.dm
+++ b/code/game/objects/structures/crates_lockers/closets/fitness.dm
@@ -51,6 +51,7 @@
open_door_sprite = "generic_door"
/obj/structure/closet/lasertag/red/populate_contents()
+ new /obj/item/beach_ball/dodgeball(src)
new /obj/item/gun/energy/laser/tag/red(src)
new /obj/item/gun/energy/laser/tag/red(src)
new /obj/item/gun/energy/laser/tag/red(src)
@@ -67,6 +68,7 @@
open_door_sprite = "generic_door"
/obj/structure/closet/lasertag/blue/populate_contents()
+ new /obj/item/beach_ball/dodgeball(src)
new /obj/item/gun/energy/laser/tag/blue(src)
new /obj/item/gun/energy/laser/tag/blue(src)
new /obj/item/gun/energy/laser/tag/blue(src)
diff --git a/code/modules/admin/verbs/onlyoneteam.dm b/code/modules/admin/verbs/onlyoneteam.dm
index 393e5998c08..b343dde435c 100644
--- a/code/modules/admin/verbs/onlyoneteam.dm
+++ b/code/modules/admin/verbs/onlyoneteam.dm
@@ -24,7 +24,7 @@
to_chat(H, "You are part of the [station_name()] dodgeball tournament. Throw dodgeballs at crewmembers wearing a different color than you. OOC: Use THROW on an EMPTY-HAND to catch thrown dodgeballs.")
H.equip_to_slot_or_del(new /obj/item/radio/headset/heads/captain(H), slot_l_ear)
- H.equip_to_slot_or_del(new /obj/item/beach_ball/dodgeball(H), slot_r_hand)
+ H.equip_to_slot_or_del(new /obj/item/beach_ball/dodgeball_team(H), slot_r_hand)
H.equip_to_slot_or_del(new /obj/item/clothing/shoes/white(H), slot_shoes)
if(!team_toggle)
@@ -61,14 +61,14 @@
log_admin("[key_name(usr)] used dodgeball.")
GLOB.nologevent = 1
-/obj/item/beach_ball/dodgeball
+/obj/item/beach_ball/dodgeball_team
name = "dodgeball"
+ desc = "Used for playing the most violent and degrading of childhood games."
icon = 'icons/obj/basketball.dmi'
icon_state = "dodgeball"
item_state = "dodgeball"
- desc = "Used for playing the most violent and degrading of childhood games."
-/obj/item/beach_ball/dodgeball/throw_impact(atom/hit_atom)
+/obj/item/beach_ball/dodgeball_team/throw_impact(atom/hit_atom)
..()
if((ishuman(hit_atom)))
var/mob/living/carbon/human/H = hit_atom
diff --git a/code/modules/supply/supply_packs/pack_miscellaneous.dm b/code/modules/supply/supply_packs/pack_miscellaneous.dm
index e29550e6cb9..4408ede78ac 100644
--- a/code/modules/supply/supply_packs/pack_miscellaneous.dm
+++ b/code/modules/supply/supply_packs/pack_miscellaneous.dm
@@ -26,7 +26,9 @@
/datum/supply_packs/misc/lasertag
name = "Laser Tag Crate"
- contains = list(/obj/item/gun/energy/laser/tag/red,
+ contains = list(/obj/item/beach_ball/dodgeball,
+ /obj/item/beach_ball/dodgeball,
+ /obj/item/gun/energy/laser/tag/red,
/obj/item/gun/energy/laser/tag/red,
/obj/item/gun/energy/laser/tag/red,
/obj/item/gun/energy/laser/tag/blue,
@@ -404,7 +406,7 @@
/datum/supply_packs/misc/teamcolors //For team sports like space polo
name = "Team Jerseys Crate"
- // 4 red jerseys, 4 blue jerseys, and 1 beach ball
+ // 4 red jerseys, 4 blue jerseys, and 1 baseball
contains = list(/obj/item/clothing/under/color/red/jersey,
/obj/item/clothing/under/color/red/jersey,
/obj/item/clothing/under/color/red/jersey,
@@ -413,7 +415,7 @@
/obj/item/clothing/under/color/blue/jersey,
/obj/item/clothing/under/color/blue/jersey,
/obj/item/clothing/under/color/blue/jersey,
- /obj/item/beach_ball)
+ /obj/item/beach_ball/baseball)
cost = 300
containername = "team jerseys crate"
diff --git a/paradise.dme b/paradise.dme
index bd5b27df2db..29010d2fe44 100644
--- a/paradise.dme
+++ b/paradise.dme
@@ -901,6 +901,7 @@
#include "code\game\objects\items\mixing_bowl.dm"
#include "code\game\objects\items\random_items.dm"
#include "code\game\objects\items\shooting_range.dm"
+#include "code\game\objects\items\sport.dm"
#include "code\game\objects\items\theft_items.dm"
#include "code\game\objects\items\toys.dm"
#include "code\game\objects\items\trash.dm"