Unfucks /datum/browse code (#89994)

## About The Pull Request

What it was doing was by and large fine, HOW it was doing it SUCKED 
I've cleaned it up and the nearby code some, notable hits include: 
- random if check in secrets ui that was totally unused
- proc called add that actually set 
- lists not defined as such
- stupid var names
- proc args which did nothing
- code which did nothing
- oververbose code
- proc/var names with no spacing at all

Note: This might have changed behavior accidentally, I've done my best
to test but we'll need to look out for issue reports in coming days.

## Why It's Good For The Game

I was working on bitflag code and saw red, now it's 2 hours later.

## Changelog
🆑
code: Brought browser code up to standard with the rest of the codebase
admin: Hey lads, I cleaned up how non TGUI windows work on the backend,
please let me know if anything is broken! PING ME MOTHERFUCKER
/🆑
This commit is contained in:
LemonInTheDark
2025-04-25 17:36:34 -04:00
committed by GitHub
parent de7506ad74
commit a0a07e9f40
11 changed files with 504 additions and 503 deletions
+3 -1
View File
@@ -471,8 +471,10 @@ ADMIN_VERB(edit_admin_permissions, R_PERMISSIONS, "Permissions Panel", "Edit adm
admin_holder.rank_flags(),
350,
590,
allowed_edit_flags = usr.client.holder.can_edit_rights_flags(),
allowed_edit_field = usr.client.holder.can_edit_rights_flags(),
)
if(isnull(new_flags))
return
admin_holder.disassociate()
+140 -141
View File
@@ -71,7 +71,7 @@
unset_busy_human_dummy(DUMMY_HUMAN_SLOT_ADMIN)
return preview_icon
/datum/admins/proc/makeEmergencyresponseteam(datum/ert/ertemplate = null)
/datum/admins/proc/make_emergency_response_team(datum/ert/ertemplate = null)
if (ertemplate)
ertemplate = new ertemplate
else
@@ -96,182 +96,181 @@
)
)
var/list/prefreturn = presentpreflikepicker(usr, "Customize ERT", "Customize ERT", Button1="Ok", width = 600, StealFocus = 1,Timeout = 0, settings=settings)
var/list/pref_return = present_pref_like_picker(usr, "Customize ERT", "Customize ERT", width = 600, timeout = 0, settings = settings)
if (isnull(prefreturn))
if (isnull(pref_return))
return FALSE
if (prefreturn["button"] == 1)
var/list/prefs = settings["mainsettings"]
if (pref_return["button"] != 1)
return FALSE
var/templtype = prefs["template"]["value"]
if (!ispath(prefs["template"]["value"]))
templtype = text2path(prefs["template"]["value"]) // new text2path ... doesn't compile in 511
var/list/prefs = settings["mainsettings"]
if (ertemplate.type != templtype)
ertemplate = new templtype
var/templtype = prefs["template"]["value"]
if (!ispath(prefs["template"]["value"]))
templtype = text2path(prefs["template"]["value"]) // new text2path ... doesn't compile in 511
ertemplate.teamsize = prefs["teamsize"]["value"]
ertemplate.mission = prefs["mission"]["value"]
ertemplate.polldesc = prefs["polldesc"]["value"]
ertemplate.enforce_human = prefs["enforce_human"]["value"] == "Yes" // these next 6 are effectively toggles
ertemplate.opendoors = prefs["open_armory"]["value"] == "Yes"
ertemplate.leader_experience = prefs["leader_experience"]["value"] == "Yes"
ertemplate.random_names = prefs["random_names"]["value"] == "Yes"
ertemplate.spawn_admin = prefs["spawn_admin"]["value"] == "Yes"
ertemplate.use_custom_shuttle = prefs["use_custom_shuttle"]["value"] == "Yes"
ertemplate.mob_type = prefs["mob_type"]["value"]
if (ertemplate.type != templtype)
ertemplate = new templtype
var/list/spawnpoints = GLOB.emergencyresponseteamspawn
var/index = 0
ertemplate.teamsize = prefs["teamsize"]["value"]
ertemplate.mission = prefs["mission"]["value"]
ertemplate.polldesc = prefs["polldesc"]["value"]
ertemplate.enforce_human = prefs["enforce_human"]["value"] == "Yes" // these next 6 are effectively toggles
ertemplate.opendoors = prefs["open_armory"]["value"] == "Yes"
ertemplate.leader_experience = prefs["leader_experience"]["value"] == "Yes"
ertemplate.random_names = prefs["random_names"]["value"] == "Yes"
ertemplate.spawn_admin = prefs["spawn_admin"]["value"] == "Yes"
ertemplate.use_custom_shuttle = prefs["use_custom_shuttle"]["value"] == "Yes"
ertemplate.mob_type = prefs["mob_type"]["value"]
var/list/mob/dead/observer/candidates = SSpolling.poll_ghost_candidates("Do you wish to be considered for [span_notice(ertemplate.polldesc)]?", check_jobban = "deathsquad", alert_pic = /obj/item/card/id/advanced/centcom/ert, role_name_text = "emergency response team")
var/teamSpawned = FALSE
var/list/spawn_points = GLOB.emergencyresponseteamspawn
// This list will take priority over spawnpoints if not empty
var/list/spawn_turfs = list()
var/list/mob/dead/observer/candidates = SSpolling.poll_ghost_candidates("Do you wish to be considered for [span_notice(ertemplate.polldesc)]?", check_jobban = "deathsquad", alert_pic = /obj/item/card/id/advanced/centcom/ert, role_name_text = "emergency response team")
var/team_spawned = 0
// Takes precedence over spawnpoints[1] if not null
var/turf/brief_spawn
// This list will take priority over spawn_points if not empty
var/list/spawn_turfs = list()
if(!length(candidates))
return FALSE
// Takes precedence over spawn_points[1] if not null
var/turf/brief_spawn
if(ertemplate.use_custom_shuttle && ertemplate.ert_template)
to_chat(usr, span_boldnotice("Attempting to spawn ERT custom shuttle, this may take a few seconds..."))
var/datum/map_template/shuttle/ship = new ertemplate.ert_template
var/x = rand(TRANSITIONEDGE, world.maxx - TRANSITIONEDGE - ship.width)
var/y = rand(TRANSITIONEDGE, world.maxy - TRANSITIONEDGE - ship.height)
var/z = SSmapping.empty_space.z_value
var/turf/located_turf = locate(x, y, z)
if(!located_turf)
CRASH("ERT shuttle found no place to load in")
if(!length(candidates))
return FALSE
if(!ship.load(located_turf))
CRASH("Loading ERT shuttle failed!")
if(ertemplate.use_custom_shuttle && ertemplate.ert_template)
to_chat(usr, span_boldnotice("Attempting to spawn ERT custom shuttle, this may take a few seconds..."))
var/datum/map_template/shuttle/ship = new ertemplate.ert_template
var/x = rand(TRANSITIONEDGE, world.maxx - TRANSITIONEDGE - ship.width)
var/y = rand(TRANSITIONEDGE, world.maxy - TRANSITIONEDGE - ship.height)
var/z = SSmapping.empty_space.z_value
var/turf/located_turf = locate(x, y, z)
if(!located_turf)
CRASH("ERT shuttle found no place to load in")
var/list/shuttle_turfs = ship.get_affected_turfs(located_turf)
if(!ship.load(located_turf))
CRASH("Loading ERT shuttle failed!")
for(var/turf/affected_turf as anything in shuttle_turfs)
for(var/obj/effect/landmark/ert_shuttle_spawn/spawner in affected_turf)
spawn_turfs += get_turf(spawner)
var/list/shuttle_turfs = ship.get_affected_turfs(located_turf)
if(!brief_spawn)
brief_spawn = get_turf(locate(/obj/effect/landmark/ert_shuttle_brief_spawn) in affected_turf)
for(var/turf/affected_turf as anything in shuttle_turfs)
for(var/obj/effect/landmark/ert_shuttle_spawn/spawner in affected_turf)
spawn_turfs += get_turf(spawner)
if(!length(spawn_turfs))
stack_trace("ERT shuttle loaded but found no spawnpoints, placing the ERT at wherever inside the shuttle instead.")
if(!brief_spawn)
brief_spawn = get_turf(locate(/obj/effect/landmark/ert_shuttle_brief_spawn) in affected_turf)
for(var/turf/open/floor/open_turf in shuttle_turfs)
if(!is_safe_turf(open_turf))
continue
spawn_turfs += open_turf
if(!length(spawn_turfs))
stack_trace("ERT shuttle loaded but found no spawn points, placing the ERT at wherever inside the shuttle instead.")
for(var/turf/open/floor/open_turf in shuttle_turfs)
if(!is_safe_turf(open_turf))
continue
spawn_turfs += open_turf
if(ertemplate.spawn_admin)
if(isobserver(usr))
var/mob/living/carbon/human/admin_officer = new (brief_spawn || spawnpoints[1])
var/chosen_outfit = usr.client?.prefs?.read_preference(/datum/preference/choiced/brief_outfit)
usr.client.prefs.safe_transfer_prefs_to(admin_officer, is_antag = TRUE)
admin_officer.equipOutfit(chosen_outfit)
admin_officer.PossessByPlayer(usr.key)
if(ertemplate.spawn_admin)
if(isobserver(usr))
var/mob/living/carbon/human/admin_officer = new (brief_spawn || spawn_points[1])
var/chosen_outfit = usr.client?.prefs?.read_preference(/datum/preference/choiced/brief_outfit)
usr.client.prefs.safe_transfer_prefs_to(admin_officer, is_antag = TRUE)
admin_officer.equipOutfit(chosen_outfit)
admin_officer.PossessByPlayer(usr.key)
else
to_chat(usr, span_warning("Could not spawn you in as briefing officer as you are not a ghost!"))
//Pick the (un)lucky players
var/numagents = min(ertemplate.teamsize, length(candidates))
//Create team
var/datum/team/ert/ert_team = new ertemplate.team()
if(ertemplate.rename_team)
ert_team.name = ertemplate.rename_team
//Assign team objective
var/datum/objective/missionobj = new ()
missionobj.team = ert_team
missionobj.explanation_text = ertemplate.mission
missionobj.completed = TRUE
ert_team.objectives += missionobj
ert_team.mission = missionobj
var/mob/dead/observer/earmarked_leader
var/leader_spawned = FALSE // just in case the earmarked leader disconnects or becomes unavailable, we can try giving leader to the last guy to get chosen
if(ertemplate.leader_experience)
var/list/candidate_living_exps = list()
for(var/i in candidates)
var/mob/dead/observer/potential_leader = i
candidate_living_exps[potential_leader] = potential_leader.client?.get_exp_living(TRUE)
candidate_living_exps = sort_list(candidate_living_exps, cmp=/proc/cmp_numeric_dsc)
if(candidate_living_exps.len > ERT_EXPERIENCED_LEADER_CHOOSE_TOP)
candidate_living_exps.Cut(ERT_EXPERIENCED_LEADER_CHOOSE_TOP+1) // pick from the top ERT_EXPERIENCED_LEADER_CHOOSE_TOP contenders in playtime
earmarked_leader = pick(candidate_living_exps)
else
earmarked_leader = pick(candidates)
to_chat(usr, span_warning("Could not spawn you in as briefing officer as you are not a ghost!"))
while(numagents && candidates.len)
var/turf/spawnloc
if(length(spawn_turfs))
spawnloc = pick(spawn_turfs)
else
spawnloc = spawnpoints[index+1]
//loop through spawnpoints one at a time
index = (index + 1) % spawnpoints.len
//Pick the (un)lucky players
var/numagents = min(ertemplate.teamsize, length(candidates))
var/mob/dead/observer/chosen_candidate = earmarked_leader || pick(candidates) // this way we make sure that our leader gets chosen
candidates -= chosen_candidate
if(!chosen_candidate?.key)
continue
//Create team
var/datum/team/ert/ert_team = new ertemplate.team()
if(ertemplate.rename_team)
ert_team.name = ertemplate.rename_team
//Spawn the body
var/mob/living/carbon/human/ert_operative
if(ertemplate.mob_type)
ert_operative = new ertemplate.mob_type(spawnloc)
else
ert_operative = new /mob/living/carbon/human(spawnloc)
chosen_candidate.client.prefs.safe_transfer_prefs_to(ert_operative, is_antag = TRUE)
ert_operative.PossessByPlayer(chosen_candidate.key)
//Assign team objective
var/datum/objective/missionobj = new ()
missionobj.team = ert_team
missionobj.explanation_text = ertemplate.mission
missionobj.completed = TRUE
ert_team.objectives += missionobj
ert_team.mission = missionobj
if(ertemplate.enforce_human || !(ert_operative.dna.species.changesource_flags & ERT_SPAWN))
ert_operative.set_species(/datum/species/human)
var/mob/dead/observer/earmarked_leader
var/leader_spawned = FALSE // just in case the earmarked leader disconnects or becomes unavailable, we can try giving leader to the last guy to get chosen
//Give antag datum
var/datum/antagonist/ert/ert_antag
if(ertemplate.leader_experience)
var/list/candidate_living_exps = list()
for(var/i in candidates)
var/mob/dead/observer/potential_leader = i
candidate_living_exps[potential_leader] = potential_leader.client?.get_exp_living(TRUE)
if((chosen_candidate == earmarked_leader) || (numagents == 1 && !leader_spawned))
ert_antag = new ertemplate.leader_role ()
earmarked_leader = null
leader_spawned = TRUE
else
ert_antag = ertemplate.roles[WRAP(numagents,1,length(ertemplate.roles) + 1)]
ert_antag = new ert_antag ()
ert_antag.random_names = ertemplate.random_names
candidate_living_exps = sort_list(candidate_living_exps, cmp=/proc/cmp_numeric_dsc)
if(candidate_living_exps.len > ERT_EXPERIENCED_LEADER_CHOOSE_TOP)
candidate_living_exps.Cut(ERT_EXPERIENCED_LEADER_CHOOSE_TOP+1) // pick from the top ERT_EXPERIENCED_LEADER_CHOOSE_TOP contenders in playtime
earmarked_leader = pick(candidate_living_exps)
else
earmarked_leader = pick(candidates)
ert_operative.mind.add_antag_datum(ert_antag,ert_team)
ert_operative.mind.set_assigned_role(SSjob.get_job_type(ert_antag.ert_job_path))
var/spawn_index = 0
while(numagents && candidates.len)
var/turf/spawnloc
if(length(spawn_turfs))
spawnloc = pick(spawn_turfs)
else
spawnloc = spawn_points[spawn_index+1]
spawn_index = WRAP_UP(spawn_index, spawn_points.len)
//Logging and cleanup
ert_operative.log_message("has been selected as \a [ert_antag.name].", LOG_GAME)
numagents--
teamSpawned++
var/mob/dead/observer/chosen_candidate = earmarked_leader || pick(candidates) // this way we make sure that our leader gets chosen
candidates -= chosen_candidate
if(!chosen_candidate?.key)
continue
if (teamSpawned)
message_admins("[ertemplate.polldesc] has spawned with the mission: [ertemplate.mission]")
//Spawn the body
var/mob/living/carbon/human/ert_operative
if(ertemplate.mob_type)
ert_operative = new ertemplate.mob_type(spawnloc)
else
ert_operative = new /mob/living/carbon/human(spawnloc)
chosen_candidate.client.prefs.safe_transfer_prefs_to(ert_operative, is_antag = TRUE)
ert_operative.PossessByPlayer(chosen_candidate.key)
//Open the Armory doors
if(ertemplate.opendoors)
for(var/obj/machinery/door/poddoor/ert/door as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/door/poddoor/ert))
door.open()
CHECK_TICK
return TRUE
if(ertemplate.enforce_human || !(ert_operative.dna.species.changesource_flags & ERT_SPAWN))
ert_operative.set_species(/datum/species/human)
return
//Give antag datum
var/datum/antagonist/ert/ert_antag
if((chosen_candidate == earmarked_leader) || (numagents == 1 && !leader_spawned))
ert_antag = new ertemplate.leader_role ()
earmarked_leader = null
leader_spawned = TRUE
else
ert_antag = ertemplate.roles[WRAP(numagents,1,length(ertemplate.roles) + 1)]
ert_antag = new ert_antag ()
ert_antag.random_names = ertemplate.random_names
ert_operative.mind.add_antag_datum(ert_antag,ert_team)
ert_operative.mind.set_assigned_role(SSjob.get_job_type(ert_antag.ert_job_path))
//Logging and cleanup
ert_operative.log_message("has been selected as \a [ert_antag.name].", LOG_GAME)
numagents--
team_spawned++
if (team_spawned != 0)
message_admins("[ertemplate.polldesc] has spawned with the mission: [ertemplate.mission]")
//Open the Armory doors
if(ertemplate.opendoors)
for(var/obj/machinery/door/poddoor/ert/door as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/door/poddoor/ert))
door.open()
CHECK_TICK
return TRUE
ADMIN_VERB(summon_ert, R_FUN, "Summon ERT", "Summons an emergency response team.", ADMIN_CATEGORY_FUN)
message_admins("[key_name_admin(user)] is creating a CentCom response team...")
if(user.holder?.makeEmergencyresponseteam())
if(user.holder?.make_emergency_response_team())
message_admins("[key_name_admin(user)] created a CentCom response team.")
log_admin("[key_name(user)] created a CentCom response team.")
else
+41 -52
View File
@@ -47,7 +47,6 @@ ADMIN_VERB(secrets, R_NONE, "Secrets", "Abuse harder than you ever have before w
return
if((action != "admin_log" || action != "show_admins") && !check_rights(R_ADMIN))
return
var/datum/round_event/E
switch(action)
//Generic Buttons anyone can use.
if("admin_log")
@@ -419,57 +418,59 @@ ADMIN_VERB(secrets, R_NONE, "Secrets", "Abuse harder than you ever have before w
)
message_admins("[key_name(holder)] is creating a custom portal storm...")
var/list/prefreturn = presentpreflikepicker(holder,"Customize Portal Storm", "Customize Portal Storm", Button1="Ok", width = 600, StealFocus = 1,Timeout = 0, settings=settings)
var/list/pref_return = present_pref_like_picker(holder, "Customize Portal Storm", "Customize Portal Storm", width = 600, timeout = 0, settings = settings)
if (prefreturn["button"] == 1)
var/list/prefs = settings["mainsettings"]
if (pref_return["button"] != 1)
return
if (prefs["amount"]["value"] < 1 || prefs["portalnum"]["value"] < 1)
to_chat(holder, span_warning("Number of portals and mobs to spawn must be at least 1."), confidential = TRUE)
return
var/list/prefs = settings["mainsettings"]
var/mob/pathToSpawn = prefs["typepath"]["value"]
if (!ispath(pathToSpawn))
pathToSpawn = text2path(pathToSpawn)
if (prefs["amount"]["value"] < 1 || prefs["portalnum"]["value"] < 1)
to_chat(holder, span_warning("Number of portals and mobs to spawn must be at least 1."), confidential = TRUE)
return
if (!ispath(pathToSpawn))
to_chat(holder, span_notice("Invalid path [pathToSpawn]."), confidential = TRUE)
return
var/mob/path_to_spawn = prefs["typepath"]["value"]
if (!ispath(path_to_spawn))
path_to_spawn = text2path(path_to_spawn)
var/list/candidates = list()
if (!ispath(path_to_spawn))
to_chat(holder, span_notice("Invalid path [path_to_spawn]."), confidential = TRUE)
return
if (prefs["offerghosts"]["value"] == "Yes")
candidates = SSpolling.poll_ghost_candidates(replacetext(prefs["ghostpoll"]["value"], "%TYPE%", initial(pathToSpawn.name)), check_jobban = ROLE_TRAITOR, alert_pic = pathToSpawn, role_name_text = "portal storm")
var/list/candidates = list()
if (prefs["playersonly"]["value"] == "Yes" && length(candidates) < prefs["minplayers"]["value"])
if (prefs["offerghosts"]["value"] == "Yes")
candidates = SSpolling.poll_ghost_candidates(replacetext(prefs["ghostpoll"]["value"], "%TYPE%", initial(path_to_spawn.name)), check_jobban = ROLE_TRAITOR, alert_pic = path_to_spawn, role_name_text = "portal storm")
if (length(candidates) < prefs["minplayers"]["value"])
message_admins("Not enough players signed up to create a portal storm, the minimum was [prefs["minplayers"]["value"]] and the number of signups [length(candidates)]")
return
if (prefs["announce_players"]["value"] == "Yes")
portalAnnounce(prefs["announcement"]["value"], (prefs["playlightning"]["value"] == "Yes" ? TRUE : FALSE))
if (prefs["announce_players"]["value"] == "Yes")
portal_announce(prefs["announcement"]["value"], (prefs["playlightning"]["value"] == "Yes" ? TRUE : FALSE))
var/list/storm_appearances = list()
for(var/offset in 0 to SSmapping.max_plane_offset)
var/mutable_appearance/storm = mutable_appearance('icons/obj/machines/engine/energy_ball.dmi', "energy_ball_fast", FLY_LAYER)
SET_PLANE_W_SCALAR(storm, ABOVE_GAME_PLANE, offset)
storm.color = prefs["color"]["value"]
storm_appearances += storm
var/list/storm_appearances = list()
for(var/offset in 0 to SSmapping.max_plane_offset)
var/mutable_appearance/storm = mutable_appearance('icons/obj/machines/engine/energy_ball.dmi', "energy_ball_fast", FLY_LAYER)
SET_PLANE_W_SCALAR(storm, ABOVE_GAME_PLANE, offset)
storm.color = prefs["color"]["value"]
storm_appearances += storm
message_admins("[key_name_admin(holder)] has created a customized portal storm that will spawn [prefs["portalnum"]["value"]] portals, each of them spawning [prefs["amount"]["value"]] of [pathToSpawn]")
log_admin("[key_name(holder)] has created a customized portal storm that will spawn [prefs["portalnum"]["value"]] portals, each of them spawning [prefs["amount"]["value"]] of [pathToSpawn]")
message_admins("[key_name_admin(holder)] has created a customized portal storm that will spawn [prefs["portalnum"]["value"]] portals, each of them spawning [prefs["amount"]["value"]] of [path_to_spawn]")
log_admin("[key_name(holder)] has created a customized portal storm that will spawn [prefs["portalnum"]["value"]] portals, each of them spawning [prefs["amount"]["value"]] of [path_to_spawn]")
var/outfit = prefs["humanoutfit"]["value"]
if (!ispath(outfit))
outfit = text2path(outfit)
var/outfit = prefs["humanoutfit"]["value"]
if (!ispath(outfit))
outfit = text2path(outfit)
for (var/i in 1 to prefs["portalnum"]["value"])
if (length(candidates)) // if we're spawning players, gotta be a little tricky and also not spawn players on top of NPCs
var/ghostcandidates = list()
for (var/j in 1 to min(prefs["amount"]["value"], length(candidates)))
ghostcandidates += pick_n_take(candidates)
addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(do_portal_spawn), get_random_station_turf(), path_to_spawn, length(ghostcandidates), storm_appearances, ghostcandidates, outfit), i * prefs["delay"]["value"])
else if (prefs["playersonly"]["value"] != "Yes")
addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(do_portal_spawn), get_random_station_turf(), path_to_spawn, prefs["amount"]["value"], storm_appearances, null, outfit), i * prefs["delay"]["value"])
for (var/i in 1 to prefs["portalnum"]["value"])
if (length(candidates)) // if we're spawning players, gotta be a little tricky and also not spawn players on top of NPCs
var/ghostcandidates = list()
for (var/j in 1 to min(prefs["amount"]["value"], length(candidates)))
ghostcandidates += pick_n_take(candidates)
addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(doPortalSpawn), get_random_station_turf(), pathToSpawn, length(ghostcandidates), storm_appearances, ghostcandidates, outfit), i*prefs["delay"]["value"])
else if (prefs["playersonly"]["value"] != "Yes")
addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(doPortalSpawn), get_random_station_turf(), pathToSpawn, prefs["amount"]["value"], storm_appearances, null, outfit), i*prefs["delay"]["value"])
if("changebombcap")
if(!is_funmin)
return
@@ -680,24 +681,12 @@ ADMIN_VERB(secrets, R_NONE, "Secrets", "Abuse harder than you ever have before w
message_admins("[key_name_admin(holder)] healed everyone.")
log_admin("[key_name(holder)] healed everyone.")
if(E)
E.processing = FALSE
if(E.announce_when>0)
switch(tgui_alert(holder, "Would you like to alert the crew?", "Alert", list("Yes", "No", "Cancel")))
if("Yes")
E.announce_chance = 100
if("Cancel")
E.kill()
return
if("No")
E.announce_chance = 0
E.processing = TRUE
if(holder)
log_admin("[key_name(holder)] used secret: [action].")
#undef THUNDERDOME_TEMPLATE_FILE
#undef HIGHLANDER_DELAY_TEXT
/proc/portalAnnounce(announcement, playlightning)
/proc/portal_announce(announcement, playlightning)
set waitfor = FALSE
if (playlightning)
sound_to_playing_players('sound/effects/magic/lightning_chargeup.ogg')
@@ -709,7 +698,7 @@ ADMIN_VERB(secrets, R_NONE, "Secrets", "Abuse harder than you ever have before w
/// Spawns a portal storm that spawns in sentient/non sentient mobs
/// portal_appearance is a list in the form (turf's plane offset + 1) -> appearance to use
/proc/doPortalSpawn(turf/loc, mobtype, numtospawn, list/portal_appearance, players, humanoutfit)
/proc/do_portal_spawn(turf/loc, mobtype, numtospawn, list/portal_appearance, players, humanoutfit)
for (var/i in 1 to numtospawn)
var/mob/spawnedMob = new mobtype(loc)
if (length(players))
+33 -31
View File
@@ -64,44 +64,46 @@ ADMIN_VERB(spawn_obj_as_mob, R_SPAWN, "Spawn Object-Mob", "Spawn an object as if
),
))
var/list/prefreturn = presentpreflikepicker(user.mob,"Customize mob", "Customize mob", Button1="Ok", width = 450, StealFocus = 1,Timeout = 0, settings=settings)
if (prefreturn["button"] == 1)
settings = prefreturn["settings"]
var/mainsettings = settings["mainsettings"]
chosen_obj = text2path(mainsettings["objtype"]["value"])
var/list/pref_return = present_pref_like_picker(user.mob, "Customize mob", "Customize mob", width = 450, timeout = 0, settings = settings)
if (pref_return["button"] != 1)
return
basemob = text2path(mainsettings["mobtype"]["value"])
if (!ispath(basemob, /mob/living/basic/mimic/copy) || !ispath(chosen_obj, /obj))
to_chat(user.mob, "Mob or object path invalid", confidential = TRUE)
settings = pref_return["settings"]
var/mainsettings = settings["mainsettings"]
chosen_obj = text2path(mainsettings["objtype"]["value"])
basemob = new basemob(get_turf(user.mob), new chosen_obj(get_turf(user.mob)), user.mob, mainsettings["dropitem"]["value"] == "Yes" ? FALSE : TRUE, (mainsettings["googlyeyes"]["value"] == "Yes" ? FALSE : TRUE))
basemob = text2path(mainsettings["mobtype"]["value"])
if (!ispath(basemob, /mob/living/basic/mimic/copy) || !ispath(chosen_obj, /obj))
to_chat(user.mob, "Mob or object path invalid", confidential = TRUE)
if (mainsettings["disableai"]["value"] == "Yes")
qdel(basemob.ai_controller)
basemob.ai_controller = null
basemob = new basemob(get_turf(user.mob), new chosen_obj(get_turf(user.mob)), user.mob, mainsettings["dropitem"]["value"] == "Yes" ? FALSE : TRUE, (mainsettings["googlyeyes"]["value"] == "Yes" ? FALSE : TRUE))
if (mainsettings["idledamage"]["value"] == "No")
basemob.idledamage = FALSE
if (mainsettings["disableai"]["value"] == "Yes")
qdel(basemob.ai_controller)
basemob.ai_controller = null
if (mainsettings["access"])
var/newaccess = text2path(mainsettings["access"]["value"])
if (ispath(newaccess))
var/obj/item/card/id/id = new newaccess //cant do initial on lists
basemob.AddComponent(/datum/component/simple_access, id.access)
qdel(id)
if (mainsettings["idledamage"]["value"] == "No")
basemob.idledamage = FALSE
if (mainsettings["maxhealth"]["value"])
if (!isnum(mainsettings["maxhealth"]["value"]))
mainsettings["maxhealth"]["value"] = text2num(mainsettings["maxhealth"]["value"])
if (mainsettings["maxhealth"]["value"] > 0)
basemob.maxHealth = basemob.maxHealth = mainsettings["maxhealth"]["value"]
if (mainsettings["access"])
var/newaccess = text2path(mainsettings["access"]["value"])
if (ispath(newaccess))
var/obj/item/card/id/id = new newaccess //cant do initial on lists
basemob.AddComponent(/datum/component/simple_access, id.access)
qdel(id)
if (mainsettings["name"]["value"])
basemob.name = basemob.real_name = html_decode(mainsettings["name"]["value"])
if (mainsettings["maxhealth"]["value"])
if (!isnum(mainsettings["maxhealth"]["value"]))
mainsettings["maxhealth"]["value"] = text2num(mainsettings["maxhealth"]["value"])
if (mainsettings["maxhealth"]["value"] > 0)
basemob.maxHealth = basemob.maxHealth = mainsettings["maxhealth"]["value"]
if (mainsettings["ckey"]["value"] != "none")
basemob.ckey = mainsettings["ckey"]["value"]
if (mainsettings["name"]["value"])
basemob.name = basemob.real_name = html_decode(mainsettings["name"]["value"])
if (mainsettings["ckey"]["value"] != "none")
basemob.ckey = mainsettings["ckey"]["value"]
log_admin("[key_name(user.mob)] spawned a sentient object-mob [basemob] from [chosen_obj] at [AREACOORD(user.mob)]")
BLACKBOX_LOG_ADMIN_VERB("Spawn object-mob")
log_admin("[key_name(user.mob)] spawned a sentient object-mob [basemob] from [chosen_obj] at [AREACOORD(user.mob)]")
BLACKBOX_LOG_ADMIN_VERB("Spawn object-mob")