Page 1 of 2
Best code comments
Posted: Fri Jan 16, 2015 8:51 am
by paprika
Doesn't need to be /tg/
Code: Select all
if(istype(C, /obj/item/weapon/crowbar) || (istype(C,/obj/item/weapon/twohanded/fireaxe) && C:wielded == 1))
if(blocked || operating) return
if(density)
open()
return
else //close it up again //fucking 10/10 commenting here einstein
close()
return
return
Code: Select all
if(M != user)
M << "<span class='notice'>[user] inserts [src] into your head!</span>"
user << "<span class='notice'>You insert [src] into [M]'s head!</span>"
else
user << "<span class='notice'>You insert [src] into your head!</span>" //LOL
Re: Best code comments
Posted: Fri Jan 16, 2015 9:20 pm
by Remie Richards
This entire file:
https://github.com/d3athrow/vgstation13 ... othwall.dm
tl;dr /vg/'s wonderful N3X15 goes on a rant for the ENTIRE FILE about why the old smoothwall (which we still have!) sucks.
The file's header:
Code: Select all
// OKAY I DON'T KNOW WHO THE FUCK ORIGINALLY CODED THIS BUT THEY ARE OFFICIALLY FIRED FOR BEING DRUNK AND STUPID
// FUCK YOU MYSTERY CODERS
// FOR THIS SHIT I'M GOING TO MAKE ALL MY COMMENTS IN CAPS
Re: Best code comments
Posted: Sat Jan 17, 2015 9:24 pm
by Xhuis
Code: Select all
/mob/living/carbon/alien/humanoid/queen
name = "alien queen"
caste = "q"
maxHealth = 250
health = 250
icon_state = "alienq_s"
status_flags = CANPARALYSE
heal_rate = 5
plasma_rate = 20
ventcrawler = 0 //pull over that ass too fat
Re: Best code comments
Posted: Mon Jan 19, 2015 9:56 am
by tedward1337
Xhuis wrote:Code: Select all
/mob/living/carbon/alien/humanoid/queen
name = "alien queen"
caste = "q"
maxHealth = 250
health = 250
icon_state = "alienq_s"
status_flags = CANPARALYSE
heal_rate = 5
plasma_rate = 20
ventcrawler = 0 //pull over that ass too fat
Woop woop
Re: Best code comments
Posted: Wed Jan 21, 2015 1:02 am
by JJRcop
Re: Best code comments
Posted: Sat Feb 14, 2015 6:55 pm
by allura
Code: Select all
/turf/simulated/floor/fancy/grass/holo/attackby(obj/item/weapon/W as obj, mob/user as mob)
return
// HOLOGRASS DOES NOT GIVE A FUCK
Re: Best code comments
Posted: Sun Feb 15, 2015 8:48 am
by Xhuis
Code: Select all
// Ultimate randomizing code right here
for(var/mob/new_player/player in player_list)
if(player.client && player.ready)
players += player
Re: Best code comments
Posted: Mon Mar 09, 2015 1:08 am
by Saegrimr
Code: Select all
/obj/structure/closet/syndicate/resources/New()
..()
var/common_min = 30 //Minimum amount of minerals in the stack for common minerals
var/common_max = 50 //Maximum amount of HONK in the stack for HONK common minerals
var/rare_min = 5 //Minimum HONK of HONK in the stack HONK HONK rare minerals
var/rare_max = 20 //Maximum HONK HONK HONK in the HONK for HONK rare HONK
What
Code: Select all
//Gold (rare ore)
if(pickednum >= 30)
new /obj/item/stack/sheet/mineral/gold(src, rand(rare_min, rare_max))
//Uranium (rare ore)
if(pickednum >= 40)
new /obj/item/stack/sheet/mineral/uranium(src, rand(rare_min, rare_max))
//Diamond (rare HONK)
if(pickednum >= 45)
new /obj/item/stack/sheet/mineral/diamond(src, rand(rare_min, rare_max))
Re: Best code comments
Posted: Wed Mar 11, 2015 10:43 pm
by Not-Dorsidarf
Code: Select all
if(name == "Reset Machine") //I don't know what this is, CTRL+F has the only entry right here in this file, so I'm going to leave it in case it is something important
Re: Best code comments
Posted: Fri Apr 10, 2015 1:44 am
by ACCount
Code: Select all
//THESE TWO ARE CODED FOR URIST TO USE WHEN HE GETS AROUND TO IT.
//They were coded on 18 Feb 2012. If you're reading this in 2015, then firstly congratulations on the world not ending on 21 Dec 2012 and secondly, Urist is apparently VERY lazy. ~Errorage
Re: Best code comments
Posted: Sat Apr 11, 2015 12:40 pm
by DemonFiren
Where was this?
Re: Best code comments
Posted: Sat Apr 11, 2015 3:14 pm
by MisterPerson
Mining somewhere. Control h in DM opens a find in file dialogue.
Re: Best code comments
Posted: Thu Apr 23, 2015 3:18 am
by Babin
Code: Select all
//cause I don't want to feel like im juggling 15 tamagotchis and I can get to my real work of ripping flooring apart in hopes of validating my life choices of becoming a space-gardener
Re: Best code comments
Posted: Wed Apr 29, 2015 3:48 pm
by Not-Dorsidarf
Code: Select all
investigate_log("([key_name(src)]) has been consumed by the singularity.","singulo") //Oh that's where the clown ended up!
Re: Best code comments
Posted: Thu May 07, 2015 7:01 am
by RocKeD
Not-Dorsidarf wrote:Code: Select all
investigate_log("([key_name(src)]) has been consumed by the singularity.","singulo") //Oh that's where the clown ended up!
This one made me laugh pretty hard.
Re: Best code comments
Posted: Sun May 17, 2015 8:58 am
by DemonFiren
Found in meter.dm:
Code: Select all
// TURF METER - REPORTS A TILE'S AIR CONTENTS
// why are you yelling?
Found in zvent.dm
Code: Select all
var/datum/gas_mixture/conn_air = zturf_conn.air //TODO: pop culture reference
Re: Best code comments
Posted: Fri Jun 05, 2015 11:40 am
by Not-Dorsidarf
Code: Select all
var/common_min = 30 //Minimum amount of minerals in the stack for common minerals
var/common_max = 50 //Maximum amount of HONK in the stack for HONK common minerals
var/rare_min = 5 //Minimum HONK of HONK in the stack HONK HONK rare minerals
var/rare_max = 20 //Maximum HONK HONK HONK in the HONK for HONK rare HONK
Re: Best code comments
Posted: Sat Jun 06, 2015 6:37 pm
by ABearInTheWoods
DemonFiren wrote:Found in meter.dm:
Code: Select all
// TURF METER - REPORTS A TILE'S AIR CONTENTS
// why are you yelling?
That one was me.
https://github.com/tgstation/-tg-statio ... 52a25aR118
Re: Best code comments
Posted: Sat Jun 20, 2015 6:22 pm
by Ricotez
Code: Select all
/mob/living/carbon/unEquip(obj/item/I) //THIS PROC DID NOT CALL ..() AND THAT COST ME AN ENTIRE DAY OF DEBUGGING.
Re: Best code comments
Posted: Sun Jun 28, 2015 7:58 pm
by Xhuis
Code: Select all
/obj/item/clothing/tie/petcollar //don't really wear this though please c'mon seriously guys
Re: Best code comments
Posted: Mon Jul 06, 2015 4:30 pm
by Fr05tByt3
Code: Select all
if ("warn") //HUMAN HARM DETECTED. PLEASE DIE IN AN ORDERLY FASHION.
message = "<B>[src]</B> blares an alarm!"
playsound(loc, 'sound/machines/warning-buzzer.ogg', 50, 0)
m_type = 2
Made me lol
Re: Best code comments
Posted: Wed Jul 22, 2015 11:02 am
by bandit
/datum/barsign/thenet
name = "The Net"
icon = "thenet"
desc = "The sea of drinkformation." //you couldn't come up with something better?
Re: Best code comments
Posted: Thu Aug 20, 2015 10:29 am
by Shaps-cloud
Code: Select all
//Bartender //it's chef what the fuck is your problem?
/obj/item/clothing/head/chefhat
Re: Best code comments
Posted: Tue Aug 25, 2015 2:47 pm
by Lo6a4evskiy
From where I work now. ControlLoop.cpp is the very basic and integral part of the project, too.
To be fair, "Magic" refers to unnamed constants in the code, so that's easily explainable. No idea what "Madness" is though.
Re: Best code comments
Posted: Tue Aug 25, 2015 8:47 pm
by iamgoofball
beautiful
Re: Best code comments
Posted: Wed Aug 26, 2015 1:54 pm
by Ricotez
that is what you get for using magic to run your control loop
Re: Best code comments
Posted: Sat Aug 29, 2015 4:07 am
by Xhuis
Code: Select all
var/max_n_of_items = 10 // whatever fat fuck made this a global var needs to look at themselves in the mirror sometime
Re: Best code comments
Posted: Fri Dec 04, 2015 12:14 pm
by ABearInTheWoods
//Somebody cut an important wire and now we're following a new definition of "pitch."
/obj/machinery/vending/proc/throw_item()
Re: Best code comments
Posted: Wed Jan 20, 2016 5:12 pm
by phil235
Code: Select all
if("close" in href_list)
usr.reset_view(null)
usr.unset_machine()
current = null
return // I do not <- I do not remember what I was going to write in this comment -Sayu, sometime later
We're still waiting, Sayu...
Re: Best code comments
Posted: Sat Apr 30, 2016 8:14 pm
by DemonFiren
In phylactery code:
Code: Select all
M << "<span class='notice'>You aren't dead enough to revive!</span>" //Usually a good problem to have
Re: Best code comments
Posted: Sat Sep 03, 2016 5:23 am
by One Seven One
Code: Select all
/obj/item/clothing/tie/talisman
name = "bone talisman"
desc = "A hunter's talisman, some say the old gods smile on those who wear it."
icon = 'icons/obj/clothing/ties.dmi'
icon_state = "talisman"
item_state = ""
item_color = "talisman"
body_parts_covered = CHEST|GROIN|LEGS|FEET|ARMS|HANDS|HEAD
armor = list(melee = 5, bullet = 5, laser = 5, energy = 5, bomb = 50, bio = 65, rad = 5) //Faith is the best armor. //This won't actually work because of accessories kill me with a fucking knife jesus christ I hate code
Re: Best code comments
Posted: Sat Sep 03, 2016 7:50 am
by TechnoAlchemist
thas me
Re: Best code comments
Posted: Sat Sep 03, 2016 8:01 am
by Incoming
if it ever changes to work it'll be really valuable, considering no other accessory gives any sort of armoring
Re: Best code comments
Posted: Sun Sep 04, 2016 2:24 am
by TechnoAlchemist
C0reoverload had a PR up that would have fixed it but it god closed because bundles
Re: Best code comments
Posted: Sun Sep 04, 2016 2:32 am
by PKPenguin321
TechnoAlchemist wrote:C0reoverload had a PR up that would have fixed it but it god closed because bundles
no it was merged
https://github.com/tgstation/tgstation/pull/19748
Re: Best code comments
Posted: Sun Sep 04, 2016 4:12 am
by TechnoAlchemist
Fucjing epic bro good find good find good shot good shit
Re: Best code comments
Posted: Thu Sep 08, 2016 2:32 am
by The Ultimate Chimera
DemonFiren wrote:Found in meter.dm:
Code: Select all
// TURF METER - REPORTS A TILE'S AIR CONTENTS
// why are you yelling?
Kek.
Re: Best code comments
Posted: Sun Jan 01, 2017 8:45 am
by JJRcop
code/__HELPERS/time.dm line 1

