Linter Introduction + Cleanup (#8085)

* Adds linter defines to repo.

* Uncomments linter defines already in the code.

* Resolves unreachable code linter errors.

* Nukes decade+ old syndie specops code except for computer since that's mapped in?????

* Resolves procs has no parent linter error.

* Proc signature fixes

* Bad comments

* "In" danger

* Type safety

* Implied nested list abuse

* Top level ..() usage

* Sleepy coder typos

* Invalid kwargs calls

* Pointless returns

* Linter hacks (see full message)

Byond doesn't care and it has no effect but linter doesn't like var/proc
for holding references to procs, despite that it's valid byond code.

Also, the linter seems to have serious issues figuring out relative
proc names. This commit is a sort of take-it-or-leave-it thing. It's not
required, it just cuts down on warnings, but this code is valid DM code.

* WHATEVER THIS IS

* Trick dreamchecker linter into ignoring this file's sins in it's weird use of vars

* Fix list decoration syntax - Its a list, not list of lists

- To declare that a var is a list you can `var/list/blah = list()` syntax or the `var/blah[0]` syntax.  Both do exactly the same thing. But if you do `var/list/blah[0]` that is just like doing `var/list/list/blah = list()`

* Hopefully stops the ai holder subtype folder from going quantum and sometimes changes capitalization over time, and incidentally causing 20+ linter errors.

* Fixes unwrapped negated object in list linter error.

* Resolves colon-like list accessing linter error.

* Turns linter on in linter config.

* Fixes closet indentation properly and cleans up suit storage unit switch.

Co-authored-by: Aronai Sieyes <arokha@arokha.com>
Co-authored-by: Leshana <Leshana@users.noreply.github.com>
This commit is contained in:
Neerti
2021-05-25 18:17:26 -09:00
committed by GitHub
co-authored by Aronai Sieyes Leshana
parent 9667dad5ba
commit fdabe51ee8
201 changed files with 3551 additions and 3824 deletions
+7 -5
View File
@@ -23,6 +23,7 @@
/obj/item/clothing/head/cowboy_hat/small = 2,
/obj/item/toy/stickhorse = 2
)
var/list/special_prizes = list() // Holds instanced objects, intended for admins to shove surprises inside or something.
/obj/machinery/computer/arcade/Initialize()
. = ..()
@@ -35,17 +36,18 @@
return INITIALIZE_HINT_QDEL
/obj/machinery/computer/arcade/proc/prizevend()
if(!(contents-circuit).len)
if(LAZYLEN(special_prizes)) // Downstream wanted the 'win things inside contents sans circuitboard' feature kept.
var/atom/movable/AM = pick_n_take(special_prizes)
AM.forceMove(get_turf(src))
special_prizes -= AM
else if(LAZYLEN(prizes))
var/prizeselect = pickweight(prizes)
new prizeselect(src.loc)
if(istype(prizeselect, /obj/item/clothing/suit/syndicatefake)) //Helmet is part of the suit
new /obj/item/clothing/head/syndicatefake(src.loc)
else
var/atom/movable/prize = pick(contents-circuit)
prize.loc = src.loc
/obj/machinery/computer/arcade/attack_ai(mob/user as mob)
return attack_hand(user)
+1 -1
View File
@@ -14,7 +14,7 @@ var/global/list/minor_air_alarms = list()
/obj/machinery/computer/atmos_alert/New()
..()
atmosphere_alarm.register_alarm(src, /obj/machinery/computer/station_alert/update_icon)
atmosphere_alarm.register_alarm(src, /atom/proc/update_icon)
/obj/machinery/computer/atmos_alert/Destroy()
atmosphere_alarm.unregister_alarm(src)
+10 -7
View File
@@ -98,18 +98,19 @@
data["linkedServer"]["active"] = linkedServer.active
data["linkedServer"]["broke"] = linkedServer.stat & (NOPOWER|BROKEN)
data["linkedServer"]["pda_msgs"] = list()
var/list/pda_msgs = list()
for(var/datum/data_pda_msg/pda in linkedServer.pda_msgs)
data["linkedServer"]["pda_msgs"].Add(list(list(
pda_msgs.Add(list(list(
"ref" = "\ref[pda]",
"sender" = pda.sender,
"recipient" = pda.recipient,
"message" = pda.message,
)))
data["linkedServer"]["pda_msgs"] = pda_msgs
data["linkedServer"]["rc_msgs"] = list()
var/list/rc_msgs = list()
for(var/datum/data_rc_msg/rc in linkedServer.rc_msgs)
data["linkedServer"]["rc_msgs"].Add(list(list(
rc_msgs.Add(list(list(
"ref" = "\ref[rc]",
"sender" = rc.send_dpt,
"recipient" = rc.rec_dpt,
@@ -118,15 +119,17 @@
"id_auth" = rc.id_auth,
"priority" = rc.priority,
)))
data["linkedServer"]["rc_msgs"] = rc_msgs
var/spamIndex = 0
data["linkedServer"]["spamFilter"] = list()
var/list/spamfilter = list()
for(var/token in linkedServer.spamfilter)
spamIndex++
data["linkedServer"]["spamFilter"].Add(list(list(
spamfilter.Add(list(list(
"index" = spamIndex,
"token" = token,
)))
data["linkedServer"]["spamFilter"] = spamfilter
//Get out list of viable PDAs
var/list/obj/item/device/pda/sendPDAs = list()
+5 -8
View File
@@ -30,11 +30,8 @@
ui.open()
/obj/machinery/computer/prisoner/tgui_data(mob/user)
var/list/data = list()
data["locked"] = !screen
data["chemImplants"] = list()
data["trackImplants"] = list()
var/list/chemImplants = list()
var/list/trackImplants = list()
if(screen)
for(var/obj/item/weapon/implant/chem/C in all_chem_implants)
var/turf/T = get_turf(C)
@@ -42,7 +39,7 @@
continue
if(!C.implanted)
continue
data["chemImplants"].Add(list(list(
chemImplants.Add(list(list(
"host" = C.imp_in,
"units" = C.reagents.total_volume,
"ref" = "\ref[C]"
@@ -59,14 +56,14 @@
loc_display = T.loc
if(track.malfunction)
loc_display = pick(teleportlocs)
data["trackImplants"].Add(list(list(
trackImplants.Add(list(list(
"host" = L,
"ref" = "\ref[track]",
"id" = "[track.id]",
"loc" = "[loc_display]",
)))
return data
return list("locked" = !screen, "chemImplants" = chemImplants, "trackImplants" = trackImplants)
/obj/machinery/computer/prisoner/tgui_act(action, list/params)
@@ -19,7 +19,7 @@
/obj/machinery/computer/station_alert/Initialize()
alarm_monitor = new monitor_type(src)
alarm_monitor.register_alarm(src, /obj/machinery/computer/station_alert/update_icon)
alarm_monitor.register_alarm(src, /atom/proc/update_icon)
. = ..()
/obj/machinery/computer/station_alert/Destroy()
@@ -1,257 +1,6 @@
//Config stuff
#define SYNDICATE_ELITE_MOVETIME 600 //Time to station is milliseconds. 60 seconds, enough time for everyone to be on the shuttle before it leaves.
#define SYNDICATE_ELITE_STATION_AREATYPE "/area/shuttle/syndicate_elite/station" //Type of the spec ops shuttle area for station
#define SYNDICATE_ELITE_DOCK_AREATYPE "/area/shuttle/syndicate_elite/mothership" //Type of the spec ops shuttle area for dock
var/syndicate_elite_shuttle_moving_to_station = 0
var/syndicate_elite_shuttle_moving_to_mothership = 0
var/syndicate_elite_shuttle_at_station = 0
var/syndicate_elite_shuttle_can_send = 1
var/syndicate_elite_shuttle_time = 0
var/syndicate_elite_shuttle_timeleft = 0
/obj/machinery/computer/syndicate_elite_shuttle
name = "elite syndicate squad shuttle control console"
icon_keyboard = "syndie_key"
icon_screen = "syndishuttle"
light_color = "#00ffff"
req_access = list(access_cent_specops)
var/temp = null
var/hacked = 0
var/allowedtocall = 0
/proc/syndicate_elite_process()
var/area/syndicate_mothership/control/syndicate_ship = locate()//To find announcer. This area should exist for this proc to work.
var/area/syndicate_mothership/elite_squad/elite_squad = locate()//Where is the specops area located?
var/mob/living/silicon/decoy/announcer = locate() in syndicate_ship//We need a fake AI to announce some stuff below. Otherwise it will be wonky.
var/message_tracker[] = list(0,1,2,3,5,10,30,45)//Create a a list with potential time values.
var/message = "THE SYNDICATE ELITE SHUTTLE IS PREPARING FOR LAUNCH"//Initial message shown.
if(announcer)
announcer.say(message)
// message = "ARMORED SQUAD TAKE YOUR POSITION ON GRAVITY LAUNCH PAD"
// announcer.say(message)
while(syndicate_elite_shuttle_time - world.timeofday > 0)
var/ticksleft = syndicate_elite_shuttle_time - world.timeofday
if(ticksleft > 1e5)
syndicate_elite_shuttle_time = world.timeofday // midnight rollover
syndicate_elite_shuttle_timeleft = (ticksleft / 10)
//All this does is announce the time before launch.
if(announcer)
var/rounded_time_left = round(syndicate_elite_shuttle_timeleft)//Round time so that it will report only once, not in fractions.
if(rounded_time_left in message_tracker)//If that time is in the list for message announce.
message = "ALERT: [rounded_time_left] SECOND[(rounded_time_left!=1)?"S":""] REMAIN"
if(rounded_time_left==0)
message = "ALERT: TAKEOFF"
announcer.say(message)
message_tracker -= rounded_time_left//Remove the number from the list so it won't be called again next cycle.
//Should call all the numbers but lag could mean some issues. Oh well. Not much I can do about that.
sleep(5)
syndicate_elite_shuttle_moving_to_station = 0
syndicate_elite_shuttle_moving_to_mothership = 0
syndicate_elite_shuttle_at_station = 1
if (syndicate_elite_shuttle_moving_to_station || syndicate_elite_shuttle_moving_to_mothership) return
if (!syndicate_elite_can_move())
to_chat(usr, "<span class='warning'>The Syndicate Elite shuttle is unable to leave.</span>")
return
sleep(600)
/*
//Begin Marauder launchpad.
spawn(0)//So it parallel processes it.
for(var/obj/machinery/door/poddoor/M in elite_squad)
switch(M.id)
if("ASSAULT0")
spawn(10)//1 second delay between each.
M.open()
if("ASSAULT1")
spawn(20)
M.open()
if("ASSAULT2")
spawn(30)
M.open()
if("ASSAULT3")
spawn(40)
M.open()
sleep(10)
var/spawn_marauder[] = new()
for(var/obj/effect/landmark/L in landmarks_list)
if(L.name == "Marauder Entry")
spawn_marauder.Add(L)
for(var/obj/effect/landmark/L in landmarks_list)
if(L.name == "Marauder Exit")
var/obj/effect/portal/P = new(L.loc)
P.invisibility = 101//So it is not seen by anyone.
P.failchance = 0//So it has no fail chance when teleporting.
P.target = pick(spawn_marauder)//Where the marauder will arrive.
spawn_marauder.Remove(P.target)
sleep(10)
for(var/obj/machinery/mass_driver/M in elite_squad)
switch(M.id)
if("ASSAULT0")
spawn(10)
M.drive()
if("ASSAULT1")
spawn(20)
M.drive()
if("ASSAULT2")
spawn(30)
M.drive()
if("ASSAULT3")
spawn(40)
M.drive()
sleep(50)//Doors remain open for 5 seconds.
for(var/obj/machinery/door/poddoor/M in elite_squad)
switch(M.id)//Doors close at the same time.
if("ASSAULT0")
spawn(0)
M.close()
if("ASSAULT1")
spawn(0)
M.close()
if("ASSAULT2")
spawn(0)
M.close()
if("ASSAULT3")
spawn(0)
M.close()
*/
elite_squad.readyreset()//Reset firealarm after the team launched.
//End Marauder launchpad.
/*
var/obj/explosionmarker = locate("Syndicate Breach Area")
if(explosionmarker)
var/turf/simulated/T = explosionmarker.loc
if(T)
explosion(T,4,6,8,10,0)
sleep(40)
// proc/explosion(turf/epicenter, devastation_range, heavy_impact_range, light_impact_range, flash_range, adminlog = 1)
*/
var/area/start_location = locate(/area/shuttle/syndicate_elite/mothership)
var/area/end_location = locate(/area/shuttle/syndicate_elite/station)
var/list/dstturfs = list()
var/throwy = world.maxy
for(var/turf/T in end_location)
dstturfs = T
if(T.y < throwy)
throwy = T.y
// hey you, get out of the way!
for(var/turf/T in dstturfs)
// find the turf to move things to
var/turf/D = locate(T.x, throwy - 1, 1)
//var/turf/E = get_step(D, SOUTH)
for(var/atom/movable/AM as mob|obj in T)
AM.Move(D)
if(istype(T, /turf/simulated))
qdel(T)
for(var/mob/living/carbon/bug in end_location) // If someone somehow is still in the shuttle's docking area...
bug.gib()
for(var/mob/living/simple_mob/pest in end_location) // And for the other kind of bug...
pest.gib()
start_location.move_contents_to(end_location)
for(var/turf/T in get_area_turfs(end_location) )
var/mob/M = locate(/mob) in T
to_chat(M, "<span class='warning'>You have arrived to [station_name()]. Commence operation!</span>")
/proc/syndicate_elite_can_move()
if(syndicate_elite_shuttle_moving_to_station || syndicate_elite_shuttle_moving_to_mothership) return 0
else return 1
/obj/machinery/computer/syndicate_elite_shuttle/attackby(I as obj, user as mob)
return attack_hand(user)
/obj/machinery/computer/syndicate_elite_shuttle/attack_ai(var/mob/user as mob)
return attack_hand(user)
/obj/machinery/computer/syndicate_elite_shuttle/emag_act(var/remaining_charges, var/mob/user)
to_chat(user, "<span class='notice'>The electronic systems in this console are far too advanced for your primitive hacking peripherals.</span>")
/obj/machinery/computer/syndicate_elite_shuttle/attack_hand(var/mob/user as mob)
if(!allowed(user))
to_chat(user, "<span class='warning'>Access Denied.</span>")
return
// if (sent_syndicate_strike_team == 0)
// to_chat(usr, "<span class='warning'>The strike team has not yet deployed.</span>")
// return
if(..())
return
user.set_machine(src)
var/dat
if (temp)
dat = temp
else
dat = {"<BR><B>Special Operations Shuttle</B><HR>
\nLocation: [syndicate_elite_shuttle_moving_to_station || syndicate_elite_shuttle_moving_to_mothership ? "Departing for [station_name()] in ([syndicate_elite_shuttle_timeleft] seconds.)":syndicate_elite_shuttle_at_station ? "Station":"Dock"]<BR>
[syndicate_elite_shuttle_moving_to_station || syndicate_elite_shuttle_moving_to_mothership ? "\n*The Syndicate Elite shuttle is already leaving.*<BR>\n<BR>":syndicate_elite_shuttle_at_station ? "\n<A href='?src=\ref[src];sendtodock=1'>Shuttle Offline</A><BR>\n<BR>":"\n<A href='?src=\ref[src];sendtostation=1'>Depart to [station_name()]</A><BR>\n<BR>"]
\n<A href='?src=\ref[user];mach_close=computer'>Close</A>"}
user << browse(dat, "window=computer;size=575x450")
onclose(user, "computer")
return
/obj/machinery/computer/syndicate_elite_shuttle/Topic(href, href_list)
if(..())
return 1
if ((usr.contents.Find(src) || (in_range(src, usr) && istype(loc, /turf))) || (istype(usr, /mob/living/silicon)))
usr.set_machine(src)
if (href_list["sendtodock"])
if(!syndicate_elite_shuttle_at_station|| syndicate_elite_shuttle_moving_to_station || syndicate_elite_shuttle_moving_to_mothership) return
to_chat(usr, "<span class='notice'>The Syndicate will not allow the Elite Squad shuttle to return.</span>")
return
else if (href_list["sendtostation"])
if(syndicate_elite_shuttle_at_station || syndicate_elite_shuttle_moving_to_station || syndicate_elite_shuttle_moving_to_mothership) return
if (!specops_can_move())
to_chat(usr, "<span class='warning'>The Syndicate Elite shuttle is unable to leave.</span>")
return
to_chat(usr, "<span class='notice'>The Syndicate Elite shuttle will arrive on [station_name()] in [(SYNDICATE_ELITE_MOVETIME/10)] seconds.</span>")
temp = "Shuttle departing.<BR><BR><A href='?src=\ref[src];mainmenu=1'>OK</A>"
updateUsrDialog()
var/area/syndicate_mothership/elite_squad/elite_squad = locate()
if(elite_squad)
elite_squad.readyalert()//Trigger alarm for the spec ops area.
syndicate_elite_shuttle_moving_to_station = 1
syndicate_elite_shuttle_time = world.timeofday + SYNDICATE_ELITE_MOVETIME
spawn(0)
syndicate_elite_process()
else if (href_list["mainmenu"])
temp = null
add_fingerprint(usr)
updateUsrDialog()
return
req_access = list(access_cent_specops)