'Please murder me slowly' pieces of code

How, what and why to code in BYOND.
User avatar
PKPenguin321
Site Admin
Joined: Tue Jul 01, 2014 7:02 pm
Byond Username: PKPenguin321
Github Username: PKPenguin321
Location: U S A, U S A, U S A

Re: 'Please murder me slowly' pieces of code

Post by PKPenguin321 » #240938

Bottom post of the previous page:

oranges wrote:

Code: Select all

/datum/reagent/toxin/mutagen/reaction_mob(mob/living/carbon/M, method=TOUCH, reac_volume)
	if(!..())
		return
	if(!M.has_dna())
		return  //No robots, AIs, aliens, Ians or other mobs should be affected by this.
	if((method==VAPOR && prob(min(33, reac_volume))) || method==INGEST || method==PATCH || method==INJECT)
		M.randmuti()
		if(prob(98))
			M.randmutb()
		else
			M.randmutg()
		M.updateappearance()
		M.domutcheck()
..()
What's so bad about this? I usually get these but this one's readable and not awful
i play Lauser McMauligan. clown name is Cold-Ass Honkey
i have three other top secret characters as well.
tell the best admin how good he is
Spoiler:
Image
User avatar
oranges
Code Maintainer
Joined: Tue Apr 15, 2014 9:16 pm
Byond Username: Optimumtact
Github Username: optimumtact
Location: #CHATSHITGETBANGED

Re: 'Please murder me slowly' pieces of code

Post by oranges » #241102

PKPenguin321 wrote:
oranges wrote:

Code: Select all

/datum/reagent/toxin/mutagen/reaction_mob(mob/living/carbon/M, method=TOUCH, reac_volume)
   if(!..())
      return
   ...
   ..()
What's so bad about this? I usually get these but this one's readable and not awful
User avatar
XDTM
Github User
Joined: Fri Mar 04, 2016 8:38 pm
Byond Username: XDTM
Github Username: XDTM
Location: XDTM

Re: 'Please murder me slowly' pieces of code

Post by XDTM » #241311

So basically you inject double the mutagen if you use vapor
a.k.a. Duke Hayka

Coder of golems, virology, hallucinations, traumas, nanites, and a bunch of miscellaneous stuff.
lzimann
Joined: Sun Oct 26, 2014 5:13 am
Byond Username: Lzimann
Github Username: lzimann

Re: 'Please murder me slowly' pieces of code

Post by lzimann » #246670

So, I am currently refactoring all gamemode code, and for that I set the ticker.mode to always be null. With that, I discovered that doors/airlocks are dependent on ticker.mode existing.

This one is the open() proc for doors. The code is not pretty overall, but notice the if(!ticker || !ticker.mode) there. It also happens in airlocks.

Code: Select all

/obj/machinery/door/proc/open()
	if(!density)
		return 1
	if(operating)
		return
	if(!ticker || !ticker.mode)
		return 0
	operating = 1
	do_animate("opening")
	SetOpacity(0)
	sleep(5)
	density = 0
	sleep(5)
	layer = OPEN_DOOR_LAYER
	update_icon()
	SetOpacity(0)
	operating = 0
	air_update_turf(1)
	update_freelook_sight()
	if(autoclose)
		spawn(autoclose)
			close()
	return 1
User avatar
Remie Richards
Joined: Thu Apr 17, 2014 7:11 pm
Byond Username: CrimsonVision
Location: England, UK, Earth, Sol, Milky Way, Local Group, Virgo Supercluster, Known Universe
Contact:

Re: 'Please murder me slowly' pieces of code

Post by Remie Richards » #246672

lzimann wrote:So, I am currently refactoring all gamemode code, and for that I set the ticker.mode to always be null. With that, I discovered that doors/airlocks are dependent on ticker.mode existing.

This one is the open() proc for doors. The code is not pretty overall, but notice the if(!ticker || !ticker.mode) there. It also happens in airlocks.

Code: Select all

/obj/machinery/door/proc/open()
	if(!density)
		return 1
	if(operating)
		return
	if(!ticker || !ticker.mode)
		return 0
	operating = 1
	do_animate("opening")
	SetOpacity(0)
	sleep(5)
	density = 0
	sleep(5)
	layer = OPEN_DOOR_LAYER
	update_icon()
	SetOpacity(0)
	operating = 0
	air_update_turf(1)
	update_freelook_sight()
	if(autoclose)
		spawn(autoclose)
			close()
	return 1
