Merge branch 'master' of https://github.com/Citadel-Station-13/Citadel-Station-13 into proc-define-shit

This commit is contained in:
SandPoot
2024-03-08 19:10:22 -03:00
810 changed files with 140372 additions and 5523 deletions
+2 -2
View File
@@ -11,9 +11,9 @@
* @code
/hook/foo/proc/bar()
if(1)
return 1 //Sucessful
return TRUE //Sucessful
else
return 0 //Error, or runtime.
return FALSE //Error, or runtime.
* @endcode
* All hooks must return nonzero on success, as runtimes will force return null.
*/
+2 -2
View File
@@ -129,7 +129,7 @@ GLOBAL_REAL(Master, /datum/controller/master) = new
/proc/Recreate_MC()
. = -1 //so if we runtime, things know we failed
if (world.time < Master.restart_timeout)
return 0
return FALSE
if (world.time < Master.restart_clear)
Master.restart_count *= 0.5
@@ -142,7 +142,7 @@ GLOBAL_REAL(Master, /datum/controller/master) = new
new/datum/controller/master()
catch
return -1
return 1
return TRUE
/datum/controller/master/Recover()
+1 -1
View File
@@ -48,7 +48,7 @@ SUBSYSTEM_DEF(activity)
/datum/controller/subsystem/activity/proc/get_average_threat()
if(!length(threat_history))
return 0
return FALSE
var/total_weight = 0
var/total_amt = 0
for(var/i in 1 to threat_history.len-1)
+3 -3
View File
@@ -69,15 +69,15 @@ SUBSYSTEM_DEF(augury)
SSaugury.watchers += owner
to_chat(owner, "<span class='notice'>You are now auto-following debris.</span>")
active = TRUE
UpdateButtonIcon()
UpdateButtons()
/datum/action/innate/augury/Deactivate()
SSaugury.watchers -= owner
to_chat(owner, "<span class='notice'>You are no longer auto-following debris.</span>")
active = FALSE
UpdateButtonIcon()
UpdateButtons()
/datum/action/innate/augury/UpdateButtonIcon(status_only = FALSE, force)
/datum/action/innate/augury/UpdateButton(atom/movable/screen/movable/action_button/button, status_only = FALSE, force)
..()
if(active)
button.icon_state = "template_active"
+1 -1
View File
@@ -55,6 +55,6 @@ PROCESSING_SUBSYSTEM_DEF(dcs)
fullid += "[key]"
if(length(named_arguments))
named_arguments = sortList(named_arguments)
named_arguments = sort_list(named_arguments)
fullid += named_arguments
return list2params(fullid)
+9 -9
View File
@@ -47,7 +47,7 @@ SUBSYSTEM_DEF(job)
var/list/all_jobs = subtypesof(/datum/job)
if(!all_jobs.len)
to_chat(world, "<span class='boldannounce'>Error setting up jobs, no job datums found</span>")
return 0
return FALSE
for(var/J in all_jobs)
var/datum/job/job = new J()
@@ -65,7 +65,7 @@ SUBSYSTEM_DEF(job)
name_occupations[job.title] = job
type_occupations[J] = job
return 1
return TRUE
/datum/controller/subsystem/job/proc/GetJob(rank)
@@ -199,8 +199,8 @@ SUBSYSTEM_DEF(job)
continue
var/mob/dead/new_player/candidate = pick(candidates)
if(AssignRole(candidate, command_position))
return 1
return 0
return TRUE
return FALSE
//This proc is called at the start of the level loop of DivideOccupations() and will cause head jobs to be checked before any other jobs of the same level
@@ -222,7 +222,7 @@ SUBSYSTEM_DEF(job)
var/ai_selected = 0
var/datum/job/job = GetJob("AI")
if(!job)
return 0
return FALSE
for(var/i = job.total_positions, i > 0, i--)
for(var/level in level_order)
var/list/candidates = list()
@@ -233,8 +233,8 @@ SUBSYSTEM_DEF(job)
ai_selected++
break
if(ai_selected)
return 1
return 0
return TRUE
return FALSE
/** Proc DivideOccupations
@@ -599,8 +599,8 @@ SUBSYSTEM_DEF(job)
if(hpc || epc)
var/relevent_cap = max(hpc, epc)
if((initial_players_to_assign - unassigned.len) >= relevent_cap)
return 1
return 0
return TRUE
return FALSE
/datum/controller/subsystem/job/proc/RejectPlayer(mob/dead/new_player/player)
if(player.mind && player.mind.special_role)
+1 -1
View File
@@ -423,7 +423,7 @@ GLOBAL_LIST_EMPTY(the_station_areas)
banned += generateMapList("[global.config.directory]/iceruinblacklist.txt")
banned += generateMapList("[global.config.directory]/stationruinblacklist.txt")
for(var/item in sortList(subtypesof(/datum/map_template/ruin), GLOBAL_PROC_REF(cmp_ruincost_priority)))
for(var/item in sort_list(subtypesof(/datum/map_template/ruin), GLOBAL_PROC_REF(cmp_ruincost_priority)))
var/datum/map_template/ruin/ruin_type = item
// screen out the abstract subtypes
if(!initial(ruin_type.id))
+1 -1
View File
@@ -36,7 +36,7 @@ SUBSYSTEM_DEF(pathfinder)
flow[t] = M
return free
else
return 0
return FALSE
/datum/flowcache/proc/toolong(l)
log_game("Pathfinder route took longer than 150 ticks, src bot [flow[flow[l]]]")
@@ -22,7 +22,7 @@ PROCESSING_SUBSYSTEM_DEF(quirks)
/datum/controller/subsystem/processing/quirks/proc/SetupQuirks()
// Sort by Positive, Negative, Neutral; and then by name
var/list/quirk_list = sortList(subtypesof(/datum/quirk), GLOBAL_PROC_REF(cmp_quirk_asc))
var/list/quirk_list = sort_list(subtypesof(/datum/quirk), GLOBAL_PROC_REF(cmp_quirk_asc))
for(var/V in quirk_list)
var/datum/quirk/T = V
+1 -1
View File
@@ -25,7 +25,7 @@ SUBSYSTEM_DEF(radio)
if(frequency)
frequency.remove_listener(device)
// let's don't delete frequencies in case a non-listener keeps a reference
return 1
return TRUE
/datum/controller/subsystem/radio/proc/return_frequency(new_frequency as num)
var/f_text = num2text(new_frequency)
+1 -1
View File
@@ -358,7 +358,7 @@ SUBSYSTEM_DEF(research)
/datum/controller/subsystem/research/proc/calculate_server_coefficient() //Diminishing returns.
var/amt = servers.len
if(!amt)
return 0
return FALSE
var/coeff = 100
coeff = sqrt(coeff / amt)
return coeff
+6 -6
View File
@@ -294,7 +294,7 @@ SUBSYSTEM_DEF(shuttle)
log_shuttle("[key_name(user)] has recalled the shuttle.")
message_admins("[ADMIN_LOOKUPFLW(user)] has recalled the shuttle.")
deadchat_broadcast(" has recalled the shuttle from [span_name("[get_area_name(user, TRUE)]")].", span_name("[user.real_name]"), user, message_type=DEADCHAT_ANNOUNCEMENT)
return 1
return TRUE
/datum/controller/subsystem/shuttle/proc/canRecall()
if(!emergency || emergency.mode != SHUTTLE_CALL || emergencyNoRecall || SSticker.mode.name == "meteor")
@@ -400,7 +400,7 @@ SUBSYSTEM_DEF(shuttle)
/datum/controller/subsystem/shuttle/proc/toggleShuttle(shuttleId, dockHome, dockAway, timed)
var/obj/docking_port/mobile/M = getShuttle(shuttleId)
if(!M)
return 1
return TRUE
var/obj/docking_port/stationary/dockedAt = M.get_docked()
var/destination = dockHome
if(dockedAt && dockedAt.id == dockHome)
@@ -411,7 +411,7 @@ SUBSYSTEM_DEF(shuttle)
else
if(M.initiate_docking(getDock(destination)) != DOCKING_SUCCESS)
return 2
return 0 //dock successful
return FALSE //dock successful
/datum/controller/subsystem/shuttle/proc/moveShuttle(shuttleId, dockId, timed)
@@ -419,14 +419,14 @@ SUBSYSTEM_DEF(shuttle)
var/obj/docking_port/stationary/D = getDock(dockId)
if(!M)
return 1
return TRUE
if(timed)
if(M.request(D))
return 2
else
if(M.initiate_docking(D) != DOCKING_SUCCESS)
return 2
return 0 //dock successful
return FALSE //dock successful
/datum/controller/subsystem/shuttle/proc/request_transit_dock(obj/docking_port/mobile/M)
if(!istype(M))
@@ -825,7 +825,7 @@ SUBSYSTEM_DEF(shuttle)
templates[S.port_id]["templates"] += list(L)
data["templates_tabs"] = sortList(data["templates_tabs"])
data["templates_tabs"] = sort_list(data["templates_tabs"])
data["existing_shuttle"] = null
+58 -36
View File
@@ -41,37 +41,61 @@ SUBSYSTEM_DEF(throwing)
currentrun = null
/datum/thrownthing
///Defines the atom that has been thrown (Objects and Mobs, mostly.)
var/atom/movable/thrownthing
var/atom/target
///Weakref to the original intended target of the throw, to prevent hardDels
var/datum/weakref/initial_target
///The turf that the target was on, if it's not a turf itself.
var/turf/target_turf
///If the target happens to be a carbon and that carbon has a body zone aimed at, this is carried on here.
var/target_zone
///The initial direction of the thrower of the thrownthing for building the trajectory of the throw.
var/init_dir
///The maximum number of turfs that the thrownthing will travel to reach it's target.
var/maxrange
///The speed of the projectile thrownthing being thrown.
var/speed
///If a mob is the one who has thrown the object, then it's moved here.
var/mob/thrower
///A variable that helps in describing objects thrown at an angle, if it should be moved diagonally first or last.
var/diagonals_first
var/dist_travelled = 0
var/start_time
var/dist_x
var/dist_y
var/dx
var/dy
var/force = MOVE_FORCE_DEFAULT
var/gentle = FALSE
///Set to TRUE if the throw is exclusively diagonal (45 Degree angle throws for example)
var/pure_diagonal
///Tracks how far a thrownthing has traveled mid-throw for the purposes of maxrange
var/dist_travelled = 0
///The start_time obtained via world.time for the purposes of tiles moved/tick.
var/start_time
///Distance to travel in the X axis/direction.
var/dist_x
///Distance to travel in the y axis/direction.
var/dist_y
///The Horizontal direction we're traveling (EAST or WEST)
var/dx
///The VERTICAL direction we're traveling (NORTH or SOUTH)
var/dy
///The movement force provided to a given object in transit. More info on these in move_force.dm
var/force = MOVE_FORCE_DEFAULT
///If the throw is gentle, then the thrownthing is harmless on impact.
var/gentle = FALSE
///How many tiles that need to be moved in order to travel to the target.
var/diagonal_error
///If a thrown thing has a callback, it can be invoked here within thrownthing.
var/datum/callback/callback
///Mainly exists for things that would freeze a thrown object in place, like a timestop'd tile. Or a Tractor Beam.
var/paused = FALSE
///How long an object has been paused for, to be added to the travel time.
var/delayed_time = 0
///The last world.time value stored when the thrownthing was moving.
var/last_move = 0
/datum/thrownthing/New(thrownthing, target, target_turf, init_dir, maxrange, speed, thrower, diagonals_first, force, gentle, callback, target_zone)
/datum/thrownthing/New(thrownthing, target, init_dir, maxrange, speed, thrower, diagonals_first, force, gentle, callback, target_zone)
. = ..()
src.thrownthing = thrownthing
RegisterSignal(thrownthing, COMSIG_PARENT_QDELETING, PROC_REF(on_thrownthing_qdel))
src.target = target
src.target_turf = target_turf
src.target_turf = get_turf(target)
if(target_turf != target)
src.initial_target = WEAKREF(target)
src.init_dir = init_dir
src.maxrange = maxrange
src.speed = speed
@@ -90,8 +114,8 @@ SUBSYSTEM_DEF(throwing)
SSthrowing.currentrun -= thrownthing
thrownthing.throwing = null
thrownthing = null
target = null
thrower = null
initial_target = null
if(callback)
QDEL_NULL(callback) //It stores a reference to the thrownthing, its source. Let's clean that.
return ..()
@@ -114,9 +138,17 @@ SUBSYSTEM_DEF(throwing)
delayed_time += world.time - last_move
return
if (dist_travelled && hitcheck()) //to catch sneaky things moving on our tile while we slept
finalize()
return
var/atom/movable/actual_target = initial_target?.resolve()
if(dist_travelled) //to catch sneaky things moving on our tile while we slept
for(var/atom/movable/obstacle as anything in get_turf(thrownthing))
if (obstacle == thrownthing || (obstacle == thrower && !ismob(thrownthing)))
continue
if(obstacle.pass_flags_self & LETPASSTHROW)
continue
if (obstacle == actual_target || (obstacle.density && !(obstacle.flags_1 & ON_BORDER_1)))
finalize(TRUE, obstacle)
return
var/atom/step
@@ -143,14 +175,17 @@ SUBSYSTEM_DEF(throwing)
finalize()
return
AM.Move(step, get_dir(AM, step), DELAY_TO_GLIDE_SIZE(1 / speed))
if (!AM.throwing) // we hit something during our move
finalize(hit = TRUE)
if(!AM.Move(step, get_dir(AM, step), DELAY_TO_GLIDE_SIZE(1 / speed))) // we hit something during our move...
if(AM.throwing) // ...but finalize() wasn't called on Bump() because of a higher level definition that doesn't always call parent.
finalize()
return
dist_travelled++
if(actual_target && !(actual_target.pass_flags_self & LETPASSTHROW) && actual_target.loc == AM.loc) // we crossed a movable with no density (e.g. a mouse or APC) we intend to hit anyway.
finalize(TRUE, actual_target)
return
if (dist_travelled > MAX_THROWING_DIST)
finalize()
return
@@ -162,11 +197,10 @@ SUBSYSTEM_DEF(throwing)
return
thrownthing.throwing = null
if (!hit)
for (var/thing in get_turf(thrownthing)) //looking for our target on the turf we land on.
var/atom/A = thing
if (A == target)
for (var/atom/movable/obstacle as anything in get_turf(thrownthing)) //looking for our target on the turf we land on.
if (obstacle == target)
hit = TRUE
thrownthing.throw_impact(A, src)
thrownthing.throw_impact(obstacle, src)
if(QDELETED(thrownthing)) //throw_impact can delete things, such as glasses smashing
return //deletion should already be handled by on_thrownthing_qdel()
break
@@ -192,15 +226,3 @@ SUBSYSTEM_DEF(throwing)
T.zFall(thrownthing)
qdel(src)
/datum/thrownthing/proc/hit_atom(atom/A)
finalize(hit=TRUE, target=A)
/datum/thrownthing/proc/hitcheck()
for (var/thing in get_turf(thrownthing))
var/atom/movable/AM = thing
if (AM == thrownthing || (AM == thrower && !ismob(thrownthing)))
continue
if (AM.density && !(AM.pass_flags_self & LETPASSTHROW) && !(AM.flags_1 & ON_BORDER_1))
finalize(hit=TRUE, target=AM)
return TRUE
+3 -3
View File
@@ -245,7 +245,7 @@ SUBSYSTEM_DEF(ticker)
mode = null
SSjob.ResetOccupations()
emergency_swap++
return 0
return FALSE
CHECK_TICK
//Configure mode and assign player to special mode stuff
@@ -264,7 +264,7 @@ SUBSYSTEM_DEF(ticker)
to_chat(world, "<B>Error setting up [GLOB.master_mode].</B> Reverting to pre-game lobby.")
SSjob.ResetOccupations()
emergency_swap++
return 0
return FALSE
else
message_admins("<span class='notice'>DEBUG: Bypassing prestart checks...</span>")
@@ -273,7 +273,7 @@ SUBSYSTEM_DEF(ticker)
var/list/modes = new
for (var/datum/game_mode/M in runnable_modes)
modes += M.name
modes = sortList(modes)
modes = sort_list(modes)
to_chat(world, "<b>The gamemode is: secret!\nPossibilities:</B> [english_list(modes)]")
else
mode.announce()*/
+2 -2
View File
@@ -100,7 +100,7 @@ SUBSYSTEM_DEF(traumas)
/obj/item/clothing/suit/space/hardsuit/ert/engi, /obj/item/clothing/suit/space/hardsuit/ert/med,
/obj/item/clothing/suit/space/hardsuit/deathsquad, /obj/item/clothing/head/helmet/space/hardsuit/deathsquad,
/obj/machinery/door/airlock/centcom)),
"robots" = typecacheof(list(/obj/machinery/computer/upload, /obj/item/aiModule/, /obj/machinery/recharge_station,
"robots" = typecacheof(list(/obj/machinery/computer/upload, /obj/item/ai_module/, /obj/machinery/recharge_station,
/obj/item/aicard, /obj/item/deactivated_swarmer, /obj/effect/mob_spawn/swarmer)),
"doctors" = typecacheof(list(/obj/item/clothing/under/rank/medical/doctor, /obj/item/clothing/under/rank/medical/chemist,
@@ -170,7 +170,7 @@ SUBSYSTEM_DEF(traumas)
/obj/item/gun/ballistic/automatic/shotgun/bulldog, /obj/item/gun/ballistic/automatic/c20r, /obj/item/gun/ballistic/automatic/m90, /obj/item/gun/ballistic/automatic/l6_saw, /obj/item/storage/belt/grenade/full, /obj/item/gun/ballistic/automatic/sniper_rifle/syndicate, /obj/item/gun/energy/kinetic_accelerator/crossbow,
/obj/item/melee/transforming/energy/sword/saber, /obj/item/dualsaber, /obj/item/melee/powerfist, /obj/item/storage/box/syndie_kit, /obj/item/grenade/spawnergrenade/manhacks, /obj/item/grenade/chem_grenade/bioterrorfoam, /obj/item/reagent_containers/spray/chemsprayer/bioterror, /obj/item/ammo_box/magazine/m10mm,
/obj/item/ammo_box/magazine/pistolm9mm, /obj/item/ammo_box/a357, /obj/item/ammo_box/magazine/m12g, /obj/item/ammo_box/magazine/mm712x82, /obj/item/antag_spawner/nuke_ops, /obj/vehicle/sealed/mecha/combat/gygax/dark, /obj/vehicle/sealed/mecha/combat/marauder/mauler, /obj/item/soap/syndie, /obj/item/gun/syringe/syndicate, /obj/item/cartridge/virus/syndicate,
/obj/item/cartridge/virus/frame, /obj/item/chameleon, /obj/item/storage/box/syndie_kit/cutouts, /obj/item/clothing/suit/space/hardsuit/syndi, /obj/item/card/emag, /obj/item/storage/toolbox/syndicate, /obj/item/storage/book/bible/syndicate, /obj/item/encryptionkey/binary, /obj/item/encryptionkey/syndicate, /obj/item/aiModule/syndicate,
/obj/item/cartridge/virus/frame, /obj/item/chameleon, /obj/item/storage/box/syndie_kit/cutouts, /obj/item/clothing/suit/space/hardsuit/syndi, /obj/item/card/emag, /obj/item/storage/toolbox/syndicate, /obj/item/storage/book/bible/syndicate, /obj/item/encryptionkey/binary, /obj/item/encryptionkey/syndicate, /obj/item/ai_module/syndicate,
/obj/item/clothing/shoes/magboots/syndie, /obj/item/powersink, /obj/item/sbeacondrop, /obj/item/sbeacondrop/bomb, /obj/item/syndicatedetonator, /obj/item/shield/energy, /obj/item/assault_pod, /obj/item/slimepotion/slime/sentience/nuclear, /obj/item/stack/telecrystal, /obj/item/jammer, /obj/item/codespeak_manual/unlimited,
/obj/item/toy/cards/deck/syndicate, /obj/item/storage/secure/briefcase/syndie, /obj/item/storage/fancy/cigarettes/cigpack_syndicate, /obj/item/toy/syndicateballoon, /obj/item/clothing/gloves/fingerless/pugilist/rapid, /obj/item/paper/fluff/ruins/thederelict/syndie_mission, /obj/item/organ/cyberimp/eyes/hud/security/syndicate, /obj/item/clothing/head/HoS/syndicate,
/obj/machinery/computer/pod/old/syndicate, /obj/machinery/vending/medical/syndicate_access, /obj/item/mmi/syndie, /obj/item/target/syndicate, /obj/machinery/vending/cigarette/syndicate, /obj/item/robot_module/syndicate, /obj/item/clothing/mask/gas/syndicate, /obj/machinery/power/singularity_beacon/syndicate, /obj/item/clothing/head/syndicatefake,
+9 -9
View File
@@ -373,7 +373,7 @@ SUBSYSTEM_DEF(vote)
/datum/controller/subsystem/vote/proc/submit_vote(vote, score = 0)
if(mode)
if(CONFIG_GET(flag/no_dead_vote) && usr.stat == DEAD && !usr.client.holder)
return 0
return FALSE
if(vote && ISINRANGE(vote, 1, choices.len))
switch(vote_system)
if(PLURALITY_VOTING)
@@ -415,7 +415,7 @@ SUBSYSTEM_DEF(vote)
voted[usr.ckey] = list()
voted[usr.ckey][choices[vote]] = score
saved -= usr.ckey
return 0
return FALSE
/datum/controller/subsystem/vote/proc/initiate_vote(vote_type, initiator_key, display = display_votes, votesystem = PLURALITY_VOTING, forced = FALSE,vote_time = -1)//CIT CHANGE - adds display argument to votes to allow for obfuscated votes
vote_system = votesystem
@@ -424,7 +424,7 @@ SUBSYSTEM_DEF(vote)
var/next_allowed_time = (started_time + CONFIG_GET(number/vote_delay))
if(mode)
to_chat(usr, "<span class='warning'>There is already a vote in progress! please wait for it to finish.</span>")
return 0
return FALSE
var/admin = FALSE
var/ckey = ckey(initiator_key)
@@ -433,7 +433,7 @@ SUBSYSTEM_DEF(vote)
if(next_allowed_time > world.time && !admin)
to_chat(usr, "<span class='warning'>A vote was initiated recently, you must wait [DisplayTimeText(next_allowed_time-world.time)] before a new vote can be started!</span>")
return 0
return FALSE
SEND_SOUND(world, sound('sound/misc/notice2.ogg'))
reset()
@@ -464,7 +464,7 @@ SUBSYSTEM_DEF(vote)
if("custom")
question = stripped_input(usr,"What is the vote for?")
if(!question)
return 0
return FALSE
var/system_string = input(usr,"Which voting type?",GLOB.vote_type_names[1]) in GLOB.vote_type_names
vote_system = GLOB.vote_type_names[system_string]
for(var/i=1,i<=10,i++)
@@ -488,7 +488,7 @@ SUBSYSTEM_DEF(vote)
toggles ^= choices[chosen]
display_votes = toggles
else
return 0
return FALSE
mode = vote_type
initiator = initiator_key ? initiator_key : "the Server" // austation -- Crew autotransfer vote
started_time = world.time
@@ -521,8 +521,8 @@ SUBSYSTEM_DEF(vote)
popup.set_window_options("can_close=0")
popup.set_content(SSvote.interface(C))
popup.open(0)
return 1
return 0
return TRUE
return FALSE
/datum/controller/subsystem/vote/proc/interface(client/C)
if(!C)
@@ -736,7 +736,7 @@ SUBSYSTEM_DEF(vote)
Remove(owner)
/datum/action/vote/IsAvailable(silent = FALSE)
return 1
return TRUE
/datum/action/vote/proc/remove_from_client()
if(!owner)