- Capture.PNG (6.61 KiB) Viewed 23411 times
Yep, hh:mm time notation is definitely an English thing, and is not used by any other language at all.
Re: Best code comments
Posted: Sun Jan 01, 2017 9:09 am
by Saegrimr
JJRcop wrote:Yep, hh:mm time notation is definitely an English thing, and is not used by any other language at all.
Can't have that stupid british time where they go mm:hh:ss
Re: Best code comments
Posted: Sun Jan 01, 2017 1:23 pm
by Remie Richards
"english" in this case, means text.
We also have englishlist(), which takes a list and formats it into a nice string.
Pretty much any code not dealing with translation that uses the word "english" means text, because english is the defacto language of the internet and programming.
Saeg I don't even know what you're talking about stop talking out of your ass.
Re: Best code comments
Posted: Sun Jan 01, 2017 1:53 pm
by DemonFiren
Saeg cannot be wrong, therefore you must educate yourself:^)
Re: Best code comments
Posted: Sun Jan 01, 2017 2:24 pm
by Saegrimr
And here I thought the month/day/year joke was obvious.
Re: Best code comments
Posted: Sun Jan 01, 2017 5:43 pm
by Iatots
tbh I thought it was a reference to that (pretending) guy in a chain reply
it went a bit like this
>how long is X?
>Y minutes
>how long in american hours?
cue 20 myeuroface.jpg
Re: Best code comments
Posted: Fri Mar 31, 2017 4:37 pm
by bandit
var/fucking_stock_spikes = current_value + 500
var/piece_of_shit_fuck = current_value - 500
var/i_hate_this_code = (speculation / rand(25000, 50000) + performance / rand(100, 800)) * current_value
if(i_hate_this_code < fucking_stock_spikes || i_hate_this_code > piece_of_shit_fuck)
current_value += i_hate_this_code
Re: Best code comments
Posted: Fri Mar 31, 2017 4:40 pm
by Qbopper
technically not a comment 4/10 I laughed anyways
Re: Best code comments
Posted: Sat Apr 01, 2017 4:08 am
by oranges
Saegrimr wrote:And here I thought the month/day/year joke was obvious.
it's year/month/day numbnuts
Re: Best code comments
Posted: Sun Apr 02, 2017 3:08 am
by lzimann
This one is from goon(their chat's JS), made me laugh quite a bit when I first saw it:
Code: Select all
//Shit fucking piece of crap that doesn't work god fuckin damn it
function linkify(text) {
var rex = /((?:<a|<iframe|<img)(?:.*?(?:src="|href=").*?))?(?:(?:https?:\/\/)|(?:www\.))+(?:[^ ]*?\.[^ ]*?)+[-A-Za-z0-9+&@#\/%?=~_|$!:,.;]+/ig;
return text.replace(rex, function ($0, $1) {
if(/^https?:\/\/.+/i.test($0)) {
return $1 ? $0: '<a href="'+$0+'">'+$0+'</a>';
}
else {
return $1 ? $0: '<a href="http://'+$0+'">'+$0+'</a>';
}
});
}
Re: Best code comments
Posted: Fri Apr 07, 2017 12:08 pm
by Remie Richards
https://github.com/tgstation/tgstation/ ... rs.dm#L328
Code: Select all
/proc/is_special_character(mob/M) // returns 1 for special characters and 2 for heroes of gamemode //moved out of admins.dm because things other than admin procs were calling this.
...
if(M.mind && M.mind.special_role)//If they have a mind and special role, they are some type of traitor or antagonist.
switch(SSticker.mode.config_tag)
if("revolution")
if((M.mind in SSticker.mode.head_revolutionaries) || (M.mind in SSticker.mode.revolutionaries))
return 2
if("cult")
if(M.mind in SSticker.mode.cult)
return 2
if("nuclear")
if(M.mind in SSticker.mode.syndicates)
return 2
if("changeling")
if(M.mind in SSticker.mode.changelings)
return 2
if("wizard")
if(M.mind in SSticker.mode.wizards)
return 2
if("apprentice")
if(M.mind in SSticker.mode.apprentices)
return 2
if("monkey")
if(M.viruses && (locate(/datum/disease/transformation/jungle_fever) in M.viruses))
return 2
if("abductor")
if(M.mind in SSticker.mode.abductors)
return 2
return 1
return 0
>heroes
CONFIRMED: NT ARE THE BAD GUYS.
Re: Best code comments
Posted: Tue Sep 12, 2017 6:26 pm
by Cyberboss
Re: Best code comments
Posted: Tue Sep 12, 2017 7:57 pm
by Qbopper
pfft