There's a good reason for this, ticker.mode used to be one of the only methods to determine what state the game was in, if it was null, you're in the lobby or the spawn room (which no longer exists thank god), if it's non-null, the round is "in progress" and things such as doors can now work.

the spawn room thing is terrible aswell as there used to be area-checks inside attack code that just said "stop hitting people in spawn jackass" or something to that effect.
私は完璧
lzimann
Joined: Sun Oct 26, 2014 5:13 am
Byond Username: Lzimann
Github Username: lzimann

Re: 'Please murder me slowly' pieces of code

Post by lzimann » #246674

Remie Richards wrote:snip
I imagined it was something like that, but still... it hurts
User avatar
Remie Richards
Joined: Thu Apr 17, 2014 7:11 pm
Byond Username: CrimsonVision
Location: England, UK, Earth, Sol, Milky Way, Local Group, Virgo Supercluster, Known Universe
Contact:

Re: 'Please murder me slowly' pieces of code

Post by Remie Richards » #246676

lzimann wrote:
Remie Richards wrote:snip
I imagined it was something like that, but still... it hurts
I know it does, but it's ok, were passed it now... mostly... higher standards and all.
stiff upper lip, the british way! ;_;
私は完璧
User avatar
Ricotez
Joined: Thu Apr 17, 2014 9:21 pm
Byond Username: Ricotez
Location: The Netherlands

Re: 'Please murder me slowly' pieces of code

Post by Ricotez » #246684

was there a point in this game's past where the lobby room was an actual room where people could move around and try to attack each other? because that might explain that code

EDIT: sorry, I read right over what you said about there really once having been a spawn room
MimicFaux wrote:I remember my first time, full of wonderment and excitement playing this game I had heard so many stories about.
on the arrival shuttle, I saw the iconic toolbox on the ground. I clubbed myself in the head with it trying to figure out the controls.
Setting the tool box, now bloodied, back on the table; I went to heal myself with a medkit. I clubbed myself in the head with that too.
I've come a long ways from asking how to switch hands.
Spoiler:
#coderbus wrote:<MrPerson> How many coders does it take to make a lightbulb? Three, one to make it, one to pull the pull request, and one to fix the bugs
Kor wrote:The lifeweb playerbase is primarily old server 2 players so technically its our cancer that invaded them
peoplearestrange wrote:Scared of shadows whispers in their final breath, "/tg/station... goes on the tabl..."
DemonFiren wrote:Please, an Engineer's first response to a problem is "throw it into the singulo".
tedward1337 wrote:Donald Trump is literally what /pol/ would look like as a person
CrunchyCHEEZIT wrote:why does everything on this server have to be a federal fucking issue.
Saegrimr wrote:One guy was running around popping hand tele portals down in the halls before OPs even showed up and got several stranded out on lavaland.
The HoP just toolboxes someone to death out of nowhere, then gets speared by a chemist who saw him murder a guy, then the chemist gets beaten to death because someone else saw him kill the HoP.
Tele-man somehow dies and gets its looted by an atmos tech who managed to use it to send two nuke ops to lavaland, who were then surrounded by several very angry people from earlier and some extra golems on top of it.
Captain dies, gets cloned/revived, lasers the guy holding the disk into crit to take it back.
Some idiot tries to welderbomb the AI hiding out at mining for no discernible reason.
Two permabans and a dayban, i'm expecting a snarky appeal from one of them soon. What the fuck.
ShadowDimentio wrote:I am the problem
4dplanner
Joined: Thu Mar 23, 2017 2:51 am
Byond Username: 4DPlanner
Github Username: 4dplanner

Re: 'Please murder me slowly' pieces of code

Post by 4dplanner » #282593

XDTM wrote:So basically you inject double the mutagen if you use vapor
I still don't get it - why?

E: I mean, I see it calls ..() twice but that doesn't seem to be vapor specific, so I'm still confused.
Image
User avatar
Remie Richards
Joined: Thu Apr 17, 2014 7:11 pm
Byond Username: CrimsonVision
Location: England, UK, Earth, Sol, Milky Way, Local Group, Virgo Supercluster, Known Universe
Contact:

Re: 'Please murder me slowly' pieces of code

Post by Remie Richards » #282595

4dplanner wrote:
XDTM wrote:So basically you inject double the mutagen if you use vapor
I still don't get it - why?

E: I mean, I see it calls ..() twice but that doesn't seem to be vapor specific, so I'm still confused.
check it out

Code: Select all

