Skip to content

Commit

Permalink
Admin Flag for Disposal mobs (#3814)
Browse files Browse the repository at this point in the history
# About the pull request
Allows admins to toggle a flag as to whether mobs will fit inside
disposals tubes.
<!-- Remove this text and explain what the purpose of your PR is.

Mention if you have tested your changes. If you changed a map, make sure
you used the mapmerge tool.
If this is an Issue Correction, you can type "Fixes Issue #169420" to
link the PR to the corresponding Issue number #169420.

Remember: something that is self-evident to you might not be to others.
Explain your rationale fully, even if you feel it goes without saying.
-->

# Explain why it's good for the game
Regarding disposal tubes, there are some situations where I can see it
being fitting to the situation, and this will also allow a measured
level of return for a feature we had to remove due to abuse.
# Testing Photographs and Procedure
<details>
<summary>Screenshots & Videos</summary>

Put screenshots and videos here with an empty line between the
screenshots and the `<details>` tags.

</details>


# Changelog
:cl:
add: Added an admin toggle flag for fitting mobs into disposals. (Within
reason - no queens...)
add: The Crawler trait that allows mobs to enter vents will also allow
them to climb into disposals regardless of above flag.
add: Added a subtype of disposal that can't fit mobs, used for the
delivery units.
/:cl:
  • Loading branch information
realforest2001 authored Aug 4, 2023
1 parent 864bc8d commit 34f1f24
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 46 deletions.
1 change: 1 addition & 0 deletions code/__DEFINES/mode.dm
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
#define MODE_LZ_PROTECTION (1<<7) /// Prevents the LZ from being mortared
#define MODE_SHIPSIDE_SD (1<<8) /// Toggles whether Predators can big SD when not on the groundmap
#define MODE_HARDCORE_PERMA (1<<9) /// Toggles Hardcore for all marines, meaning they instantly perma upon death
#define MODE_DISPOSABLE_MOBS (1<<10) // Toggles if mobs fit in disposals or not. Off by default.

#define ROUNDSTATUS_FOG_DOWN 1
#define ROUNDSTATUS_PODDOORS_OPEN 2
Expand Down
1 change: 1 addition & 0 deletions code/_globalvars/bitfields.dm
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,7 @@ DEFINE_BITFIELD(toggleable_flags, list(
"MODE_NO_COMBAT_CAS" = MODE_NO_COMBAT_CAS,
"MODE_LZ_PROTECTION" = MODE_LZ_PROTECTION,
"MODE_SHIPSIDE_SD" = MODE_SHIPSIDE_SD,
"MODE_DISPOSABLE_MOBS" = MODE_DISPOSABLE_MOBS,
))

DEFINE_BITFIELD(state, list(
Expand Down
1 change: 1 addition & 0 deletions code/modules/admin/admin_verbs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ var/list/admin_verbs_minor_event = list(
/client/proc/toggle_sniper_upgrade,
/client/proc/toggle_attack_dead,
/client/proc/toggle_strip_drag,
/client/proc/toggle_disposal_mobs,
/client/proc/toggle_uniform_strip,
/client/proc/toggle_strong_defibs,
/client/proc/toggle_blood_optimization,
Expand Down
14 changes: 14 additions & 0 deletions code/modules/admin/tabs/admin_tab.dm
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,20 @@
SSticker.mode.toggleable_flags ^= MODE_NO_ATTACK_DEAD
message_admins("[src] has [MODE_HAS_TOGGLEABLE_FLAG(MODE_NO_ATTACK_DEAD) ? "prevented dead mobs from being" : "allowed dead mobs to be"] attacked.")

/client/proc/toggle_disposal_mobs()
set name = "Toggle Disposable Mobs"
set category = "Admin.Flags"

if(!admin_holder || !check_rights(R_EVENT, FALSE))
return

if(!SSticker.mode)
to_chat(usr, SPAN_WARNING("A mode hasn't been selected yet!"))
return

SSticker.mode.toggleable_flags ^= MODE_DISPOSABLE_MOBS
message_admins("[src] has [MODE_HAS_TOGGLEABLE_FLAG(MODE_DISPOSABLE_MOBS) ? "allowed mobs to fit" : "prevented mobs fitting"] inside disposals.")

/client/proc/toggle_strip_drag()
set name = "Toggle Strip/Drag Dead"
set category = "Admin.Flags"
Expand Down
112 changes: 69 additions & 43 deletions code/modules/recycling/disposal.dm
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@
active_power_usage = 3500
idle_power_usage = 100
var/disposal_pressure = 0
///Whether the disposals tube is too narrow for a mob to fit into.
var/narrow_tube = FALSE

/obj/structure/machinery/disposal/delivery
name = "delivery chute"
desc = "A pneumatic delivery unit connecting two locations. It's rather narrow."
narrow_tube = TRUE

/obj/structure/machinery/disposal/broken
name = "broken disposal unit"
Expand Down Expand Up @@ -128,24 +135,42 @@
update()
return

var/obj/item/grab/G = I
if(istype(G)) //Handle grabbed mob
if(ismob(G.grabbed_thing))
to_chat(user, SPAN_WARNING("You can't fit that in there!"))
return
/*&& user.grab_level >= GRAB_AGGRESSIVE)
var/mob/GM = G.grabbed_thing
user.visible_message(SPAN_WARNING("[user] starts putting [GM] into [src]."),
SPAN_WARNING("You start putting [GM] into [src]."))
if(do_after(user, 20, INTERRUPT_ALL, BUSY_ICON_HOSTILE))
GM.forceMove(src)
user.visible_message(SPAN_WARNING("[user] puts [GM] into [src]."),
SPAN_WARNING("[user] puts [GM] into [src]."))
user.attack_log += text("\[[time_stamp()]\] <font color='red'>Has placed [GM] ([GM.ckey]) in disposals.</font>")
GM.attack_log += text("\[[time_stamp()]\] <font color='orange'>Has been placed in disposals by [user] ([user.ckey])</font>")
msg_admin_attack("[user] ([user.ckey]) placed [GM] ([GM.ckey]) in a disposals unit in [get_area(user)] ([user.loc.x],[user.loc.y],[user.loc.z]).", user.loc.x, user.loc.y, user.loc.z)
flush()*/
return
var/obj/item/grab/grab_effect = I
if(istype(grab_effect)) //Handle grabbed mob
if(ismob(grab_effect.grabbed_thing))
var/mob/grabbed_mob = grab_effect.grabbed_thing
if((!MODE_HAS_TOGGLEABLE_FLAG(MODE_DISPOSABLE_MOBS) && !HAS_TRAIT(grabbed_mob, TRAIT_CRAWLER)) || narrow_tube || grabbed_mob.mob_size >= MOB_SIZE_BIG)
to_chat(user, SPAN_WARNING("You can't fit that in there!"))
return FALSE
var/max_grab_size = user.mob_size
/// Amazing what you can do with a bit of dexterity.
if(HAS_TRAIT(user, TRAIT_DEXTROUS))
max_grab_size++
/// Strong mobs can lift above their own weight.
if(HAS_TRAIT(user, TRAIT_SUPER_STRONG))//NB; this will mean Yautja can bodily lift MOB_SIZE_XENO(3) and Synths can lift MOB_SIZE_XENO_SMALL(2)
max_grab_size++
if(grabbed_mob.mob_size > max_grab_size || !(grabbed_mob.status_flags & CANPUSH))
to_chat(user, SPAN_WARNING("You don't have the strength to move [grabbed_mob]!"))
return FALSE//can't tighten your grip on mobs bigger than you and mobs you can't push.
if(!user.grab_level >= GRAB_AGGRESSIVE)
to_chat(user, SPAN_WARNING("You need a better grip to force [grabbed_mob] in there!"))
return FALSE
user.visible_message(SPAN_WARNING("[user] starts putting [grabbed_mob] into [src]."),
SPAN_WARNING("You start putting [grabbed_mob] into [src]."))
if(!do_after(user, 2 SECONDS, INTERRUPT_ALL, BUSY_ICON_HOSTILE))
user.visible_message(SPAN_WARNING("[user] stops putting [grabbed_mob] into [src]."),
SPAN_WARNING("You stop putting [grabbed_mob] into [src]."))
return FALSE

grabbed_mob.forceMove(src)
user.visible_message(SPAN_WARNING("[user] puts [grabbed_mob] into [src]."),
SPAN_WARNING("[user] puts [grabbed_mob] into [src]."))
user.attack_log += text("\[[time_stamp()]\] <font color='red'>Has placed [key_name(grabbed_mob)] in disposals.</font>")
grabbed_mob.attack_log += text("\[[time_stamp()]\] <font color='orange'>Has been placed in disposals by [user] ([user.ckey])</font>")
msg_admin_attack("[user] ([user.ckey]) placed [key_name(grabbed_mob)] in a disposals unit in [get_area(user)] ([user.loc.x],[user.loc.y],[user.loc.z]).", user.loc.x, user.loc.y, user.loc.z)
flush(TRUE)//Forcibly flushing someone if forced in by another player.
return TRUE
return FALSE

if(isrobot(user))
return
Expand All @@ -161,51 +186,50 @@

///Mouse drop another mob or self
/obj/structure/machinery/disposal/MouseDrop_T(mob/target, mob/user)
return
/*
if(!istype(target) || target.anchored || target.buckled || get_dist(user, src) > 1 || get_dist(user, target) > 1 || user.is_mob_incapacitated(TRUE) || isRemoteControlling(user) || target.mob_size >= MOB_SIZE_BIG)
return
if(!(ishuman(target)) || !(ishuman(user))) return
if(isanimal(user) && target != user) return //Animals cannot put mobs other than themselves into disposal
if((!MODE_HAS_TOGGLEABLE_FLAG(MODE_DISPOSABLE_MOBS) && !HAS_TRAIT(user, TRAIT_CRAWLER)) || narrow_tube)
to_chat(user, SPAN_WARNING("Looks a little bit too tight in there!"))
return FALSE

if(target != user)
to_chat(user, SPAN_WARNING("You need a better grip on [target] to force them into [src]!"))
return FALSE //Need a firm grip to put someone else in there.

if(!istype(target) || target.anchored || target.buckled || get_dist(user, src) > 1 || user.is_mob_incapacitated(TRUE) || isRemoteControlling(user) || target.mob_size >= MOB_SIZE_BIG)
to_chat(user, SPAN_WARNING("You cannot get into the [src]!"))
return FALSE
add_fingerprint(user)
var/target_loc = target.loc

if(target == user)
visible_message(SPAN_NOTICE("[user] starts climbing into the disposal."))
else
if(user.is_mob_restrained()) return //can't stuff someone other than you if restrained.
visible_message(SPAN_WARNING("[user] starts stuffing [target] into the disposal."))

if(!do_after(user, 40, INTERRUPT_NO_NEEDHAND, BUSY_ICON_HOSTILE))
return
return FALSE
if(target_loc != target.loc)
return
return FALSE
if(user.is_mob_incapacitated(TRUE))
to_chat(user, SPAN_WARNING("You cannot do this while incapacitated!"))
return FALSE

if(target == user)
if(user.is_mob_incapacitated(TRUE)) return
user.visible_message(SPAN_NOTICE("[user] climbs into [src]."),
SPAN_NOTICE("You climb into [src]."))
else
if(user.is_mob_incapacitated()) return
user.visible_message(SPAN_DANGER("[user] stuffs [target] into [src]!"),
SPAN_WARNING("You stuff [target] into [src]!"))
user.attack_log += text("\[[time_stamp()]\] <font color='red'>Has placed [target.name] ([target.ckey]) in disposals.</font>")
target.attack_log += text("\[[time_stamp()]\] <font color='orange'>Has been placed in disposals by [user.name] ([user.ckey])</font>")
msg_admin_attack("[user] ([user.ckey]) placed [target] ([target.ckey]) in a disposals unit in [get_area(user)] ([user.loc.x],[user.loc.y],[user.loc.z]).", user.loc.x, user.loc.y, user.loc.z)
user.attack_log += text("\[[time_stamp()]\] <font color='red'>[key_name(user)] climbed into a disposals bin!</font>")

target.forceMove(src)
flush()
update()*/
flush()//Not forcing flush if climbing in by self.
update()

///Attempt to move while inside
/obj/structure/machinery/disposal/relaymove(mob/user)
if(user.stat || user.stunned || user.knocked_down || flushing)
return
return FALSE
if(user.loc == src)
go_out(user)
return TRUE

///Leave the disposal
/obj/structure/machinery/disposal/proc/go_out(mob/user)

if(user.client)
user.client.eye = user.client.mob
user.client.perspective = MOB_PERSPECTIVE
Expand Down Expand Up @@ -364,7 +388,9 @@
return

///Perform a flush
/obj/structure/machinery/disposal/proc/flush()
/obj/structure/machinery/disposal/proc/flush(forced = FALSE)
if((disposal_pressure < SEND_PRESSURE) && !forced)
return FALSE

flushing = TRUE
flick("[icon_state]-flush", src)
Expand Down
6 changes: 3 additions & 3 deletions maps/map_files/USS_Almayer/USS_Almayer.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -5011,7 +5011,7 @@
/obj/structure/disposalpipe/trunk{
dir = 1
},
/obj/structure/machinery/disposal{
/obj/structure/machinery/disposal/delivery{
density = 0;
desc = "A pneumatic delivery unit. Sends items to the requisitions.";
icon_state = "delivery_engi";
Expand Down Expand Up @@ -76155,12 +76155,12 @@
/obj/structure/disposalpipe/trunk{
dir = 1
},
/obj/structure/machinery/disposal{
/obj/structure/machinery/disposal/delivery{
density = 0;
desc = "A pneumatic delivery unit. Sends items to the requisitions.";
icon_state = "delivery_med";
name = "Requisitions Delivery Unit";
pixel_y = 29
pixel_y = 28
},
/turf/open/floor/almayer{
icon_state = "mono"
Expand Down

0 comments on commit 34f1f24

Please sign in to comment.