'Please murder me slowly' pieces of code

How, what and why to code in BYOND.

Moderators: MisterPerson, Code Maintainers

User avatar
XDTM
Github User
 
Joined: Fri Mar 04, 2016 8:38 pm
Location: XDTM
Byond Username: XDTM
Github Username: XDTM

Re: 'Please murder me slowly' pieces of code

Postby XDTM » Fri Jan 06, 2017 8:37 am #241311

So basically you inject double the mutagen if you use vapor
Patron of golems, virology, hallucinations and traumas. And now, nanites.

Ex-Keeper of the wiki.



lzimann
 
Joined: Sun Oct 26, 2014 5:13 am
Byond Username: Lzimann
Github Username: lzimann

Re: 'Please murder me slowly' pieces of code

Postby lzimann » Sun Jan 22, 2017 1:49 pm #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
Location: England, UK, Earth, Sol, Milky Way, Local Group, Virgo Supercluster, Known Universe
Byond Username: CrimsonVision

Re: 'Please murder me slowly' pieces of code

Postby Remie Richards » Sun Jan 22, 2017 1:53 pm #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

Postby lzimann » Sun Jan 22, 2017 1:56 pm #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
Location: England, UK, Earth, Sol, Milky Way, Local Group, Virgo Supercluster, Known Universe
Byond Username: CrimsonVision

Re: 'Please murder me slowly' pieces of code

Postby Remie Richards » Sun Jan 22, 2017 1:58 pm #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
Location: The Netherlands
Byond Username: Ricotez

Re: 'Please murder me slowly' pieces of code

Postby Ricotez » Sun Jan 22, 2017 3:13 pm #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

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

User avatar
Remie Richards
 
Joined: Thu Apr 17, 2014 7:11 pm
Location: England, UK, Earth, Sol, Milky Way, Local Group, Virgo Supercluster, Known Universe
Byond Username: CrimsonVision

Re: 'Please murder me slowly' pieces of code

Postby Remie Richards » Wed Apr 19, 2017 11:48 am #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
Location: #CHATSHITGETBANGED
Byond Username: Optimumtact
Github Username: optimumtact

Re: 'Please murder me slowly' pieces of code

Postby oranges » Wed Apr 19, 2017 12:34 pm #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
Image

Naksu
 
Joined: Sun Nov 19, 2017 1:13 am
Byond Username: Naksuasdf
Github Username: vuonojenmustaturska

Re: 'Please murder me slowly' pieces of code

Postby Naksu » Sun Nov 19, 2017 1:23 am #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
Location: XDTM
Byond Username: XDTM
Github Username: XDTM

Re: 'Please murder me slowly' pieces of code

Postby XDTM » Fri Nov 24, 2017 3:13 pm #360568

Looks like standard saycode to me
Patron of golems, virology, hallucinations and traumas. And now, nanites.

Ex-Keeper of the wiki.

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

Postby FrozenGuy5 » Wed Nov 29, 2017 2:13 pm #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

Postby Naksu » Wed Dec 06, 2017 12:45 am #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
In-Game Admin
 
Joined: Fri Nov 14, 2014 8:41 am
Location: Dorm Room 3
Byond Username: Kevinz000
Github Username: kevinz000

Re: 'Please murder me slowly' pieces of code

Postby kevinz000 » Wed Dec 06, 2017 1:34 pm #363714

mrty

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

Re: 'Please murder me slowly' pieces of code

Postby canvas123 » Tue Jan 02, 2018 10:46 am #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

Postby Naksu » Wed Jan 03, 2018 2:28 pm #370472

Image

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

Re: 'Please murder me slowly' pieces of code

Postby Buggy » Sun Feb 25, 2018 3:30 pm #385119

Found in stack.dm

Image

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

Re: 'Please murder me slowly' pieces of code

Postby Gun Hog » Mon Feb 26, 2018 1:19 am #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

Postby MrStonedOne » Sat Mar 03, 2018 2:25 am #386963

Forum/Wiki Administrator, Server host, Database King, Master Coder


MrStonedOne on Reddit(banned), Steam, IRC, Skype Discord.

[10:55 AM] spookydonut: stonedmc is the work of a criminally insane mad genius

SpaceManiac
Code Maintainer
 
Joined: Fri Sep 22, 2017 4:06 am
Byond Username: SpaceManiac
Github Username: SpaceManiac

Re: 'Please murder me slowly' pieces of code

Postby SpaceManiac » Sat Mar 03, 2018 6:52 am #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
Location: Canada
Byond Username: Qbopper
Github Username: Qbopper

Re: 'Please murder me slowly' pieces of code

Postby Qbopper » Sat Mar 03, 2018 10:09 pm #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.

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

Re: 'Please murder me slowly' pieces of code

Postby Gun Hog » Mon Mar 05, 2018 6:41 am #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
Location: #CHATSHITGETBANGED
Byond Username: Optimumtact
Github Username: optimumtact

Re: 'Please murder me slowly' pieces of code

Postby oranges » Mon Mar 05, 2018 10:42 am #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?
Image

User avatar
Cyberboss
Code Maintainer
 
Joined: Mon Sep 26, 2016 7:58 pm
Location: Ontario, CA
Byond Username: Cyberboss
Github Username: Cyberboss

Re: 'Please murder me slowly' pieces of code

Postby Cyberboss » Mon Mar 05, 2018 2:56 pm #387556

Code: Select all
[09:53:31] <Cyberboss> !dm /var/const/1 = 1;;
[09:53:33] <Bot32> Cyberboss:

User avatar
Dax Dupont
In-Game Admin
 
Joined: Sun Apr 20, 2014 9:07 pm
Location: Belgium
Byond Username: DaxYeen
Github Username: DaxDupont

Re: 'Please murder me slowly' pieces of code

Postby Dax Dupont » Mon Apr 23, 2018 1:55 pm #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

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

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

Postby ohnopigeons » Tue Apr 24, 2018 1:21 am #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

Postby DemonFiren » Tue Apr 24, 2018 1:41 am #402499

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

non-lizard things:
Spoiler:
Image

User avatar
Stickymayhem
In-Game Game Master
 
Joined: Mon Apr 28, 2014 6:13 pm
Byond Username: Stickymayhem

Re: 'Please murder me slowly' pieces of code

Postby Stickymayhem » Tue Apr 24, 2018 11:58 am #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

Omni Tears

Spoiler:
Image
Image
Image

LifeReign
 
Joined: Mon Mar 06, 2017 10:57 pm
Byond Username: LifeReign

Re: 'Please murder me slowly' pieces of code

Postby LifeReign » Tue Apr 24, 2018 9:36 pm #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

Postby DemonFiren » Wed Apr 25, 2018 8:39 am #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

Postby LifeReign » Wed Apr 25, 2018 6:01 pm #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

Postby Cobby » Wed Apr 25, 2018 10:31 pm #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
Location: The United States of America
Byond Username: John Oxford
Github Username: JohnOxford

Re: 'Please murder me slowly' pieces of code

Postby John_Oxford » Sat May 05, 2018 2:30 am #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
Location: freedom land
Byond Username: Iksyp

Re: 'Please murder me slowly' pieces of code

Postby iksyp » Sat Sep 01, 2018 3:39 am #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
ignore this poster he has brain damage

User avatar
DemonFiren
 
Joined: Sat Dec 13, 2014 9:15 pm
Byond Username: DemonFiren

Re: 'Please murder me slowly' pieces of code

Postby DemonFiren » Sat Sep 01, 2018 8:39 am #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

Previous

Return to Coding

Who is online

Users browsing this forum: RobustAndRun