/datum/reagent/proc/reaction_mob(mob/living/M, method=TOUCH, reac_volume, show_message = 1, touch_protection = 0)
	if(!istype(M))
		return 0
	if(method == VAPOR) //smoke, foam, spray
		if(M.reagents)
			var/modifier = Clamp((1 - touch_protection), 0, 1)
			var/amount = round(reac_volume*modifier, 0.1)
			if(amount >= 0.5)
				M.reagents.add_reagent(id, amount)
   return 1
if the method is VAPOR, it adds the reagents to the mob.
This proc only fails if the mob isn't a mob, which means it passes !..(), and eventually goes on to the second ..(), running this entire proc twice, including the reagent injection.

Which means double reagents from vapor.
私は完璧
User avatar
oranges
Code Maintainer
Joined: Tue Apr 15, 2014 9:16 pm
Byond Username: Optimumtact
Github Username: optimumtact
Location: #CHATSHITGETBANGED

Re: 'Please murder me slowly' pieces of code

Post by oranges » #282603

Remie Richards wrote:the spawn room thing is terrible aswell as there used to be area-checks inside attack code that just said "stop hitting people in spawn jackass" or something to that effect.
Still some remenants of this lurking to this day

from https://github.com/tgstation/tgstation/pull/25329

Code: Select all

/mob/living/attack_alien(mob/living/carbon/alien/humanoid/M)
	if(isturf(loc) && istype(loc.loc, /area/start))
		to_chat(M, "No attacking people at spawn, you jackass.")
                return 0
Naksu
Joined: Sun Nov 19, 2017 1:13 am
Byond Username: Naksuasdf
Github Username: vuonojenmustaturska

Re: 'Please murder me slowly' pieces of code

Post by Naksu » #359239

Consider a scenario: a piece of code wants to send a chat message to all the drones that should be visible to dead people.

Code: Select all

/proc/_alert_drones(msg, dead_can_hear = 0, atom/source, mob/living/faction_checked_mob, exact_faction_match)
	for(var/W in GLOB.mob_list)
		var/mob/living/simple_animal/drone/M = W
		if(istype(M) && M.stat != DEAD)
			if(faction_checked_mob)
				if(M.faction_check_mob(faction_checked_mob, exact_faction_match))
					to_chat(M, msg)
			else
				to_chat(M, msg)
		if(dead_can_hear && source && (M in GLOB.dead_mob_list))
			var/link = FOLLOW_LINK(M, source)
			to_chat(M, "[link] [msg]")
User avatar
XDTM
Github User
Joined: Fri Mar 04, 2016 8:38 pm
Byond Username: XDTM
Github Username: XDTM
Location: XDTM

Re: 'Please murder me slowly' pieces of code

Post by XDTM » #360568

Looks like standard saycode to me
a.k.a. Duke Hayka

Coder of golems, virology, hallucinations, traumas, nanites, and a bunch of miscellaneous stuff.
User avatar
FrozenGuy5
Github User
Joined: Thu Jun 01, 2017 9:56 pm
Byond Username: FrozenGuy5
Github Username: praisenarsie

Re: 'Please murder me slowly' pieces of code

Post by FrozenGuy5 » #361765

XDTM wrote:Looks like standard saycode to me

good joke
ййййййййййййййййййййййййййййййййййййййййййййййййййййййййййййййййййййййййййййййййййййййййййййййййййййййййййййййййййййййййййййййййййййййййййййй shitty fucking signatures
Naksu
Joined: Sun Nov 19, 2017 1:13 am
Byond Username: Naksuasdf
Github Username: vuonojenmustaturska

Re: 'Please murder me slowly' pieces of code

Post by Naksu » #363555

FrozenGuy5 wrote:
XDTM wrote:Looks like standard saycode to me

good joke
Yeah, this pattern is not used elsewhere.
Image
But don't worry, surely it's just some ancient piece of code floating around? right? Let's see what git blame says...
Image
User avatar
kevinz000
Joined: Fri Nov 14, 2014 8:41 am
Byond Username: Kevinz000
Github Username: kevinz000
Location: Dorm Room 3

Re: 'Please murder me slowly' pieces of code

Post by kevinz000 » #363714

mrty
canvas123
Joined: Wed Mar 15, 2017 3:30 pm
Byond Username: Tmpaccount

Re: 'Please murder me slowly' pieces of code

Post by canvas123 » #370273

