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

Administration tool: Build mode offer tool to quickly offer large amount of mobs. #26712

Merged
merged 9 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from 8 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/__HELPERS/trait_helpers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai

//***** MOB TRAITS *****//
#define TRAIT_RESPAWNABLE "can_respawn_as_ghost_roles"
#define TRAIT_BEING_OFFERED "offered"
#define TRAIT_BLIND "blind"
#define TRAIT_MUTE "mute"
#define TRAIT_DEAF "deaf"
Expand Down
1 change: 1 addition & 0 deletions code/_globalvars/traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/
GLOBAL_LIST_INIT(traits_by_type, list(
/mob = list(
"TRAIT_BEING_OFFERED" = TRAIT_BEING_OFFERED,
"TRAIT_BLIND" = TRAIT_BLIND,
"TRAIT_MUTE" = TRAIT_MUTE,
"TRAIT_DEAF" = TRAIT_DEAF,
Expand Down
29 changes: 29 additions & 0 deletions code/modules/buildmode/submodes/offer.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Speeds up the offering process and optionally allows the admin to set up playtime requirement and "Show role" only once.
// Default setting is 20H like the default recommendation for offering from drop down menu.
/datum/buildmode_mode/offer
key = "offer"
var/hours = 20
var/hide_role

/datum/buildmode_mode/offer/show_help(mob/user)
to_chat(user, "<span class='notice'>***********************************************************</span>")
to_chat(user, "<span class='notice'>Left click to offer a mob</span>")
to_chat(user, "<span class='notice'>Right click to change amount of playtime a player needs to be able to sign up and whether to display their special role</span>")
to_chat(user, "<span class='notice'>***********************************************************</span>")

/datum/buildmode_mode/offer/change_settings(mob/user)
hours = input(user, "Playtime required", "Input", 20) as num|null
if(alert("Do you want to show the mob's special role?", null, "Yes", "No") == "Yes")
meow20 marked this conversation as resolved.
Show resolved Hide resolved
hide_role = FALSE
else
hide_role = TRUE

/datum/buildmode_mode/offer/handle_click(mob/user, params, atom/A)
var/list/modifiers = params2list(params)
var/left_click = LAZYACCESS(modifiers, LEFT_CLICK)
var/selected_atom

if(left_click && ismob(A) && !isobserver(A))
selected_atom = A
offer_control(selected_atom, hours, hide_role)

20 changes: 15 additions & 5 deletions code/modules/mob/mob_misc_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -158,16 +158,26 @@
return U.sensor_mode
return SUIT_SENSOR_OFF

/proc/offer_control(mob/M)
to_chat(M, "Control of your mob has been offered to dead players.")
/proc/offer_control(mob/M, hours, hide_role)
if(HAS_TRAIT(M, TRAIT_BEING_OFFERED))
return
var/minhours
ADD_TRAIT(M, TRAIT_BEING_OFFERED, "admin_offer")
log_admin("[key_name(usr)] has offered control of ([key_name(M)]) to ghosts.")
var/minhours = input(usr, "Minimum hours required to play [M]?", "Set Min Hrs", 10) as num
message_admins("[key_name_admin(usr)] has offered control of ([key_name_admin(M)]) to ghosts with [minhours] hrs playtime")
var/question = "Do you want to play as [M.real_name ? M.real_name : M.name][M.job ? " ([M.job])" : ""]"
if(alert("Do you want to show the antag status?","Show antag status","Yes","No") == "Yes")
if(!hours)
minhours = input(usr, "Minimum hours required to play [M]?", "Set Min Hrs", 10) as num
else
minhours = hours
if(isnull(hide_role))
if(alert("Do you want to show the antag status?","Show antag status","Yes","No") == "Yes")
question += ", [M.mind?.special_role ? M.mind?.special_role : "No special role"]"
meow20 marked this conversation as resolved.
Show resolved Hide resolved
else if(!hide_role)
question += ", [M.mind?.special_role ? M.mind?.special_role : "No special role"]"
message_admins("[key_name_admin(usr)] has offered control of ([key_name_admin(M)]) to ghosts with [minhours] hrs playtime")
var/list/mob/dead/observer/candidates = SSghost_spawns.poll_candidates("[question]?", poll_time = 10 SECONDS, min_hours = minhours, source = M)
var/mob/dead/observer/theghost = null
REMOVE_TRAIT(M, TRAIT_BEING_OFFERED, "admin_offer")

if(length(candidates))
if(QDELETED(M))
Expand Down
Binary file modified icons/misc/buildmode.dmi
Binary file not shown.
1 change: 1 addition & 0 deletions paradise.dme
Original file line number Diff line number Diff line change
Expand Up @@ -1658,6 +1658,7 @@
#include "code\modules\buildmode\submodes\forcemove.dm"
#include "code\modules\buildmode\submodes\link.dm"
#include "code\modules\buildmode\submodes\mapgen.dm"
#include "code\modules\buildmode\submodes\offer.dm"
#include "code\modules\buildmode\submodes\save.dm"
#include "code\modules\buildmode\submodes\throwing.dm"
#include "code\modules\buildmode\submodes\tilt.dm"
Expand Down