Page 2 of 2

Re: 'Please murder me slowly' pieces of code

PostPosted: Fri Jan 06, 2017 8:37 am
by XDTM
So basically you inject double the mutagen if you use vapor

Re: 'Please murder me slowly' pieces of code

PostPosted: Sun Jan 22, 2017 1:49 pm
by lzimann
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

Re: 'Please murder me slowly' pieces of code

PostPosted: Sun Jan 22, 2017 1:53 pm
by Remie Richards
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.

Re: 'Please murder me slowly' pieces of code

PostPosted: Sun Jan 22, 2017 1:56 pm
by lzimann
Remie Richards wrote:snip


I imagined it was something like that, but still... it hurts

Re: 'Please murder me slowly' pieces of code

PostPosted: Sun Jan 22, 2017 1:58 pm
by Remie Richards
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! ;_;

Re: 'Please murder me slowly' pieces of code

PostPosted: Sun Jan 22, 2017 3:13 pm
by Ricotez
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

Re: 'Please murder me slowly' pieces of code

PostPosted: Wed Apr 19, 2017 11:42 am
by 4dplanner
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.

Re: 'Please murder me slowly' pieces of code

PostPosted: Wed Apr 19, 2017 11:48 am
by Remie Richards
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.

Re: 'Please murder me slowly' pieces of code

PostPosted: Wed Apr 19, 2017 12:34 pm
by oranges
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

Re: 'Please murder me slowly' pieces of code

PostPosted: Sun Nov 19, 2017 1:23 am
by Naksu
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]")

Re: 'Please murder me slowly' pieces of code

PostPosted: Fri Nov 24, 2017 3:13 pm
by XDTM
Looks like standard saycode to me

Re: 'Please murder me slowly' pieces of code

PostPosted: Wed Nov 29, 2017 2:13 pm
by FrozenGuy5
XDTM wrote:Looks like standard saycode to me



good joke

Re: 'Please murder me slowly' pieces of code

PostPosted: Wed Dec 06, 2017 12:45 am
by Naksu
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

Re: 'Please murder me slowly' pieces of code

PostPosted: Wed Dec 06, 2017 1:34 pm
by kevinz000
mrty

Re: 'Please murder me slowly' pieces of code

PostPosted: Tue Jan 02, 2018 10:46 am
by canvas123
Harsh Chromium developers that harsh, that they parse URL manually without any util's
C++-snippet from chromium shit:
Image

Re: 'Please murder me slowly' pieces of code

PostPosted: Wed Jan 03, 2018 2:28 pm
by Naksu
Image

Re: 'Please murder me slowly' pieces of code

PostPosted: Sun Feb 25, 2018 3:30 pm
by Buggy
Found in stack.dm

Image

Re: 'Please murder me slowly' pieces of code

PostPosted: Mon Feb 26, 2018 1:19 am
by Gun Hog
I love it when the comments give you proper warning, too!

Re: 'Please murder me slowly' pieces of code

PostPosted: Sat Mar 03, 2018 2:25 am
by MrStonedOne

Re: 'Please murder me slowly' pieces of code

PostPosted: Sat Mar 03, 2018 6:52 am
by SpaceManiac
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.

Re: 'Please murder me slowly' pieces of code

PostPosted: Sat Mar 03, 2018 10:09 pm
by Qbopper
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

Re: 'Please murder me slowly' pieces of code

PostPosted: Mon Mar 05, 2018 6:41 am
by Gun Hog
I think a part of my brain died while reading that heresy from Yog.

Re: 'Please murder me slowly' pieces of code

PostPosted: Mon Mar 05, 2018 10:42 am
by oranges
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?

Re: 'Please murder me slowly' pieces of code

PostPosted: Mon Mar 05, 2018 2:56 pm
by Cyberboss
Code: Select all
[09:53:31] <Cyberboss> !dm /var/const/1 = 1;;
[09:53:33] <Bot32> Cyberboss:

Re: 'Please murder me slowly' pieces of code

PostPosted: Mon Apr 23, 2018 1:55 pm
by Dax Dupont
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

[Deleted]

PostPosted: Mon Apr 23, 2018 1:55 pm
by Dax Dupont
PostThis post was deleted by Dax Dupont on Mon Apr 23, 2018 3:59 pm.

Re: 'Please murder me slowly' pieces of code

PostPosted: Tue Apr 24, 2018 1:21 am
by ohnopigeons
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).

Re: 'Please murder me slowly' pieces of code

PostPosted: Tue Apr 24, 2018 1:41 am
by DemonFiren
the goofiest variable names I've seen in a while

Re: 'Please murder me slowly' pieces of code

PostPosted: Tue Apr 24, 2018 11:58 am
by Stickymayhem
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

Re: 'Please murder me slowly' pieces of code

PostPosted: Tue Apr 24, 2018 9:36 pm
by LifeReign
Best part is that it didn't even fix the problem. Why do we keep goof around again?

Re: 'Please murder me slowly' pieces of code

PostPosted: Wed Apr 25, 2018 8:39 am
by DemonFiren
who else are we gonna vote for headmin?

Re: 'Please murder me slowly' pieces of code

PostPosted: Wed Apr 25, 2018 6:01 pm
by LifeReign
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.

Re: 'Please murder me slowly' pieces of code

PostPosted: Wed Apr 25, 2018 10:31 pm
by Cobby
i vote john oxford

Re: 'Please murder me slowly' pieces of code

PostPosted: Sat May 05, 2018 2:30 am
by John_Oxford
gunsmithing soon™

Re: 'Please murder me slowly' pieces of code

PostPosted: Sat Sep 01, 2018 3:39 am
by iksyp
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

Re: 'Please murder me slowly' pieces of code

PostPosted: Sat Sep 01, 2018 8:39 am
by DemonFiren
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