Skip to content
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

Admin Flag for Disposal mobs #3814

Merged
merged 8 commits into from
Aug 4, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -422,6 +422,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 @@ -730,6 +730,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
108 changes: 66 additions & 42 deletions code/modules/recycling/disposal.dm
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@
active_power_usage = 3500
idle_power_usage = 100
var/disposal_pressure = 0
var/narrow_tube = FALSE
realforest2001 marked this conversation as resolved.
Show resolved Hide resolved

/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,23 +134,40 @@
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()*/
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)
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, 20, INTERRUPT_ALL, BUSY_ICON_HOSTILE))
realforest2001 marked this conversation as resolved.
Show resolved Hide resolved
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.
else
realforest2001 marked this conversation as resolved.
Show resolved Hide resolved
to_chat(user, SPAN_WARNING("You need a better grip to force [grabbed_mob] in there!"))
return

if(isrobot(user))
Expand All @@ -161,51 +184,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 the [src]!"))
realforest2001 marked this conversation as resolved.
Show resolved Hide resolved
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 +386,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 @@ -5003,7 +5003,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 @@ -60954,7 +60954,7 @@
},
/area/almayer/living/briefing)
"rhO" = (
/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";
Expand Down Expand Up @@ -69158,7 +69158,7 @@
/obj/item/reagent_container/glass/beaker{
pixel_x = 5
},
/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";
Expand Down