Harsh Chromium developers that harsh, that they parse URL manually without any util's
C++-snippet from chromium shit:
Image
Naksu
Joined: Sun Nov 19, 2017 1:13 am
Byond Username: Naksuasdf
Github Username: vuonojenmustaturska

Re: 'Please murder me slowly' pieces of code

Post by Naksu » #370472

Image
Buggy
Joined: Sun Jan 24, 2016 3:54 am
Byond Username: Buggy1234

Re: 'Please murder me slowly' pieces of code

Post by Buggy » #385119

Found in stack.dm

Image
Gun Hog
Joined: Sat Apr 19, 2014 5:19 am
Byond Username: Gun Hog

Re: 'Please murder me slowly' pieces of code

Post by Gun Hog » #385285

I love it when the comments give you proper warning, too!
User avatar
MrStonedOne
Host
Joined: Mon Apr 14, 2014 10:56 pm
Byond Username: MrStonedOne
Github Username: MrStonedOne

Re: 'Please murder me slowly' pieces of code

Post by MrStonedOne » #386963

Forum/Wiki Administrator, Server host, Database King, Master Coder
MrStonedOne on digg(banned), Steam, IRC, Skype Discord. (!vAKvpFcksg)
Image
SpaceManiac
Joined: Fri Sep 22, 2017 4:06 am
Byond Username: SpaceManiac
Github Username: SpaceManiac

Re: 'Please murder me slowly' pieces of code

Post by SpaceManiac » #387032

Discovered on yogstation:

Code: Select all

// in machines.dm
#define OPEN    1
#define IDSCAN  2
#define BOLTS   4
#define SHOCK   8

// in firedoor.dm
/var/const/OPEN = 1
/var/const/CLOSED = 2
That's right,

Code: Select all

/var/const/1 = 1
compiles.
User avatar
Qbopper
Joined: Fri Jul 10, 2015 6:34 pm
Byond Username: Qbopper
Github Username: Qbopper
Location: Canada

Re: 'Please murder me slowly' pieces of code

Post by Qbopper » #387203

SpaceManiac wrote:Discovered on yogstation:

Code: Select all

// in machines.dm
#define OPEN    1
#define IDSCAN  2
#define BOLTS   4
#define SHOCK   8

// in firedoor.dm
/var/const/OPEN = 1
/var/const/CLOSED = 2
That's right,

Code: Select all

/var/const/1 = 1
compiles.
delete this post please
Limey wrote:its too late.
Gun Hog
Joined: Sat Apr 19, 2014 5:19 am
Byond Username: Gun Hog

Re: 'Please murder me slowly' pieces of code

Post by Gun Hog » #387512

I think a part of my brain died while reading that heresy from Yog.
User avatar
oranges
Code Maintainer
Joined: Tue Apr 15, 2014 9:16 pm
Byond Username: Optimumtact
Github Username: optimumtact
Location: #CHATSHITGETBANGED

Re: 'Please murder me slowly' pieces of code

Post by oranges » #387531

SpaceManiac wrote:Discovered on yogstation:

Code: Select all

// in machines.dm
#define OPEN    1
#define IDSCAN  2
#define BOLTS   4
#define SHOCK   8

// in firedoor.dm
/var/const/OPEN = 1
/var/const/CLOSED = 2
That's right,

Code: Select all

/var/const/1 = 1
compiles.
does it actually resolve the define before the const?
User avatar
Cyberboss
Code Maintainer
Joined: Mon Sep 26, 2016 7:58 pm
Byond Username: Cyberboss
Github Username: Cyberboss
Location: Ontario, CA
Contact:

Re: 'Please murder me slowly' pieces of code

Post by Cyberboss » #387556

Code: Select all

[09:53:31] <Cyberboss> !dm /var/const/1 = 1;;
[09:53:33] <Bot32> Cyberboss: 
ImageImage
User avatar
Dax Dupont
In-Game Admin
Joined: Sun Apr 20, 2014 9:07 pm
Byond Username: DaxYeen
Github Username: DaxDupont
Location: Belgium

Re: 'Please murder me slowly' pieces of code

Post by Dax Dupont » #402379

Code: Select all

	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
https://github.com/tgstation/tgstation/ ... #L142-L146
User avatar
ohnopigeons
Joined: Thu Oct 16, 2014 11:22 pm
Byond Username: Ohnopigeons
Github Username: ohnopigeons

Re: 'Please murder me slowly' pieces of code

Post by ohnopigeons » #402495

Dax Dupont wrote:

Code: Select all

	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
