mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
Add return type annotations to some procs, other lint fixes
This commit is contained in:
@@ -41,6 +41,12 @@
|
||||
//Create a list global that is initialized as an empty list
|
||||
#define GLOBAL_LIST_EMPTY(X) GLOBAL_LIST_INIT(X, list())
|
||||
|
||||
// Create a typed list global with an initializer expression
|
||||
#define GLOBAL_LIST_INIT_TYPED(X, Typepath, InitValue) GLOBAL_RAW(/list##Typepath/X); GLOBAL_MANAGED(X, InitValue)
|
||||
|
||||
// Create a typed list global that is initialized as an empty list
|
||||
#define GLOBAL_LIST_EMPTY_TYPED(X, Typepath) GLOBAL_LIST_INIT_TYPED(X, Typepath, list())
|
||||
|
||||
//Create a typed global with an initializer expression
|
||||
#define GLOBAL_DATUM_INIT(X, Typepath, InitValue) GLOBAL_RAW(Typepath/##X); GLOBAL_MANAGED(X, InitValue)
|
||||
|
||||
|
||||
13
code/__DEFINES/spaceman_dmm.dm
Normal file
13
code/__DEFINES/spaceman_dmm.dm
Normal file
@@ -0,0 +1,13 @@
|
||||
// Interfaces for the SpacemanDMM linter, define'd to nothing when the linter
|
||||
// is not in use.
|
||||
|
||||
// The SPACEMAN_DMM define is set by the linter and other tooling when it runs.
|
||||
#ifdef SPACEMAN_DMM
|
||||
#define RETURN_TYPE(X) set SpacemanDMM_return_type = X
|
||||
#define SHOULD_CALL_PARENT(X) set SpacemanDMM_should_call_parent = X
|
||||
#define UNLINT(X) SpacemanDMM_unlint(X)
|
||||
#else
|
||||
#define RETURN_TYPE(X)
|
||||
#define SHOULD_CALL_PARENT(X)
|
||||
#define UNLINT(X) X
|
||||
#endif
|
||||
@@ -124,6 +124,7 @@
|
||||
|
||||
//returns a new list with only atoms that are in typecache L
|
||||
/proc/typecache_filter_list(list/atoms, list/typecache)
|
||||
RETURN_TYPE(/list)
|
||||
. = list()
|
||||
for(var/thing in atoms)
|
||||
var/atom/A = thing
|
||||
@@ -131,6 +132,7 @@
|
||||
. += A
|
||||
|
||||
/proc/typecache_filter_list_reverse(list/atoms, list/typecache)
|
||||
RETURN_TYPE(/list)
|
||||
. = list()
|
||||
for(var/thing in atoms)
|
||||
var/atom/A = thing
|
||||
@@ -257,6 +259,7 @@
|
||||
|
||||
//Pick a random element from the list and remove it from the list.
|
||||
/proc/pick_n_take(list/L)
|
||||
RETURN_TYPE(L[_].type)
|
||||
if(L.len)
|
||||
var/picked = rand(1,L.len)
|
||||
. = L[picked]
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#define WRITE_LOG(log, text) rustg_log_write(log, text)
|
||||
|
||||
//print a warning message to world.log
|
||||
#define WARNING(MSG) warning("[MSG] in [__FILE__] at line [__LINE__] src: [src] usr: [usr].")
|
||||
#define WARNING(MSG) warning("[MSG] in [__FILE__] at line [__LINE__] src: [UNLINT(src)] usr: [usr].")
|
||||
/proc/warning(msg)
|
||||
msg = "## WARNING: [msg]"
|
||||
log_world(msg)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//faster than having to constantly loop for them
|
||||
GLOBAL_LIST_EMPTY(all_mutations) //type = initialized mutation
|
||||
GLOBAL_LIST_EMPTY_TYPED(all_mutations, /datum/mutation/human) //type = initialized mutation
|
||||
GLOBAL_LIST_EMPTY(full_sequences) //type = correct sequence
|
||||
GLOBAL_LIST_EMPTY(bad_mutations) //bad initialized mutations
|
||||
GLOBAL_LIST_EMPTY(good_mutations) //good initialized mutations
|
||||
|
||||
@@ -47,6 +47,6 @@ GLOBAL_LIST_EMPTY(vr_spawnpoints)
|
||||
//used by jump-to-area etc. Updated by area/updateName()
|
||||
GLOBAL_LIST_EMPTY(sortedAreas)
|
||||
/// An association from typepath to area instance. Only includes areas with `unique` set.
|
||||
GLOBAL_LIST_EMPTY(areas_by_type)
|
||||
GLOBAL_LIST_EMPTY_TYPED(areas_by_type, /area)
|
||||
|
||||
GLOBAL_LIST_EMPTY(all_abstract_markers)
|
||||
|
||||
@@ -4,7 +4,7 @@ SUBSYSTEM_DEF(job)
|
||||
flags = SS_NO_FIRE
|
||||
|
||||
var/list/occupations = list() //List of all jobs
|
||||
var/list/name_occupations = list() //Dict of all jobs, keys are titles
|
||||
var/list/datum/job/name_occupations = list() //Dict of all jobs, keys are titles
|
||||
var/list/type_occupations = list() //Dict of all jobs, keys are types
|
||||
var/list/unassigned = list() //Players who need jobs
|
||||
var/initial_players_to_assign = 0 //used for checking against population caps
|
||||
|
||||
@@ -184,6 +184,7 @@
|
||||
|
||||
// The type arg is casted so initial works, you shouldn't be passing a real instance into this
|
||||
/datum/proc/GetComponent(datum/component/c_type)
|
||||
RETURN_TYPE(c_type)
|
||||
if(initial(c_type.dupe_mode) == COMPONENT_DUPE_ALLOWED)
|
||||
stack_trace("GetComponent was called to get a component of which multiple copies could be on an object. This can easily break and should be changed. Type: \[[c_type]\]")
|
||||
var/list/dc = datum_components
|
||||
|
||||
@@ -299,7 +299,7 @@
|
||||
Deletion.Cut(Deletion.len)
|
||||
qdel(DL)
|
||||
|
||||
/datum/component/personal_crafting/proc/component_ui_interact(obj/screen/crafting/image, location, control, params, user)
|
||||
/datum/component/personal_crafting/proc/component_ui_interact(obj/screen/craft/image, location, control, params, user)
|
||||
if(user == parent)
|
||||
ui_interact(user)
|
||||
|
||||
|
||||
@@ -657,14 +657,14 @@ Code:
|
||||
if("botlist")
|
||||
active_bot = null
|
||||
if("summon") //Args are in the correct order, they are stated here just as an easy reminder.
|
||||
active_bot.bot_control(command= "summon", user_turf= get_turf(usr), user_access= host_pda.GetAccess())
|
||||
active_bot.bot_control("summon", usr, host_pda.GetAccess())
|
||||
else //Forward all other bot commands to the bot itself!
|
||||
active_bot.bot_control(command= href_list["op"], user= usr)
|
||||
active_bot.bot_control(href_list["op"], usr)
|
||||
|
||||
if(href_list["mule"]) //MULEbots are special snowflakes, and need different args due to how they work.
|
||||
var/mob/living/simple_animal/bot/mulebot/mule = active_bot
|
||||
if (istype(mule))
|
||||
mule.bot_control(command=href_list["mule"], user=usr, pda=TRUE)
|
||||
mule.bot_control(href_list["mule"], usr, pda=TRUE)
|
||||
|
||||
if(!host_pda)
|
||||
return
|
||||
|
||||
@@ -238,6 +238,7 @@
|
||||
return ..()
|
||||
|
||||
/obj/structure/blob/proc/chemeffectreport(mob/user)
|
||||
RETURN_TYPE(/list)
|
||||
. = list()
|
||||
if(overmind)
|
||||
. += list("<b>Material: <font color=\"[overmind.blobstrain.color]\">[overmind.blobstrain.name]</font><span class='notice'>.</span></b>",
|
||||
@@ -247,11 +248,11 @@
|
||||
. += "<b>No Material Detected!</b>"
|
||||
|
||||
/obj/structure/blob/proc/typereport(mob/user)
|
||||
RETURN_TYPE(/list)
|
||||
return list("<b>Blob Type:</b> <span class='notice'>[uppertext(initial(name))]</span>",
|
||||
"<b>Health:</b> <span class='notice'>[obj_integrity]/[max_integrity]</span>",
|
||||
"<b>Effects:</b> <span class='notice'>[scannerreport()]</span>")
|
||||
|
||||
|
||||
/obj/structure/blob/attack_animal(mob/living/simple_animal/M)
|
||||
if(ROLE_BLOB in M.faction) //sorry, but you can't kill the blob as a blobbernaut
|
||||
return
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
var/should_equip = TRUE
|
||||
var/traitor_kind = TRAITOR_HUMAN //Set on initial assignment
|
||||
var/datum/syndicate_contract/current_contract
|
||||
var/list/assigned_contracts = list()
|
||||
var/list/datum/syndicate_contract/assigned_contracts = list()
|
||||
var/contract_TC_payed_out = 0
|
||||
var/contract_TC_to_redeem = 0
|
||||
can_hijack = HIJACK_HIJACKER
|
||||
|
||||
@@ -72,11 +72,13 @@
|
||||
air.copy_from(copy)
|
||||
|
||||
/turf/return_air()
|
||||
RETURN_TYPE(/datum/gas_mixture)
|
||||
var/datum/gas_mixture/GM = new
|
||||
GM.copy_from_turf(src)
|
||||
return GM
|
||||
|
||||
/turf/open/return_air()
|
||||
RETURN_TYPE(/datum/gas_mixture)
|
||||
return air
|
||||
|
||||
/turf/temperature_expose()
|
||||
|
||||
@@ -5,6 +5,7 @@ GLOBAL_LIST_INIT(duplicate_forbidden_vars,list(
|
||||
))
|
||||
|
||||
/proc/DuplicateObject(atom/original, perfectcopy = TRUE, sameloc, atom/newloc = null, nerf, holoitem)
|
||||
RETURN_TYPE(original.type)
|
||||
if(!original)
|
||||
return
|
||||
var/atom/O
|
||||
|
||||
@@ -152,6 +152,7 @@
|
||||
return .
|
||||
|
||||
/mob/living/carbon/human/proc/get_bank_account()
|
||||
RETURN_TYPE(/datum/bank_account)
|
||||
var/datum/bank_account/account
|
||||
var/obj/item/card/id/I = get_idcard()
|
||||
|
||||
|
||||
@@ -833,7 +833,7 @@
|
||||
/mob/living/silicon/ai/can_buckle()
|
||||
return 0
|
||||
|
||||
/mob/living/silicon/ai/incapacitated(ignore_restraints = FALSE, ignore_grab = FALSE, check_immobilized = FALSE)
|
||||
/mob/living/silicon/ai/incapacitated(ignore_restraints = FALSE, ignore_grab = FALSE, check_immobilized = FALSE, ignore_stasis = FALSE)
|
||||
if(aiRestorePowerRoutine)
|
||||
return TRUE
|
||||
return ..()
|
||||
|
||||
@@ -672,11 +672,11 @@ Pass a positive integer as an argument to override a bot's default speed.
|
||||
destination = nearest_beacon
|
||||
|
||||
//PDA control. Some bots, especially MULEs, may have more parameters.
|
||||
/mob/living/simple_animal/bot/proc/bot_control(command, mob/user, turf/user_turf, list/user_access = list())
|
||||
/mob/living/simple_animal/bot/proc/bot_control(command, mob/user, list/user_access = list())
|
||||
if(!on || emagged == 2 || remote_disabled) //Emagged bots do not respect anyone's authority! Bots with their remote controls off cannot get commands.
|
||||
return TRUE //ACCESS DENIED
|
||||
if(client)
|
||||
bot_control_message(command,user,user_turf,user_access)
|
||||
bot_control_message(command, user)
|
||||
// process control input
|
||||
switch(command)
|
||||
if("patroloff")
|
||||
@@ -688,7 +688,7 @@ Pass a positive integer as an argument to override a bot's default speed.
|
||||
|
||||
if("summon")
|
||||
bot_reset()
|
||||
summon_target = user_turf
|
||||
summon_target = get_turf(user)
|
||||
if(user_access.len != 0)
|
||||
access_card.access = user_access + prev_access //Adds the user's access, if any.
|
||||
mode = BOT_SUMMON
|
||||
@@ -700,15 +700,14 @@ Pass a positive integer as an argument to override a bot's default speed.
|
||||
return
|
||||
|
||||
//
|
||||
/mob/living/simple_animal/bot/proc/bot_control_message(command,user,user_turf,user_access)
|
||||
/mob/living/simple_animal/bot/proc/bot_control_message(command, user)
|
||||
switch(command)
|
||||
if("patroloff")
|
||||
to_chat(src, "<span class='warning big'>STOP PATROL</span>")
|
||||
if("patrolon")
|
||||
to_chat(src, "<span class='warning big'>START PATROL</span>")
|
||||
if("summon")
|
||||
var/area/a = get_area(user_turf)
|
||||
to_chat(src, "<span class='warning big'>PRIORITY ALERT:[user] in [a.name]!</span>")
|
||||
to_chat(src, "<span class='warning big'>PRIORITY ALERT:[user] in [get_area_name(user)]!</span>")
|
||||
if("stop")
|
||||
to_chat(src, "<span class='warning big'>STOP!</span>")
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
var/setting = 1 // displayed range is 3 * setting
|
||||
var/max_range = 3 // displayed max range is 3 * max range
|
||||
|
||||
/datum/effect_system/smoke_spread/chem/smoke_machine/set_up(datum/reagents/carry, setting=1, efficiency=10, loc)
|
||||
/datum/effect_system/smoke_spread/chem/smoke_machine/set_up(datum/reagents/carry, setting=1, efficiency=10, loc, silent=FALSE)
|
||||
amount = setting
|
||||
carry.copy_to(chemholder, 20)
|
||||
carry.remove_any(amount * 16 / efficiency)
|
||||
|
||||
@@ -79,7 +79,7 @@ GLOBAL_LIST_INIT(blacklisted_cargo_types, typecacheof(list(
|
||||
sell()
|
||||
|
||||
/obj/docking_port/mobile/supply/proc/buy()
|
||||
var/list/miscboxes = list() //miscboxes are combo boxes that contain all small_item orders grouped
|
||||
var/list/obj/miscboxes = list() //miscboxes are combo boxes that contain all small_item orders grouped
|
||||
var/list/misc_order_num = list() //list of strings of order numbers, so that the manifest can show all orders in a box
|
||||
var/list/misc_contents = list() //list of lists of items that each box will contain
|
||||
if(!SSshuttle.shoppinglist.len)
|
||||
|
||||
@@ -61,6 +61,7 @@
|
||||
.++
|
||||
|
||||
/obj/vehicle/proc/return_controllers_with_flag(flag)
|
||||
RETURN_TYPE(/list/mob)
|
||||
. = list()
|
||||
for(var/i in occupants)
|
||||
if(occupants[i] & flag)
|
||||
|
||||
Reference in New Issue
Block a user