https://github.com/tgstation/tgstation/ ... #L142-L146
What the fuck is that conditional even for? Because I'm seeing an if(TRUE).
Image
User avatar
DemonFiren
Joined: Sat Dec 13, 2014 9:15 pm
Byond Username: DemonFiren

Re: 'Please murder me slowly' pieces of code

Post by DemonFiren » #402499

the goofiest variable names I've seen in a while
Image
Image
Image
ImageImageImageImageImage

non-lizard things:
Spoiler:
Image
User avatar
Stickymayhem
Joined: Mon Apr 28, 2014 6:13 pm
Byond Username: Stickymayhem

Re: 'Please murder me slowly' pieces of code

Post by Stickymayhem » #402566

Dax Dupont wrote:

Code: Select all

	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
https://github.com/tgstation/tgstation/ ... #L142-L146
>goof: i'll admit this meme is bandaid as FUCK but it'll also help us diagnose the problem

>Aug 2016
Image
Image
Boris wrote:Sticky is a jackass who has worms where his brain should be, but he also gets exactly what SS13 should be
Super Aggro Crag wrote: Wed Oct 13, 2021 6:17 pm Dont engage with sticky he's a subhuman
LifeReign
Joined: Mon Mar 06, 2017 10:57 pm
Byond Username: LifeReign

Re: 'Please murder me slowly' pieces of code

Post by LifeReign » #403178

Best part is that it didn't even fix the problem. Why do we keep goof around again?
Bagil- Eats-Shoots-and-Leaves: Probably the botanist
User avatar
DemonFiren
Joined: Sat Dec 13, 2014 9:15 pm
Byond Username: DemonFiren

Re: 'Please murder me slowly' pieces of code

Post by DemonFiren » #403340

who else are we gonna vote for headmin?
Image
Image
Image
ImageImageImageImageImage

non-lizard things:
Spoiler:
Image
LifeReign
Joined: Mon Mar 06, 2017 10:57 pm
Byond Username: LifeReign

Re: 'Please murder me slowly' pieces of code

Post by LifeReign » #403626

Let's be honest, Goof could be entirely forumbanned and repobanned, and he'd still try to run for headmin. Also, Goof for headmin is becoming a stale meme, we need a fresh meme headmin candidate.
Bagil- Eats-Shoots-and-Leaves: Probably the botanist
User avatar
Cobby
Code Maintainer
Joined: Sat Apr 19, 2014 7:19 pm
Byond Username: ExcessiveUseOfCobby
Github Username: ExcessiveUseOfCobblestone

Re: 'Please murder me slowly' pieces of code

Post by Cobby » #403768

i vote john oxford
Voted best trap in /tg/ 2014-current
User avatar
John_Oxford
Github User
Joined: Sat Nov 15, 2014 5:19 am
Byond Username: John Oxford
Github Username: JohnOxford
Location: The United States of America

Re: 'Please murder me slowly' pieces of code

Post by John_Oxford » #407125

gunsmithing soon™
Bill Rowe - Used for everything // SYS-OP - AI // SYS-USR - Cyborg
https://gyazo.com/07cbe7219ba24366c1f655ad6c56a524

Signature Content:
Spoiler:
Offical In-Game rank:
Image

Image

Image

Image
TechnoAlchemist wrote:you where always right john, you where always right
>implying the admin conspiracy wasen't just confirmed by a admin.
see, i told you motherfuckers.
NikNakFlak wrote:this isn't a game you can't just post whenever you want
I don't even know what the fuck tg is.

Image

Image
User avatar
iksyp
Joined: Mon Apr 02, 2018 9:47 pm
Byond Username: Iksyp
Location: usa usa usa usa usa(?)

Re: 'Please murder me slowly' pieces of code

Post by iksyp » #436611

necroing this thread because cm code leak is uh
Image
it still compiles so i guess it's not really doing anything wrong but HOLY SHIT I HATE IT
User avatar
DemonFiren
Joined: Sat Dec 13, 2014 9:15 pm
Byond Username: DemonFiren

Re: 'Please murder me slowly' pieces of code

Post by DemonFiren » #436652

LifeReign wrote:Let's be honest, Goof could be entirely forumbanned and repobanned, and he'd still try to run for headmin. Also, Goof for headmin is becoming a stale meme, we need a fresh meme headmin candidate.
prophetic tbh
Image
Image
Image
ImageImageImageImageImage

non-lizard things:
Spoiler:
Image
Post Reply

Who is online

Users browsing this forum: No registered users