Lore and SS13 for Experienced Programmers: Difference between pages

From Chompstation Wiki
(Difference between pages)
Jump to navigation Jump to search
imported>Raeschen
m (Add name of assigned space station + link)
 
imported>Nadyr
(Page restored.)
 
Line 1: Line 1:
{{OldLore}}
{{BayPage}}
{{hatnote|This article was gratefully copied from the corresponding page on the [http://tgstation13.org/wiki/SS13_for_experienced_programmers /tg/station13 wiki].}}
Other related guides: [[Basics of Coding in BYOND]] and the [[Guide to Mapping]]


===== '''Welcome to the CHOMPstation lore page!''' =====
So you know how to write programs in other languages and would like a quick guide on how to understand and code for SS13? Good, this is the guide for you. It likely doesn't contain everything that you need to know but it's a start.
<div class="mw-collapsible-content">


This is the overview page of CHOMPstation's lore, also commonly known as 'fluff' (but we usually just call it lore). This is the basic, common knowledge that the vast majority of characters should know and helps introduce you, the player, into the world of our server. While you do not have to know every little detail by heart it would be wise to skim through some of the pages to at least to know how our lore differs to the other SS13 servers.
== Syntax ==


Many wiki lore pages are constantly under construction and open to change, so if you feel like you may have something to add please discuss your ideas with our Loremaster (Nadyr) via Discord. Note:''' ''Unlike other pages of this wiki, changes to these pages must be approved by Nadyr'' Please consult the [[Guide to Lore Writing]] before pitching an idea.  
*Semicolons at the end are not mandatory,
*Loop, proc, object, variable etc. spans are determined by indentations (similar to Python, see examples below)
  /obj
    var
      i1
      i2
      i3
is the same as (Strongly recommended you use this layout to make searching for variable and proc definitions easier.)
  /obj
    var/i1
    var/i2
    var/i3
which is inturn the same as
  /obj/var/i1
  /obj/var/i2
  /obj/var/i3
*This guide uses the word 'object' for any defined type (see [[#Variable types|Variable types]]) and the word 'obj' for derivatives of atom/obj, which are all objects which can be placed on the map.
*This guide uses the word 'AI controlled' for behavior to do with an [[AI]] player controlling an item. The term 'Game controlled' is used when refering to behavior which the script itself determins (Usually called AI controlled creatures or NPCs)
*All things are inherited from parent objects. If a variable is defined in /obj/item, it doesn't need to be (actually can't be) redefined in /obj/item/weapon.


Once again welcome to CHOMPstation, we hope your stay here is a long and enjoyable one!
=== [http://www.byond.com/members/?command=reference&path=var Variables] ===
Variables are very general, Byond makes no difference in the declaration of strings, integers, etc. (Similar to PHP)


</div>{{toc_right}}
==== [http://www.byond.com/members/?command=reference&path=var Predefined variables] ====
[[File:Planet_Sif.png|thumbnail|left|Sif]]The year is {{CurrentYear}} CE (Common Era). With the help of massive colony ships, humanity had slowly spread and colonized our sun's neighboring systems. [[Alpha Centauri]], [[Tau Ceti]], [[Sirius]] and more are connected by a network of [[FTL Travel|warpgates]] that makes travel between systems take as little as hours instead of decades. With the discovery of the seemingly supernatural [[Phoron and Bluespace|phoron]] and [[Phoron and Bluespace|bluespace]], on-ship [[FTL Travel|FTL drives]] became a possibility, increasing the speed at which humanity expanded and colonized the stars at a never before imagined rate.
There is a lot of predefined variables for objects in BYOND, but the most important are:
*'''[http://www.byond.com/members/?command=reference&path=proc%2Fvar%2Fsrc src]''' - a variable equal to the object containing the proc or verb. It is defined to have the same type as that object. (Similar to "this" in Java or C++)
*'''[http://www.byond.com/members/?command=reference&path=proc%2Fvar%2Fusr usr]''' - a mob variable (var/mob/usr) containing the mob of the player who executed the current verb, or whose action ultimately called the current proc. '''A good rule of thumb is to never put usr in a proc.''' If src would not be the correct choice, it is better to send another argument to your proc with the information it needs.
*'''[http://www.byond.com/members/?command=reference&path=proc%2Fvar%2Fargs args]''' - a list of the arguments passed to the proc or verb.
*'''[http://www.byond.com/members/?command=reference&path=datum%2Fvar%2Fvars vars]''' - a list of object variables. If the variable name is used as an index into the list, the value of that variable is accessed.


We aren't alone in this endeavor, the [[skrell]], [[akula]], [[unathi]], [[tajaran]], and more explore the stars alongside of us, expanding the frontier ever further for knowledge and profit.
For more SS13 specific variables see [[#SS13 common variable meanings|SS13 common variable meanings]]


However, danger lurks just around the corner. From hostile aliens like the [[vox]], other, unknown entities whose true names are only whispered in the shadows and existence kept hidden from the common person, are blamed for damaging and causing the disappearances of ships, stations, and [[colonies]] out on the frontier. [[Phoron and Bluespace|phoron]], as beneficial as it is, is still relatively unknown and all of its dangers even more so. Finally, space itself is a cruel, uncaring mistress that countless have lost their lives to, from something as simple as a tear in their space suit to something more sinister to mankind being its own worst enemy.
==== Variable definition ====


==Welcome to the Frontier==
=====Basic definitions=====
Welcome to [[Vir]], a system on the edge of colonized human space, the frontier. You are assigned to work on a space station named the [[NLS Southern Cross]] orbiting [[Sif]], one of the most populated planets in the frontier. Several [[List of Trans-Stellar Corporations|Trans-Stellar Corporations]] (TSC's) including [[NanoTrasen|NanoTrasen Systems Inc.]] (NTS), the [[Free Trade Union]] (FTU) and countless independents hoping to strike it big at [[Vir]] are all vying for control of the system. Vir lacks a stable [[warpgate]], relying instead on ships capable of [[FTL Travel|faster than light (FTL)]] speeds, so [[Sol Central]]'s presence in this system is almost nonexistent. In Vir, NanoTrasen is the de-facto governing body of the star system. They supply all the housing, nearly all of the infrastructure, all emergency services, and employ numerous [[Mercenary|military contractors]] to provide security—some of whom may or may not be playing both sides of any given conflict.
  var/j
  var/i = 4
  var/a, b, c


The universally accepted currency by all but a select few systems and regions is the [[Thaler]], which is backed and supported by Sol Central and its [[Sol Central#Allies|allies]]. It is represented by the symbol "$" (e.g. $130). With the advances of technology, the overall standard of living and education is high even out in the frontier, though glaring examples still exist.
=====Complex definitions=====
The general syntax is [http://www.byond.com/members/?command=reference&path=var var/type/variable_name = value]


==Life in Vir==
Examples:
Out in the frontier, employers, be they a captain of a [[Free Trade Union|Free Trade]] vessel, a [[List of Trans-Stellar Corporations|Trans-Stellar]] executive, or just someone with money to spare and in need of an extra hand, are forced to take just about whoever is willing and apparently able. With [[SolGov]] remaining hands-off, TSC's will happily hire anybody even remotely qualified without regards for typical hiring processes in SolGov space. This and a lack of available employees in general means employees who do prove themselves often find themselves promoted quickly, and put into positions that they are even the slightest bit capable of.
  var/obj/item/I = new/obj/item
  [http://www.byond.com/members/?command=reference&path=operator%2F%40dt%3B I.name] = "Some item"


Unlike in systems where the SolGov takes an active role such as [[Tau Ceti]], the population in Vir is a rich melting pot of sentient species, be they natively born, hybrids, or outright artificial and made of genetically modified flesh or carefully crafted silicon. Your coworkers will often include alien species, some of which you might recognize, and others that you'll be seeing for the first time. Due to exposure to so many different cultures, many of these aliens have lost their accents or cultural identities.
Datum definition and declaration of a variable of that datum type:
  datum/test_datum
    var/test_variable = 0 //declaration of the test_variable var
   
    proc/set_as(var/i) //proc definition within the test_datum datum
      test_variable = i //set the test_variable var to the value in the argument
 
  var/datum/test_datum/TD = new/datum/test_datum //TD will now be a reference to a datum of type test_datum
  TD.test_variable = 4  //Byond doesn't know of private variables, so you can set any variables like this
  [http://www.byond.com/members/?command=reference&path=world world] [http://www.byond.com/members/?command=reference&path=operator%2F%26lt%3B%26lt%3B <<] TD.test_variable //will output 4 to all connected users
  TD.set_as(10) //Will call the set_as proc in the datum with the argument 10
  TD.test_variable //will output 10 to all connected users


While VirGov serves as the ruling body of the Vir system, megacorporations such as NanoTrasen often act as the <i>de facto</i> ruling body for corporate establishments. Most of the non-human immigrants living on Sif and nearby space stations are employees of the corporation or part of a subcontracted company that does business with NanoTrasen.
==== Bitflags ====
Bitflags are variables which use bits instead of numbers to determine conditions. The bit operators are [http://www.byond.com/members/?command=reference&path=operator%2F%26 &] and [http://www.byond.com/members/?command=reference&path=operator%2F%7C |]. For now, you should know that bitflag operators use the binary value of numbers to determine the result. So [http://www.byond.com/members/?command=reference&path=operator%2F%26 13 & 3] will result in 1. ([http://www.byond.com/members/?command=reference&path=operator%2F%26 1101 & 0011 = 0001]) and [http://www.byond.com/members/?command=reference&path=operator%2F%7C 13 | 3 = 15] ([http://www.byond.com/members/?command=reference&path=operator%2F%7C 1101 | 0011 = 1111]) see [[#If|if]] for uses


Many of the inhabitants of Sif fly off-world to work aboard the {{StationName}}.
==== Variable types ====
[http://www.byond.com/members/?command=reference&path=var reference]


== Non-Canon species ==
*[http://www.byond.com/members/?command=reference&path=datum datum] - ordinary object type (class in java)
[[File:Custom_Species_Fuckery.png|200px|thumbnail|right|Example species.
*[http://www.byond.com/members/?command=reference&path=atom atom] - atom derives into obj, turf, mob and area
'''Custom Species'''
*[http://www.byond.com/members/?command=reference&path=turf turf] - tiles which make up the floors, walls and space on SS13
Home planet: ???
*[http://www.byond.com/members/?command=reference&path=area area] - areas are grouped locations. They combine many turfs and it gives some common properties. Power, atmosphere, etc. are determined by areas
*[http://www.byond.com/members/?command=reference&path=mob mob] - an object with life, be it game controlled or player controlled.
*[http://www.byond.com/members/?command=reference&path=obj obj] - objects which can be placed on the map
*[http://www.byond.com/members/?command=reference&path=client client] - a new client object is created for each connected player
*[http://www.byond.com/members/?command=reference&path=list list] - a list of elements. The first element in a list called L is L[1]
*[http://www.byond.com/members/?command=reference&path=world world] - this is a variable where some global variables for the entire world can be set. World's contents var contains all atoms currently in the game world.


Home system: ???
==== [http://www.byond.com/members/?command=reference&path=operator%2F%26lt%3B%26lt%3B%2Foutput Outputting messages] ====
The most basic way of outputting messages is with the [http://www.byond.com/members/?command=reference&path=operator%2F%26lt%3B%26lt%3B%2Foutput '<<' output operator].


Here in Vir our users and staff have created a varied back catalog of bits and bobs for species not specifically listed below. We do not enforce players play one of the canon species listed below. You may bring in your own special snowflake! As long as they, and by extension you, follow our [[Rules#Create and play server-appropriate characters|rules over playing server appropriate characters.]] If you are having trouble [[Character Creation|creating your character]] please refer to our "Character Creation" guide.
  [http://www.byond.com/members/?command=reference&path=world world] [http://www.byond.com/members/?command=reference&path=operator%2F%26lt%3B%26lt%3B <<] "Hello World!" //Outputs a message to all clients in the world
  [http://www.byond.com/members/?command=reference&path=proc%2Fvar%2Fusr usr] [http://www.byond.com/members/?command=reference&path=operator%2F%26lt%3B%26lt%3B <<] "Hello usr" //Outputs a message to only the user who is tied to the calling of the proc which contains this.


==Alien species you will meet==
===== Output with variables =====
The below is a brief overview of humanity and aligned species in the known universe. The links in the name will redirect to further information about the species.
  var/s1 = "Hello"
  var/s2 = "World"
  var/i = 2011
  [http://www.byond.com/members/?command=reference&path=world world] [http://www.byond.com/members/?command=reference&path=operator%2F%26lt%3B%26lt%3B <<] "[s1] [s2], this guide was written in [i]" //Returns "Hello World, this guide was written in 2011"


'''NOTE: If you wish to play a whitelisted or a canon-bending version of one of the species listed below, please log into our forums and head to the [http://www.chompstation13.com/phpbb/viewforum.php?f=7 Species Whitelist] Section and fill out a whitelist form.''' See the [[whitelist]] page for more details.
==== Determining variable types in code ====
The [http://www.byond.com/members/?command=reference&path=proc%2Fistype istype()] proc will come in handy


(Please add new species to the [[:Template:Species|template]] as well.)
Example
  var/obj/item/weapon/W = new/obj/item/weapon/baton
  if([http://www.byond.com/members/?command=reference&path=proc%2Fistype istype](W,/obj/item/weapon/baton))
    [http://www.byond.com/members/?command=reference&path=world world] << "It's a baton!"


===[[Humans]]===
The second argument is optional, if it's omitted, the variable will be checked against its declared type, like
[[file:Background-humans.png|left]]
  var/obj/item/weapon/W = new/obj/item/weapon/baton
'''Home planet''': [[Earth]]
  if([http://www.byond.com/members/?command=reference&path=proc%2Fistype istype](W))
    [http://www.byond.com/members/?command=reference&path=world world] << "It's a weapon!"


'''Home system''': [[Sol]]
Standard code for getting specific arguments from variables which have a type that is a subclass of the type the current proc treats them with (see any attackby() proc for examples). Note that the example below is of a proc which is globaly defined, not tied to the object. It doesn't make much sense to do it like this but it works for the purposes of the example. /obj objects don't have the 'amount' variable, it's defined in /obj/item/stack (as ilustrated by the oversimplified definition of classes below. Also note where var/ is used and where it isn't).
  /obj
    var/name = "Object"
 
  /obj/item
    name = "Item"
 
  /obj/item/stack
    name = "Stack"
    var/amount = 50
 
  proc/get_amount(var/obj/O)
    if([http://www.byond.com/members/?command=reference&path=proc%2Fistype istype](O,/obj/item/stack))
      var/obj/item/stack/S = O
      return [http://www.byond.com/members/?command=reference&path=operator%2F%40dt%3B S.amount]


Humanity, everything and nothing can be said about them. They are the primary driving force for rapid space expansion and perhaps the most populated (known and sentient) species in the galaxy. From atop their [[United Systems of Sol Central|SolGov]] throne their economic prowess helps secure a position on the galactic stage. The vast majority of [[Trans-Stellar Corporations]] are owned by humans, and the mighty USDF is the main military presence in any system where humans make up the majority of the inhabitants. By this time men and women are treated all but equal, however there may still be exceptions.
There is another way of doing this. I'll show you that it exists but it is NOT TO BE USED.
  proc/get_aount(var/obj/S)
    if([http://www.byond.com/members/?command=reference&path=proc%2Fistype istype](O,/obj/item/stack))
      return [http://www.byond.com/members/?command=reference&path=operator%2F%3A O:amount]
The [http://www.byond.com/members/?command=reference&path=operator%2F%3A colon operator] (:) in the example above tells the byond compiler: "I know what I'm doing, so ignore the fact the object doesn't have this variable, I'll make sure it works myself." The problem is that people will revise your code and use it in ways you never planed for. This means something might eventually make the O:amount throw exceptions in the form of runtime errors. Some variables might eventually need to be removed or replaced and this is impossible when they are used with object:variable as the compiler will not throw an error when the variable is removed. The error will only become apparent after the game is ran on the live server which might cause it to crash. So just don't use this method, ever.


While most humans are accepting of other species and simply want to earn an honest paycheck, the best and worst are found among them. You never know what a human is going to be like when you first meet them.
There are some shortcuts to [http://www.byond.com/members/?command=reference&path=proc%2Fistype istype()] proc:<br>
[http://www.byond.com/members/?command=reference&path=proc%2Fisarea isarea(variable)] = istype(variable, /area)<br>
[http://www.byond.com/members/?command=reference&path=proc%2Fisicon isicon(variable)] = istype(variable, /icon)<br>
[http://www.byond.com/members/?command=reference&path=proc%2Fismob ismob(variable)]  = istype(variable, /mob)<br>
[http://www.byond.com/members/?command=reference&path=proc%2Fisobj isobj(variable)]  = istype(variable, /obj)<br>
[http://www.byond.com/members/?command=reference&path=proc%2Fisturf isturf(variable)] = istype(variable, /turf)<br>
[http://www.byond.com/members/?command=reference&path=proc%2Fisloc isloc(variable)]  = ismob(variable) || isobj(variable) || isturf(variable) || isarea(variable)


Due to their prevalence in current known space, and their ability to encompass all traits, good and bad, humanity is often considered the 'status quo'.
==== Switching between variable types in code ====


===[[Skrell]]===
Byond defined:<br>
[[file:Background-Skrell.png|left]]
[http://www.byond.com/members/?command=reference&path=proc%2Fascii2text ascii2text]<br>
'''Home planet''': [[Qerr'balak]]
[http://www.byond.com/members/?command=reference&path=proc%2Ffile2text file2text]<br>
[http://www.byond.com/members/?command=reference&path=proc%2Flist2params list2params]<br>
[http://www.byond.com/members/?command=reference&path=proc%2Fnum2text num2text]<br>
[http://www.byond.com/members/?command=reference&path=proc%2Fparams2list params2list]<br>
[http://www.byond.com/members/?command=reference&path=proc%2Ftext2ascii text2ascii]<br>
[http://www.byond.com/members/?command=reference&path=proc%2Ftext2file text2file]<br>
[http://www.byond.com/members/?command=reference&path=proc%2Ftext2num text2num]<br>
[http://www.byond.com/members/?command=reference&path=proc%2Ftext2path text2path]<br>
[http://www.byond.com/members/?command=reference&path=proc%2Ftime2text time2text]<br>


'''Home system''': [[Qerr'Vallis]]
SS13 Defined:<br>
text2dir(direction)<br>
dir2text(direction)<br>
dd_file2list(file_path, separator)<br>
dd_text2list(text, separator, var/list/withinList)<br>
dd_text2List(text, separator, var/list/withinList)<br>
dd_list2text(var/list/the_list, separator)<br>
angle2dir(var/degree)<br>
angle2text(var/degree)<br>


The skrell are a species of amphibious humanoids, distinguished by their green-blue gelatinous appearance and head tentacles. Skrell warble from the world of [[Qerrbalak]] (or as the lore once called it, [[Jargon 4]]), a humid planet with plenty of swamps and jungles. Currently more technologically
For more useful procs see<br>
advanced than humanity, they emphasize the study of the mind above all else.
[http://code.google.com/p/tgstation13/source/browse/trunk/code/defines/procs/helpers.dm code/defines/procs/helpers.dm]<br>
[http://code.google.com/p/tgstation13/source/browse/trunk/code/game/objects/items/helper_procs.dm code/game/objects/items/helper_procs.dm]


Gender has little meaning to skrell outside of reproduction, and in fact, many other species have a difficult time telling the difference between male and female skrell apart. The most obvious signs (voice in a slightly higher register, longer head-tails for females) are never a guarantee.
=== [http://www.byond.com/members/?command=reference&path=proc%2Fif If] ===


Due to their scientific focus on the mind and body, skrell tend to be more peaceful and their colonization has been slow, swiftly outpaced by humanity. They were the first contact sentient species, and are humanity's longest and closest ally in space.
Ifs default to checking for true if not otherwise stated. True is defined for all variable types as empty, 0 or non-existant (null).
  if(condition)
    action_true()
  else
    action_false()


=== [[Teshari]] ===
==== Common variable behavior in if statements: ====
[[file:Background-Teshari.png|128px|left]]
{|
'''Home planet''': [[Qerr'balak]]
!Variable type
!False when
!True when
|-
!String (text / ascii)
|"" or null
|Anything else
|-
!Int / Real
|0 or null
|Anything else
|-
!datum, atom
|null
|Anything else
|}


'''Home system''': [[Qerr'Vallis]]
==== [http://www.byond.com/members/?command=reference&path=operator Logical operators] ====
Pretty standard:
  [http://www.byond.com/members/?command=reference&path=operator%2F%21 !statement1] //NOT statement1
  [http://www.byond.com/members/?command=reference&path=operator%2F%26%26 (statement1) && (statement2)] //statement1 AND statement2
  [http://www.byond.com/members/?command=reference&path=operator%2F%7C%7C (statement1) || (statement2)] //statement1 OR statement2
  [http://www.byond.com/members/?command=reference&path=operator%2F%3D%3D ==] //equals
  [http://www.byond.com/members/?command=reference&path=operator%2F%21%3D !=] //not equal
  [http://www.byond.com/members/?command=reference&path=operator%2F%26lt%3B <] ([http://www.byond.com/members/?command=reference&path=operator%2F%26lt%3B%3D <=]) //less (or equal)
  [http://www.byond.com/members/?command=reference&path=operator%2F%26gt%3B >] ([http://www.byond.com/members/?command=reference&path=operator%2F%26gt%3B%3D >=]) //more (or equal)
  [http://www.byond.com/members/?command=reference&path=operator%2F%26 &] //bitflag AND operator. 13 & 3 = 1 (1101 & 0011 = 0001)
  [http://www.byond.com/members/?command=reference&path=operator%2F%7C |] //bitflag OR operator. 13 | 3 = 15 (1101 | 0011 = 1111)


The teshari are reptilian pack predators from the skrell homeworld. While they evolved alongside the skrell, their interactions with them tended to be confused and violent, and until peaceful contact was made they largely stayed in their territories on and around the poles in tundra terrain far too desolate and cold to be of interest to the skrell. In more recent times, the teshari were technologically uplifted by the skrell to be a space-faring race of their own, one that's ready to prove its worth to the galaxy at large.
Byond does not recognize the === (identical) operator. More operators can be found in the left menu on the [http://www.byond.com/members/?command=reference&path=operator reference page]


===[[Akula]]===
=== [http://www.byond.com/members/?command=reference&path=proc%2Fwhile While] ===
[[File:Background-Akula.png|left]]
Byond will cancel a loop if it reaches a certain number of iteration and give a runtime error out of fear of infinite loops. Same applies for recursions.
'''Home planet''': Unknown
Same as anywhere else
  while(condition)
    action1()


'''Home system''': [[Qerr'Vallis]]
All loops understand the [http://www.byond.com/members/?command=reference&path=proc%2Fcontinue continue] and [http://www.byond.com/members/?command=reference&path=proc%2Fbreak break] commands


'''(Akula lore is pending a rewrite. Please follow what is written for now until a later date.)'''
=== For ===
All loops understand the [http://www.byond.com/members/?command=reference&path=proc%2Fcontinue continue] and [http://www.byond.com/members/?command=reference&path=proc%2Fbreak break] commands


The akula is a species of amphibious humanoids like the skrell, but have an appearance very similar to that of a shark. They were first discovered as a primitive race of underwater-dwelling tribal creatures by the skrell. At first they were not believed to be noteworthy, but the akula proved to be such swift and clever learners that the skrell reclassified them as sentients. Allegedly, the akula was also the first sentient life that the skrell had ever encountered beside themselves, and thus the two species became swift allies over the next few hundred years. With the help of skrellean technology, the akula had their genome modified to be capable of surviving in open air for long periods of time. However, akula even today still require a high humidity environment to avoid drying out after a few days, which would make life on freezing world like Sif nearly impossible if it were not for skrellean technology to aid them.
For combines the for loop and foreach loop:
====  [http://www.byond.com/members/?command=reference&path=proc%2Ffor%2Floop For loop] ====
  for(var/i = 1; i <= 10; i++)
    [http://www.byond.com/members/?command=reference&path=world world] << i //Will write (each in a new line) 1 2 3 4 5 6 7 8 9 10


Most akula today consider Qerr'Vallis to be their home where they live alongside their skrell allies, while their true homeworld has been forgotten over the ages. akula still tell legends of their homeworld, passed down through word of mouth, talking of great magical cities on the bottom of the ocean in a galaxy far away. skrell historians believe a great tragedy befell the akulan race which led to their near extinction, and the tribal akula they eventually discovered had actually descended from the survivors of this once technologically advanced species. The most widely accepted theory is that the akula originally hail from the [[Andromeda]] Galaxy. This is supported by the fact that varying races of akula have been found in scattered tribal communities across the galaxy, some more technologically advanced than others, but all without space travel of their own. Unfortunately, no one has the technology today to make such a journey to find out.
==== [http://www.byond.com/members/?command=reference&path=proc%2Ffor%2Flist For each] ====
  for(var/obj/item/weapon/baton/B [http://www.byond.com/members/?command=reference&path=operator%2Fin in] world)  //will iterate through world.contents (which contains all atoms in the world) and only pick those which are of the given type (/obj/item/weapon/baton)
    B.name = "Smelly baton" //Will apply the new name to the baton in the current iteration loop


Gender as a cultural identity has little meaning to most akula, which is a result of skrellean cultural influence, but the difference between male and female among the akula is much more obvious than with the skrell. Like humans and tajaran, female akula have large breasts and curvaceous bodies, along with similar reproductive organs that appear almost mammalian in nature. Food also plays a huge role in their sexuality. The best way to an Akula's heart is through their stomach. Their demeanor will often change to docile and flirtatious while engorged with food—similar to Earthly sharks, or other shark-like creatures on other worlds with life. It would turn out that the shark is a popular evolutionary path for water-dwelling predators throughout the cosmos.
=== [http://www.byond.com/members/?command=reference&path=proc%2Fdo Do - While] ===


Unlike the skrell, akula tends to be more arrogant and less intelligence focused, and will often find themselves in trouble with the law outside of skrell controlled systems. Popular professions for akula include piracy, smuggling operations, mining, and mercenary work. However, due to their mutual respect of the skrell, most will not engage in hostile activity against skrell or other akula.
The Do while operator is not commonly used in SS13 code, Byond does support it tho.


=== [[Unathi]] ===
  var/i = 3
[[file:Background-unathi.png|left]]
  do
'''Home planet''': [[Moghes]]
    world << i--
  while(i)


'''Home system''': [[Moghes#Astrology|Uueoa-Esa]]
All loops understand the [http://www.byond.com/members/?command=reference&path=proc%2Fcontinue continue] and [http://www.byond.com/members/?command=reference&path=proc%2Fbreak break] commands


The unathi are a race of tall, reptilian humanoids that possess both crocodile-like and serpent-like features. Their scales are hard and plate-like, save for the softer ones that line the inside of their legs, armpits, and groin. Originating from the planet of [[Moghes]], the unathi live in an extremely religious society.
=== [http://www.byond.com/members/?command=reference&path=datum Defining objects] ===
Doesn't matter if you want a [http://www.byond.com/members/?command=reference&path=datum datum] or [http://www.byond.com/members/?command=reference&path=atom atom], the definition of objects is the same and simple:
  /obj/item/weapon/item1 //will nmake a new object of type obj.
    var/item_property = 5 //Will define a new variable type for all item1 objs
    name = "Testing Item" //The name var is already defined in parent objects so it is not defined here, but only assigned a new valie.
 
  /obj/item/weapon/item1/[http://www.byond.com/members/?command=reference&path=datum%2Fproc%2FNew New()] //Constructor proc
    [[#..()|..()]] //should always be present in New() procs, see [[#..()|..()]] for more information
    item_property = 3 //An action that is performed in the object constructor.


The unathi generally believe in and closely follow a set of [[Unathi Culture#Religion, The Unity|Decrees]] laid out in their belief system, The Unity. unathi believes in living long, prosperous, honorable and productive lives. They firmly believe in improving the skills of their craft to reach a level where they can be considered to have mastered it.  
=== [http://www.byond.com/members/?command=reference&path=proc Procs] (Methods, functions, procedures) ===
You're used to the standards of methods, functions and procedures, right? Well procs ignore some aspects of these. They can best be compared to Java methods, as they're tied to specific objects. They cannot be defined as static, private, public, etc. tho. You can write static methods, however the compiler will not restrict you from calling them in a non-static way or environment. Same applies for non-static methods.


The unathi were humanity's second alien contact, but due to their aggressive nature, engaged in an interstellar war with humanity known as the [[Sol-Hegemony Conflict]]. Although the conflict has long since ended, and relations have slowly improved, unathi are still often considered to be 'second-class' citizens and are rarely seen in jobs other than where muscle is needed. It is also still common for racial tensions to run high, although this is less common on the outskirts of SolGov's grasp.
  proc/proc_name(var/argument1, var/argument2)
    [http://www.byond.com/members/?command=reference&path=world world] << "[argument1] [argument2]"


===[[Tajaran]]===
The above would declare a global proc. If you wish to tie it to a certain level
[[File:Background-tajaran.png|left]]
'''Home planet''': Meralar


'''Home system''': Rarkajar
==== ..() ====
This is the same as super() in Java. It calls the parent object type's proc with the same name and same arguments.


The tajaran are a humanoid race possessing cat-like features. Hailing from Meralar, they possess insulating fur and felinoid stability to better survive in their harsh native environment. Their home planet is a cold planet of vast tundra and arctic zones. For generations the tajaran were practically enslaved by the leading class who were recently overthrown. Males and females are treated roughly equal. There are three divisions of tajaran, two being sensible, the other... not so much.
Example:
  /obj/item
    name = "Item"
 
  /obj/item/New() //New() is the proc that gets called whenever a new object of this type is created. A constructor if you will.
    src.name = "It's an item!"
 
  /obj/item/stack
    name = "Stack"
 
  /obj/item/stack/New()
    src.name = "It's a stack!"
    ..()


Tajaran is one of the more recent contacts humanity has encountered. While plenty of tajaran hold reservations with their new allies, overall the alliance is accepted and welcome. Though, like the [[Unathi]], plenty of humans take advantage of the less than modern education, and it is rare to see a tajaran in a position of command outside of systems like Vir where the human population is limited.
If you have the code from the example above and create a new object of type /obj/item/stack, it will first make the item in the game world with the name "Stack", because it's defined to be that by default. Then the New() proc will be called immedietally after. This will change the name to "It's a Stack!" but the call of the parent type's New() proc with the ..() command will then set it to "It's an item!". So in the end, the new object will be called "It's an item!". The ..() command is however very important in many cases as some things are defined only in the common parent's New() procs. In Del(), the proc which gets called prior to an object's deletion, it requires the code to get to the root Del() proc to even delete it. See examples of Del() in the code.


===[[Sergal]]===
== Important procs ==
[[File:Background-Sergal-Northen.png|left]]
[[file:Background-Sergal-Southern.png|left]]
'''Home planet''': [[Vilous#Tal|Tal]]


'''Home system''': [[Vilous]]
=== [http://www.byond.com/members/?command=reference&path=atom%2Fproc%2FNew New()] ===
This proc is called whenever a new instance of the object is created. It can have arguments if needed. It should call ..() where applicable so that parent constructors can be applied.


If you wish to create a New() proc for [[#Variable types|atoms]] with custom arguments, ensure the first argument is for the object's location. Example:
  obj/item/weapon/my_item/New(var/location, var/i)
    ..()
    //Whatever else you need to do


'''(Sergal Lore is pending a rewrite. Please follow what is written for now until a later date.)'''
To make a general object use
  [http://www.byond.com/members/?command=reference&path=proc%2Fnew new] /datum/test_datum
To make an atom (which usually has a locaiton)
  [http://www.byond.com/members/?command=reference&path=proc%2Fnew new] /obj/item/weapon(src.loc)
For the custom example above, the code to create a new such object would be: The 5 is just an example of a value which could be assigned to the var/i in the constructor.
  [http://www.byond.com/members/?command=reference&path=proc%2Fnew new] /obj/item/weapon/my_item(src.loc, 5)
Where src is the proc owner, which contains the line above. src.loc is the locaiton of the src object.


There are two subspecies of sergal, Southern and Northern. Northern sergals are a highly aggressive race that lives in the plains and tundra of their homeworld. They are characterized by long, fluffy fur bodies with cold colors; usually with white abdomens, somewhat short ears, and thick faces. Southern sergals are much more docile and live in the [[Gold Ring City]] and are scattered around the outskirts in rural areas and small towns. They have short, brown or yellow (or other "earthy" colors) fur, long ears, and a long, thin face. They are smaller than their Northern relatives. Both have strong racial tensions which have resulted in more than a number of wars and outright attempts at genocide. The southern sergals have mostly been on the losing side of this long conflict. Sergals have an incredibly long lifespan, but due to their lust for violence and a nasty habit of occasional cannibalism, only a handful have ever survived beyond the age of 80, such as the infamous and legendary General Rain Silves who is claimed to have lived to 5000. Although General Rain's historical existence is disputed, she is nonetheless a symbol of the Sergal's warrior culture.
=== [http://www.byond.com/members/?command=reference&path=datum%2Fproc%2FDel Del()] ===
This proc gets called before an object's delection. It MUST call ..() at the end as the actual deletion is done in the root Del() proc.


Despite advances in technology, militant sergals still wear metal or leather armor and usually favor polearms or bladed weapons, and are capable of great physical feats thanks to their strong, wiry limbs with much denser muscles than humans, more akin to a chimpanzee's muscles. They are reluctant to embrace new technology and pride themselves on the old ways. Despite this, they have made great use of short-range space travel and have colonized much of their home system. This is not, however, to say they are not intelligent. Their intellect rivals that of the skrell but is focused mainly on military tactics and strategy, rather than science or history.
An object is deleted by using the del(O) proc with O being the object to be deleted.


Among sergals, females tend to be the dominant gender with larger, more muscular and bulky bodies, and a much more aggressive demeanor, especially among the northern race. This gender divide is most likely born out of the legacy of General Rain, or perhaps General Rain is a fictional character who is the result of this culture where females are often commanders and warriors in vast armies while males are hunters and farmers who may be one of multiple mates to a single female. Unlike many mammal-like creatures, sergals lack breasts and females also possess a unique prehensile hood over their genitalia which protects it from dust and infection.
=== attack_hand(mob/M as mob) ===
Whenever a user (M) clicks on the object with an empty active hand


Humanity encountered sergals in the year 2524, when the [[USDF Pathfinder]] discovered the planet Tal, but did not join the intergalactic community until late 2558 due to [[The Vilous Incident]], wherein a total of 1,057 USDF personnel and somewhere between 5,000 and 10,000 native sergals were killed in a brief military conflict. The Vilous system has been under USDF occupation ever since, and has only recently been officially annexed into [[SolGov]]'s influence.
=== attack_paw(mob/M as mob) ===
Whenever a monkey (M) clicks the object with an empty active hand


===[[Promethean]]===
If a custom attack_paw(mob/user) proc is not written for an atom, it defaults to calling attack_hand(user)
[[File:Background-Promethians.png|left]]
'''Home planet''': [[Aetolus]]


'''Home system''': [[Kataigal]]
=== attack_ai(mob/user) ===
Whenever an AI or cyborg clicks the object with an empty active hand


A gelatinous race of mimics evolved from their slime predecessors that were first discovered aboard the NRS Prometheus, these colorful humanoids are best characterized by their ability to repurpose and shape their bodies for whatever a situation may warrant by means of their semi-solid structure. Along with this is their semipermeable membrane encasing their gel, allowing them to filter feed while keeping the undesirable matter out of their bodies. Their composition allows them to resist most sources of brute trauma, though energy will cause their limbs to become unstable and disintegrate. Prometheans are also void of most normal organs, only possessing a core and cytoskeleton, both of which are crucial to the slime's survival.
If a custom attack_ai(mob/user) proc is not written for an atom, it defaults to calling attack_hand(user)


Being an artificially created race, and a new one at that, prometheans have no unified culture, though there are small populations of prometheans scattered around the universe, the tropical planet of [[Aetolus]] in particular having roughly one thousand such individuals. Currently, prometheans ''must'' have a caretaker in accordance with USDF regulations, normally a xenobiologist or other trained caretaker.
=== attack(mob/M as mob, mob/user as mob) ===
When the object is used to attack mob M by mob user


===[[Nevrean]]===
=== attackby(obj/item/W, mob/user) ===
[[file:Background-Nevrean.png|left]]
When the object is being attacked by user with W (Example: If you click on wires with wirecutters)
'''Home planet''': [[Vilous#Eltus|Eltus]]


'''Home system''': [[Vilous]]
=== ex_act(severity) ===
How the item reacts to explosions. Severity can either be 1, 2 or 3 with 1 being the most destructive.


'''(Sergal Lore is pending a rewrite, which will also effect nevreans. Please follow what is written for now until a later date.)'''
=== blob_act() ===
How the item reacts to a blob (magma) attack


An avian species hailing from the planet Eltus in the Vilous system, characterized by their long whiplike tail-feathers. The species is generally matriarchal, with females tending towards duller, brown coloration and bulkier bodies, while males are slight and brightly colored. In both typical mannerisms, culture and physical build, the sexes are directly reversed when compared to traditional human society. Their build is somewhere between a bird and a feathered dinosaur. Females tend to have short feathers on their arms that are not capable of flight, while males often have more developed flight-feathers - on-station, these are often kept tucked away and folded under their jumpsuit sleeves.
=== emp_act(severity) ===
How the item reacts to an EMP. Severity can either be 1 or 2 with 1 being the more powerful EMP surge.


There are no remaining records describing how the nevreans came to leave Eltus and relocate to Tal - they have little to no written history from that time, having a tradition of oral history and song, and most of what little history survives of their former homeworld is couched in myth, legend, stories, fairy tales and adventures. Humanity has not yet had time to study these stories and separate fact from fiction, and reality from metaphor, or what parts of the stories might hint at the then-primitive race having a visit from a spacefaring species. As a result, Eltus has attracted no small amount of interest from xenoarchaeologists.
=== [http://www.byond.com/members/?command=reference&path=datum%2Fproc%2FTopic Topic(href, href_list)] ===
This one's called when you click a link in a pop-up window. Like when you increase the output of [[SMES cells]]. The href_list variable is the important one as it's a parsed version of the arguments you add into a link. To make a link in the pop-up window, add the following line to the text you display (dat in the example):
  <nowiki>dat += </nowiki>[http://www.byond.com/members/?command=reference&path=proc%2Ftext text](<nowiki>"<A href='?src=\ref[src];select=[i]'>[src.name]</a><br>")</nowiki>
Check the code for more examples of this.


After the exodus, nevreans coexisted alongside Sergals, though tend to be much more forward-looking when it comes to new technology. While sergals still tended towards traditional melee weapons and armor in battle, nevreans have no such hangups when it comes to more modern armaments and has earned a reputation as crafters and engineers in urban communities. Likewise, the urban groups have tended to adopt the written languages of other cultures, nevreans lacking any written form of their own tongue.
=== process() ===
This gets called for all objects on every tick. If possible, avoid it as it's processor heavy, but for some things it just can't be avoided.


During [[The Vilous Incident]], most nevrean communities avoided confrontation, though a handful of urban groups took to asymmetric warfare tactics against USDF special forces when fighting entered the city.
== SS13 common variable meanings ==


===[[Diona]]===
=== Datum ===
[[File:Background-Dioan.png|left]]
'''(( Whitelisted species - requires a special character application to play. ))'''


'''Home system''': [[Epsilon Ursae Majoris]]
Datums have the smallest number of pre-defined variables. These are present in all objects in the game:
  type //The type of an object. If your object is of type /obj/item/weapon/shovel writing the following: new src.type(src.loc) will make another shovel in the same tile.
  parent_type //Parent type of /obj/item/weapon/shovel is /obj/item/weapon... seems streight-foward enough.
  tag //The tag is used to help you identify things when using several instances. It has to be set manually for each instance tho. Lazy coders and mappers resulted in not many tags being used. Instances in the map editor are sorted by tag.
  vars //List of object vars the datum has defined


The dionae are a group of omnivorous, slow-metabolism plantlike organisms that are in fact clusters of individual, smaller organisms. They exhibit a high degree of structural flexibility and come in a wide variety of shapes and colors to reflect the intelligence of each individual creature. They were discovered by the skrell in 2294CE, not on a planet, but in open space between three stars, a figurative hell that made it difficult to discover, much less contact them.
=== Atom ===


Dionae spread by seeds and are asexual, no gender. When grown into their small 'nymph' state, they are known to eat large amounts of dead plant matter and fertilize plants while they learn from those around them by sampling their genetic code (usually through blood extractions), and as they grow further merger into larger and larger forms. It is not unheard of for skrell explorers to be traveling in a ship composed of habitat modules and engines of skrell make, with the body of the ship formed by their dionae allies to warble across the cosmos.
These variables are shared by all areas, mobs, objs and turfs.


Introduced by the skrell, and quite slow and peaceful, the dionae share good relations with humanity.
  contents //List of contents. Closets store their contents in this var as do all storage items. All the items on a turf are in the turf's contents var.
  density //If density is at 0, you can walk over the object, if it's set to 1, you can't.
  desc //Description. When you right-click and examine an object, this will show under the name.
  dir //Object direction. Sprites have a direction variable which can have 8 'legal' states. [[Understanding SS13 code#Direction (dir) var|More info]]
  gender //not used
  icon //The dmi file where the sprite is saved. Must be written in single quotations (Example: 'items.dmi')
  icon_state //The name of the sprite in the dmi file. If it's not a valid name or is left blank, the sprite without a name in the dmi file will be used. If such a sprite doesn't exist it will default to being blank.
  invisibility //Invisibility is used to determine what you can and what you can't see. Check the code or wait for someone who knows how exactly this works to write it here.
  infra_luminosity //Only mecha use this
  underlays //List of images (see image() proc) which are underlayed under the current sprite
  overlays //List of images (see image() proc) which are overlayed over the current sprite
  loc //Contains a reference to the turf file where the object currently is.
  layer //A numerical variable which determins how objects are layered. Tables with a layer of 2.8 are always under most items which have a layer of 3.0. Layers go up to 20, which is reserved for HUD items.
  luminosity //How much the item will glow. Note that the picking up and dropping of luminous items needs to be specially handled. See flashlight code for an example.
  mouse_over_pointer //not used
  mouse_drag_pointer //(almost) not used
  mouse_drop_pointer //not used
  mouse_drop_zone //not used
  mouse_opacity //Used in a few places. Check the description in the reference page
  name //The name of the object which is displayed when you right click the object and in the bottom left of the screen when you hover your mouse over it.
  opacity //Whether you can see through/past it (glass, floor) when set to 0 or whether you can't (walls, mecha) when set to 1.
  pixel_x //How many pixels in the x direction should the sprite be offset from the starting set. See the APC's New() proc for an example and how fire alarms are defined on the map. pixel_x = -5 will move it 5 pixels to the left and pixel_x = 5 will move it 5 pixels to the right
  pixel_y //Same as pixel_y but in the y direction. Positive values move it to the north, negative to the south.
  pixel_z //Used in isometric maps, so it's not used in SS13
  suffix //Rarely used. See the reference page for more information
  text //How to represent the object on text clients. Not used.
  type //The type of the object
  vars //See [[#Datum|Datum]] above
  verbs //The verbs you can use with the item. Verbs are the options in the right click menu.
  x //X position, read only. Set the loc variable to move it or use the inbulit functions.
  y //Y position, read only.
  z //Z position (Which z-level it's on), read only.


===[[Synthetics|Synthetics]]===
=== Area ===
[[file:Background-Synthmorph.gif|128px|left]]
Synthetics are spread throughout known space and serve a myriad variety of roles that range from a tiny drone scrubbing a floor to a nearly omnipotent AI used in a combat-ready interstellar vessel. Most known sufficiently-advanced races use synthetics in some way; very often as prosthetic bodies when their own bodies fail. There are three basic kinds of synthetic intelligences found in the universe today:
*'''Drone''': A drone is the term for any synthetic that uses more simple artificial intelligence constructs such as chips or motherboards. While capable of very sophisticated interaction, they are, in essence, only expert systems and not truly sapient.
*'''Cyborg''': A cyborg is a synthetic that uses an organic brain to function via an MMI, short for Man-Machine Interface. Cyborgs come in many shapes and sizes and most sentient cyborgs are free-willed. Some companies have used canine brains and brains of other animals to ensure a cheap workforce that doesn't rely on cutting-edge technology.
*'''Positronic Brain''': Positronic Brains are synthetic intelligences equaling the intellect of a particularly clever sapient being and are generalized artificial intelligences that can be seen as equal (or superior) to organic sapience. They possess a neural network not dissimilar to a brain made out of flesh; and are often used when expert systems simply do not make the cut and a true intelligence is needed. Many positronic intelligences strive for self-determination and are often acknowledged to be holders of their own destiny.


Synthetics have the unique capability of serving in different bodies. This can take shape of a [[Synthmorph]], a [[AI|lawbound AI]], or [[Cyborg|lawbound mobile chassis]]. However, transition from one to the other is often more expensive than the net worth of the bodies and is thus done sparingly.
  var/requires_power = 1 //Areas which are to work without an APC (Such as centcom areas) should have this at 0. All other areas should have it at 1.
  var/music = null //Music to be played when you enter the area.
  [http://www.byond.com/members/?command=reference&path=atom%2Fvar%2Fluminosity luminosity] = 0 //Areas which should be lit at all times (such as space and centcom) should have this at 1 as well as the sd_lighting var at 0
  var/sd_lighting = 0 //This var determines whether dynamic lighting is to be calculated for the area's tiles. Turn this to off only for areas which have the luminosity var set to 1


===[[Zorren]]===
Most other variables exist only for technical reasons and should not be messed with unless done through existing procs, they are defined in:
[[file:Background-Zorren.png|left]]
  [http://code.google.com/p/tgstation13/source/browse/trunk/code/defines/area/Space%20Station%2013%20areas.dm code/defines/area/Space Station 13 areas.dm]
'''Home Planet''': [[Virgo-Prime]]


'''Home System''': [[Virgo-Erigone]]
=== Mob ===


The fox-like zorren are native to Virgo-Prime, however there are two distinct varieties of zorren one with large ears and shorter fur, and the other with longer fur that is a bit more vibrant. The long-eared, short-furred zorren have come to be known as "Flatland" zorren as that is where most of their settlements are located. The Flatland zorren are somewhat tribal and shamanistic as they have only recently started to be hired by the Trans-Stellar Corporations. The other variety of zorren are known as "Highland" zorren as they frequently settle in hilly and/or mountainous areas, they have a differing societal structure than the Flatland zorren having a more feudal social structure, like the Flatland zorren, the Highland zorren have also only recently been hired by the Trans-Stellar Corporations, but thanks to the different social structure they seem to have adjusted better to their new lives. Though similar fox-like beings have been seen they are different than the zorren.
There is a huge amount of variables for mobs. Take a look at the following files:
  [http://code.google.com/p/tgstation13/source/browse/trunk/code/defines/mob/mob.dm code/defines/mob/mob.dm]
  [http://code.google.com/p/tgstation13/source/browse/trunk/code/defines/mob/dead/observer.dm code/defines/mob/dead/observer.dm]
  [http://code.google.com/p/tgstation13/source/browse/trunk/code/defines/mob/living/living.dm code/defines/mob/living/living.dm]
  [http://code.google.com/p/tgstation13/source/browse/trunk/code/defines/mob/living/carbon/carbon.dm code/defines/mob/living/carbon/carbon.dm]
  [http://code.google.com/p/tgstation13/source/browse/trunk/code/defines/mob/living/carbon/human.dm code/defines/mob/living/carbon/human.dm]
  [http://code.google.com/p/tgstation13/source/browse/trunk/code/defines/mob/living/carbon/monkey.dm code/defines/mob/living/carbon/monkey.dm]
  [http://code.google.com/p/tgstation13/source/browse/trunk/code/defines/mob/living/silicon/silicon.dm code/defines/mob/living/silicon/silicon.dm]
  [http://code.google.com/p/tgstation13/source/browse/trunk/code/defines/mob/living/silicon/ai.dm code/defines/mob/living/silicon/ai.dm]
  [http://code.google.com/p/tgstation13/source/browse/trunk/code/defines/mob/living/silicon/robot.dm code/defines/mob/living/silicon/robot.dm]
There are also additional files for aliens, larva, facehuggers and more there, but the files above will have most of the variables you might need.


===[[Vulpkanin]]===
=== Obj ===
[[file:Background-Vulpkanin.png|left]]
'''Home Planet''': Altam


'''Home System''': Vazzend
  var/m_amt = 0 // How much metal the item has. Used to determine how much metal you get when feeding it into an autolathe and how much it costs to produce it at the lathe
  var/g_amt = 0 // How much glass the item has. Used to determine how much glass you get when feeding it into an autolathe and how much it costs to produce it at the lathe
  var/w_amt = 0 // waster amounts. Not used
  var/origin_tech = null //Used by R&D to determine what research bonuses it grants. See examples in item definitions in code.
  var/reliability = 100 //Used by SOME devices to determine how reliable they are. The number represents the percentual chance for them to work properly.
  var/unacidable = 0 //universal "unacidabliness" var, objects with this set to 1 cannot be destroyed by acids.
  var/throwforce = 0 //The amount of damage applies to a target when they're hit by the item.


Vulpkanin or "Vulpa" is a species of sharp-witted canid bipeds residing on the planet Altam just barely within the binary Vazzend system. Their politically de-centralized society and independent natures have led them to become a species and culture both feared and respected for their scientific breakthroughs. Discovery, loyalty, and utilitarianism dominate their lifestyles to the degree it can cause conflict with more rigorous and strict authorities. They speak a guttural language known as 'Canilunzt' which has a heavy emphasis on utilizing tail positioning and ear twitches to communicate intent.  
More variables are defined in:
  [http://code.google.com/p/tgstation13/source/browse/trunk/code/defines/obj.dm code/defines/obj.dm]


Vulpkanin are an omnivorous (with preference of meat and fish) bipedal furred race vaguely reminiscent of Terran vulpines, and in some cases, reminiscent of Terran canines. Colorations are usually subdued but vary considerably on genetics, climate, and personal taste. Vulpa descended from the northern latitudes tend towards whites and rarely, very slight, almost unnoticeable blue tints. Vulpa descended from a more equatorial climate tend towards brighter browns and dusty reds. Vulpkanin in the between of both latitudes tend towards greys, muted reds, blacks, and tans. Bright colors, excluding whites from the arctic region, are unnatural as they are often dyes used by younger minded vulpkanin to stand out from littermates. Genetic resequencing can make an otherwise impossible color a standard which has become a trend not unlike human 'tattoo' culture.
==== Item ====


Vazzend is a system undergoing significant solar activity due to the orbital habits of the primary F class star, Vazzend A also known as 'Kol', which due to the interaction between it and the M class star, Vazzend B 'Gol', causes large bouts of electromagnetic energy pulse out at significant range. The cycle is infrequent, but of great fascination. It was also a terror during the early industrial age of the vulpkanin peoples when they had just started to unlock the principles of electricity. Altam is the second planet of 4 orbiting Gol, which is near Earth-like conditions, if a touch warmer during summer. Jungles are thick, Forests are about the same, deserts larger and oceans a smidge smaller.  
Items are objs which can be picked up. They're divided into several categories according to their function.


These flares promoted the cultural drive to discover what, why, and how and gave the entire civilization a means to reach for the stars through scientific focus. One of their most prized technologies is the degree of EM resistance built into everything they develop; enabling the small fleet of space, then starships to be nearly impossible to disable with ionic weaponry. It was this tech that promoted interest from the Federation and NanoTrasen directly for use in insulating sensitive power equipment, such as harnessing singularities larger than a few microns in size.  
/obj/item is defined in the following file:
  [http://code.google.com/p/tgstation13/source/browse/trunk/code/defines/obj.dm code/defines/obj.dm]


With access to both the stars and employment, vulpkanin people are quickly finding themselves as honest working Engineers and Scientists for hire, their propensity for group efforts using the meticulous use of their materials ensures they're highly prized to any project team. They are also apt security officers and wardens due to the hierarchical mindset of the pack, but only a rare handful have the traits to actually lead as an alpha.
It adds the following variables (Look at the file for more, but these are the more important ones):
  var/force = null //This determins how much damage the target takes when they're attacked by the item in hand. Small items usually have it at 0, medium ones between 5 and 10, rare and powerful items around 10-15 and two-handed items at 15 and more. Syndicate items have it even higher at 40 and more.
  var/item_state = null //This it the var that determines which sprite will be used for the item from icons/mob/items_lefthand.dmi and items_righthand.dmi.
  var/damtype = "brute" //Determines what damage type the item produces.
  var/health = null //Some items use this to determine when they'll break from use or damage. Not common tho.
  var/hitsound = null //Sound that's played when you hit something with the item. Not commonly used.
  var/w_class = 3.0 //Weight class.
    // w_class = 1 means it's an item that can fit in a pocket (diskette, pen, cigarette packet)
    // w_class = 2 means the item can't fit in pockets but can fit in a box (clipboard, analyzer, cleaner)
    // w_class = 3 means the item can't fit in a box but can fit in backpacks (box, rods, metal)
    // w_class = 4 means the item can't even fit in a backpack (packpack, pickaxe, fireaxe)
    // w_class = 5 is used but not for weight classes.
  var/wielded = 0 //Used for double-handed items which can be carried in one hand but needs to be wielded by two hands before they can be used. This is determined by code when wielding and unwielding. All items should start with this at 0.
  var/twohanded = 0 ///Set this to 1 if your item is two-handed.
  flags = FPRINT | TABLEPASS //Flags


===[[Vasilissans]]===
==== Machinery ====
[[file:Background-Vasilissans.png|left]]
'''Home planet''': Varilak


'''Home system''': Antares
Defined in:
  [http://code.google.com/p/tgstation13/source/browse/trunk/code/defines/obj/machinery.dm code/defines/obj/machinery.dm]


Vasilissans are a carnivorous, large spider-like people with tall, lanky bipedal bodies covered in chitin, and four large spider-like limbs protruding from their backs. They come in a variety of colors and are extremely diverse in that aspect.  The females are usually about a foot taller than the males, averaging in at about seven feet.  The females are also much stronger than the males. Their faces have four eyes of solid and varying colors. On the top of their heads are strange, thick, leg-like feelers that are normally styled in much the same way as hair. Their color varies greatly and isn’t normally the same color as the Vasilissan’s body. They have several feelers and sharp claw-like limbs around their lipped human-like mouths. These mouths contain only fangs, a strange, bulbous, long tongue, and spinnerets, giving them the ability to spit large strands of silk from their mouths.  Their faces are traditionally very pretty, long, and elegant, almost elf-like despite their hard chitin plating and lack of a nose.  
Machinery are objs which cannot be picked up and generally require power to operate. They have the following vars defined for all of them:
  var/use_power = 0 //Determines if and how much power the machine will use each tick.
    //use_power = 0 - no power is used
    //use_power = 1 - idle power is used
    //use_power = 2 - active power is used
  var/idle_power_usage = 0 //How many watts of power the machine will use each tick when use_power is set to 1
  var/active_power_usage = 0 //How many watts of power the machine will use each tick when use_power is set to 2
  var/power_channel = EQUIP //Determines which APC power category the device falls under. EQUIP, ENVIRON or LIGHT
  var/list/component_parts = null //A list of parts needed to construct the machine from a machine frame.


From a temperate jungle planet, the vasilissans were once a solitary, territorial people until great queens began to subjugate them.  These 'Star Queens' ruled with an iron fist and urged their subjects to expand her territory and to attempt to build great towering cities tall enough to reach the stars and their sun, which they believed to be gems of great magical power and spiritual significance.  They were eventually picked up and ‘uplifted’ by NT due to their world being rich in precious metals, but their ability to design and create vast, strong, and luxurious structures with their silk, stood out well among their talents, and due to their naturally somewhat solitary natures, they make great scouts and explorers.
=== Turf ===


===[[Xenochimera]]===
  var/intact = 1 //This determines if the turf will hide pipes, cable and such. Set to 1 to hide and to 0 to not hide them. Only pipes and wire with level set to 1 will be hidden. Set their level var to 2 to keep them from being hidden.
[[file:Background-Xenochimera.png|left]]
  var/blocks_air = 0 //Determines if the turf prevents air from passing (walls) if set to 1.
'''(( Whitelisted species - requires a special character application to play. ))'''
Other variables exist but they're tied to atmospherics code which is not to be touched as whenever anything is changed in it it results in a million things breaking.
  [http://code.google.com/p/tgstation13/source/browse/trunk/code/defines/turf.dm code/defines/turf.dm]


'''Home planet''': Not known
==== Simulated ====
'''Home system''': Not known
An extraterrestrial colony organism, xenochimera are unusual in that they have no real defining physiology of their own - effectively, xenochimera mimic other beings, or parts of other beings, by consuming them and mutating their own cellular structure to imitate whatever evolutionary advantages they may find - or in layman's terms, they eat other creatures and copy features to create bizarre hybrids. As a result, no two examples of the species are alike, and they can, in fact, be wildly different in appearance.


===[[Xenomorph-Hybrid]]===
Simulated floors are tiles which simulate air movement and temperature. The station is made entirely from these while centcom is made from unsimulated floors to prevent massive and unneeded lag.
[[file:Background-Xenomorph-Hybrid.png|left]]


'''Home planet''': N/A
  var/wet = 0 //If this it a positive number, it is wet and you'll slip on it if you run.
  var/thermite = 0 //Will be set to 1 when thermite is poured on it.
'''Home system''': N/A
Xenomorph hybrids are an extraterrestrial species. The origins of xenomorphs are primarily unknown, although hybrids have been formed through various ways. One of the most common ways they are created is by genetic experimentation. This is done either by [[splicing]] xenomorph DNA into a humanoid, or splicing humanoid DNA into a xenomorph, although the former is much more common. This process creates a hybrid of the two species with them sharing various traits.


Some of the traits xenomorph hybrids have are: A thick chitinous exoskeleton of varying hardness, much like a lobster, an elongated curved head, a toothed maw which hides a proboscis-like inner mouth, a jaw somewhat similar to a moray eel, green blood of varying acidity, a vertebrate-like body, and a long flexible tail. This can vary from hybrid to hybrid.
===== Simulated floors =====


Additionally, most, if not all hybrids '''do not''' appear to share the hive-mind that most feral xenomorphs seem to possess, along with their ability to produce resin, and their increased ability to sense prey. This can also be assumed to be due to the intensive mutation process.
  var/icon_regular_floor = "floor" //Determines what icon the steel version of the floor should have. Determined at floor creation (New() proc). If the icon_state of the floor at that point is one from the global icons_to_ignore_at_floor_init var, then this variable is assigned the value "floor". The icons_to_ignore_at_floor_init list contains broken, plating, burnt and non-steel icon_states from icons/turf/floors.dmi
  heat_capacity = 10000 //When a fire (hotspot) on the tile exceeds this number, the floor has a chance of melting. The more the number is exceeded, the higher the chance of melting.
  var/broken = 0 //This mostly only determins if you'll get the tile back when you use the crowbar
  var/burnt = 0 //This mostly only determins if you'll get the tile back when you use the crowbar
  var/obj/item/stack/tile/floor_tile = new/obj/item/stack/tile/steel //What floor tile is on the tile


===[[Rapala]]===
Simulated floors are defined in:
[[file:Rapala-background.png|left]]
  [http://code.google.com/p/tgstation13/source/browse/trunk/code/game/turf.dm code/game/turf.dm]
'''Home planet''': Verita


'''Home system''': Kastra-71
===== Simulated walls =====


An avian species, coming from a distant planet, the rapalas are the very proud race. Sol researchers have commented on them having a very close resemblance to the mythical race called 'Harpies', who are known for having massive winged arms and talons as feet. They've been clocked at speeds of over 35 miles per hour chasing the planet's many fish-like fauna. The rapalan's home-world 'Verita' is a strangely habitable gas giant, while no physical earth exists, there are fertile floating islands orbiting around the planet from past asteroid activity.
Doesn't really contain any special new variables.


Defined in:
  [http://code.google.com/p/tgstation13/source/browse/trunk/code/defines/turf.dm code/defines/turf.dm]


==Important Groups==
[[Category:Guides]] [[Category:Game Resources]]
===[[List of Trans-Stellar Corporations|Trans-Stellar Corporations]]===
{{Contribution guides}}
 
These are the big corporate forces, major companies whose reach cover numerous star systems and are nearly government forces of their own. While [[Sol Central]] does keep them in check to make
certain nothing too inhumane or against humanity's interest is being performed, they actually police each other in a way. Keep in mind while many corporations do have their own security forces, some of them armed well enough for 'asset protection' to make some governmental military forces jealous.
 
The major seven trans-stellars are: [[NanoTrasen]], [[Ward-Takahashi GMB]], [[Gilthari Exports]], [[Grayson Manufactories Ltd.]], [[Aether Atmospherics and Recycling]], [[Zeng-Hu Pharmaceuticals]] and [[Hesphaistos Industries]].
 
Other important trans-stellars are: [[Vey-Med]], [[Advent Life Biolabs]], [[mercenary|Aerospace Combat Escort Services]] (aka ACES), [[RauMauser]], [[Donk Co.]], and [[Cybersun Industries]].
 
===[[Free Trade Union]]===
 
To keep the TSC's in check, and to help protect the smaller businesses striving to just make a living, the Free Trade Union was formed 200 years ago. Each FTU branch is different from system to system, but each offer lawyers, copyright enforcement, and even anti-pirate asset protection forces for any non-TSC business. All FTU stations are renowned for their open markets where all are welcomed to sell and trade, even the [[vox]]. They're the vocal defenders of the mom and pop stores, basically.
 
===[[Sol Central]]===
 
The banner over which most of humanity is united under. They focus on keeping humanity's best interest in check and tend to keep out of a system's personal problems unless they are in a dire state of emergency. They are protected by the USDF.
 
===[[Military Groups]]===
 
Not only are there corporate interests out in deep space, but also military ones. These factions tend to be neutral to corporate empires like NanoTrasen, but occasionally NanoTrasen will find its self in the crossfire of an ongoing conflict.
 
The most well known trans-stellar military group is the [[United Sol Defense Force|United Sol Defense Forces]] (USDF), based out of Earth in Sol Central, as well as its mostly defunct grandfather organization, the United States Colonial Marines. NanoTrasen is non-hostile to the USDF and has a number of lobbyists in Sol Central's government to ensure the USDF's cooperation.
 
Another group, wary of the influence of Sol Central and hostile to any Trans-Stellar Corporation is the [[Ares Confederation]], a dozen of colony worlds on the fringe of human-occupied space. Obviously, considering NT is one of their "sworn" enemies, relationships are frosty at best, although no open hostility broke out yet. They are cordial to both the Soviets and the United Federation, while rumors persist that they back up the Syndicate as well.
 
Also out of Sol Central is the [[3rd Soviet Union]], which hails from [[Europa]] and continues to exist despite tensions with the USDF thanks to supporters from scattered colonies and sympathizers across the galaxy providing weapons and resources. NanoTrasen maintains a shakey neutrality with the Soviets, often through the exchange of technology. The Soviets also purchase weapons from NanoTrasen to use against the USDF.
 
Finally, there is the infamous [[Syndicate]] paramilitary group, of which cells still persist to this day from their infamous inception back in 2262. The chapter operating within Vilous is considered destroyed, however this does not stop independent mercenaries, operatives and criminals turn up with their equipment which has been salvaged in one way or another.
 
To defend against belligerent forces, NanoTrasen also employs a vast number of mercenaries to serve in the [[NanoTrasen Defense Navy]], whose weapons and armaments are a mishmash of hardware purchased from surplus USDF military stockpiles or developed on their own.
 
==Pirates and Smugglers==
Not all in the Vir system seek to gain an honest paycheck. Crooks and creeps are commonplace in a system like Vir, far away from the governing bodies that would otherwise stomp them out of existence.
[[File:BullPirateFlag.png|200px|thumbnail|right|Blackstar Marauders Emblem]]
===Blackstar Marauders===
Consisting of a variety of alien species, the Blackstar Marauders are a group of ruthless space pirates once run by a man named Jarome Rognvaldr. When their leader was imprisoned by NanoTrasen five years ago, and later turned over to Earth government forces, the Blackstar Marauders were eventually taken over by an unknown individual who swiftly returned the group to its former glory as the largest piracy group on the outskirts of inhabited space. They prey mostly on cargo shuttles and fortunately a station like NCS Northern Star is of little interest as a target, but they do still occasionally perform kidnappings for ransom against NanoTrasen employees.
 
Some of their former members who have been arrested over the years, including Jarome, now work for NanoTrasen. They are not to be trusted, but still, have old connections to the black market if you need to make a special order.
 
==Hostile Forces==
 
As mentioned before, there are several smaller antagonistic forces out in Vir, a brief overview of commonly known knowledge is below, further information can be found on the [[Identifying Antagonists]] page:
 
===Disloyals===
Vir has many opportunities for less than loyal individuals to get themselves into important positions. Reasons for betrayal are many: some could be looking for money, have a personal agenda, extreme political/religious ideals, suffering from some form of insanity, or could be more than they appear. Either way, in Vir, the wise watch their back and do not give out their trust freely.
 
[[Category:Lore]]

Latest revision as of 02:34, 11 November 2019

This article or section is from the Baystation 12 wiki.

This article or section is directly taken from the Baystation 12 wiki, and should not be fully relied on for CHOMPstation. You can help by updating it.

Other related guides: Basics of Coding in BYOND and the Guide to Mapping

So you know how to write programs in other languages and would like a quick guide on how to understand and code for SS13? Good, this is the guide for you. It likely doesn't contain everything that you need to know but it's a start.

Syntax

  • Semicolons at the end are not mandatory,
  • Loop, proc, object, variable etc. spans are determined by indentations (similar to Python, see examples below)
 /obj
   var
     i1
     i2
     i3

is the same as (Strongly recommended you use this layout to make searching for variable and proc definitions easier.)

 /obj
   var/i1
   var/i2
   var/i3

which is inturn the same as

 /obj/var/i1
 /obj/var/i2
 /obj/var/i3
  • This guide uses the word 'object' for any defined type (see Variable types) and the word 'obj' for derivatives of atom/obj, which are all objects which can be placed on the map.
  • This guide uses the word 'AI controlled' for behavior to do with an AI player controlling an item. The term 'Game controlled' is used when refering to behavior which the script itself determins (Usually called AI controlled creatures or NPCs)
  • All things are inherited from parent objects. If a variable is defined in /obj/item, it doesn't need to be (actually can't be) redefined in /obj/item/weapon.

Variables

Variables are very general, Byond makes no difference in the declaration of strings, integers, etc. (Similar to PHP)

Predefined variables

There is a lot of predefined variables for objects in BYOND, but the most important are:

  • src - a variable equal to the object containing the proc or verb. It is defined to have the same type as that object. (Similar to "this" in Java or C++)
  • usr - a mob variable (var/mob/usr) containing the mob of the player who executed the current verb, or whose action ultimately called the current proc. A good rule of thumb is to never put usr in a proc. If src would not be the correct choice, it is better to send another argument to your proc with the information it needs.
  • args - a list of the arguments passed to the proc or verb.
  • vars - a list of object variables. If the variable name is used as an index into the list, the value of that variable is accessed.

For more SS13 specific variables see SS13 common variable meanings

Variable definition

Basic definitions
 var/j
 var/i = 4
 var/a, b, c
Complex definitions

The general syntax is var/type/variable_name = value

Examples:

 var/obj/item/I = new/obj/item
 I.name = "Some item"

Datum definition and declaration of a variable of that datum type:

 datum/test_datum
   var/test_variable = 0 //declaration of the test_variable var
   
   proc/set_as(var/i) //proc definition within the test_datum datum
     test_variable = i //set the test_variable var to the value in the argument
 
 var/datum/test_datum/TD = new/datum/test_datum //TD will now be a reference to a datum of type test_datum
 TD.test_variable = 4  //Byond doesn't know of private variables, so you can set any variables like this
 world << TD.test_variable //will output 4 to all connected users
 TD.set_as(10) //Will call the set_as proc in the datum with the argument 10
 TD.test_variable //will output 10 to all connected users

Bitflags

Bitflags are variables which use bits instead of numbers to determine conditions. The bit operators are & and |. For now, you should know that bitflag operators use the binary value of numbers to determine the result. So 13 & 3 will result in 1. (1101 & 0011 = 0001) and 13 | 3 = 15 (1101 | 0011 = 1111) see if for uses

Variable types

reference

  • datum - ordinary object type (class in java)
  • atom - atom derives into obj, turf, mob and area
  • turf - tiles which make up the floors, walls and space on SS13
  • area - areas are grouped locations. They combine many turfs and it gives some common properties. Power, atmosphere, etc. are determined by areas
  • mob - an object with life, be it game controlled or player controlled.
  • obj - objects which can be placed on the map
  • client - a new client object is created for each connected player
  • list - a list of elements. The first element in a list called L is L[1]
  • world - this is a variable where some global variables for the entire world can be set. World's contents var contains all atoms currently in the game world.

Outputting messages

The most basic way of outputting messages is with the '<<' output operator.

 world << "Hello World!" //Outputs a message to all clients in the world
 usr << "Hello usr" //Outputs a message to only the user who is tied to the calling of the proc which contains this.
Output with variables
 var/s1 = "Hello"
 var/s2 = "World"
 var/i = 2011
 world << "[s1] [s2], this guide was written in [i]" //Returns "Hello World, this guide was written in 2011"

Determining variable types in code

The istype() proc will come in handy

Example

 var/obj/item/weapon/W = new/obj/item/weapon/baton
 if(istype(W,/obj/item/weapon/baton))
   world << "It's a baton!"

The second argument is optional, if it's omitted, the variable will be checked against its declared type, like

 var/obj/item/weapon/W = new/obj/item/weapon/baton
 if(istype(W))
   world << "It's a weapon!"

Standard code for getting specific arguments from variables which have a type that is a subclass of the type the current proc treats them with (see any attackby() proc for examples). Note that the example below is of a proc which is globaly defined, not tied to the object. It doesn't make much sense to do it like this but it works for the purposes of the example. /obj objects don't have the 'amount' variable, it's defined in /obj/item/stack (as ilustrated by the oversimplified definition of classes below. Also note where var/ is used and where it isn't).

 /obj
   var/name = "Object"
 
 /obj/item
   name = "Item"
 
 /obj/item/stack
   name = "Stack"
   var/amount = 50
 
 proc/get_amount(var/obj/O)
   if(istype(O,/obj/item/stack))
     var/obj/item/stack/S = O
     return S.amount

There is another way of doing this. I'll show you that it exists but it is NOT TO BE USED.

 proc/get_aount(var/obj/S)
   if(istype(O,/obj/item/stack))
     return O:amount

The colon operator (:) in the example above tells the byond compiler: "I know what I'm doing, so ignore the fact the object doesn't have this variable, I'll make sure it works myself." The problem is that people will revise your code and use it in ways you never planed for. This means something might eventually make the O:amount throw exceptions in the form of runtime errors. Some variables might eventually need to be removed or replaced and this is impossible when they are used with object:variable as the compiler will not throw an error when the variable is removed. The error will only become apparent after the game is ran on the live server which might cause it to crash. So just don't use this method, ever.

There are some shortcuts to istype() proc:
isarea(variable) = istype(variable, /area)
isicon(variable) = istype(variable, /icon)
ismob(variable) = istype(variable, /mob)
isobj(variable) = istype(variable, /obj)
isturf(variable) = istype(variable, /turf)
isloc(variable) = ismob(variable) || isobj(variable) || isturf(variable) || isarea(variable)

Switching between variable types in code

Byond defined:
ascii2text
file2text
list2params
num2text
params2list
text2ascii
text2file
text2num
text2path
time2text

SS13 Defined:
text2dir(direction)
dir2text(direction)
dd_file2list(file_path, separator)
dd_text2list(text, separator, var/list/withinList)
dd_text2List(text, separator, var/list/withinList)
dd_list2text(var/list/the_list, separator)
angle2dir(var/degree)
angle2text(var/degree)

For more useful procs see
code/defines/procs/helpers.dm
code/game/objects/items/helper_procs.dm

If

Ifs default to checking for true if not otherwise stated. True is defined for all variable types as empty, 0 or non-existant (null).

 if(condition)
   action_true()
 else
   action_false()

Common variable behavior in if statements:

Variable type False when True when
String (text / ascii) "" or null Anything else
Int / Real 0 or null Anything else
datum, atom null Anything else

Logical operators

Pretty standard:

 !statement1 //NOT statement1
 (statement1) && (statement2) //statement1 AND statement2
 (statement1) || (statement2) //statement1 OR statement2
 == //equals
 != //not equal
 < (<=) //less (or equal)
 > (>=) //more (or equal)
 & //bitflag AND operator. 13 & 3 = 1 (1101 & 0011 = 0001)
 | //bitflag OR operator. 13 | 3 = 15 (1101 | 0011 = 1111)

Byond does not recognize the === (identical) operator. More operators can be found in the left menu on the reference page

While

Byond will cancel a loop if it reaches a certain number of iteration and give a runtime error out of fear of infinite loops. Same applies for recursions. Same as anywhere else

 while(condition)
   action1()

All loops understand the continue and break commands

For

All loops understand the continue and break commands

For combines the for loop and foreach loop:

For loop

 for(var/i = 1; i <= 10; i++)
   world << i //Will write (each in a new line) 1 2 3 4 5 6 7 8 9 10

For each

 for(var/obj/item/weapon/baton/B in world)  //will iterate through world.contents (which contains all atoms in the world) and only pick those which are of the given type (/obj/item/weapon/baton)
   B.name = "Smelly baton" //Will apply the new name to the baton in the current iteration loop

Do - While

The Do while operator is not commonly used in SS13 code, Byond does support it tho.

 var/i = 3
 do
   world << i--
 while(i)

All loops understand the continue and break commands

Defining objects

Doesn't matter if you want a datum or atom, the definition of objects is the same and simple:

 /obj/item/weapon/item1 //will nmake a new object of type obj.
   var/item_property = 5 //Will define a new variable type for all item1 objs
   name = "Testing Item" //The name var is already defined in parent objects so it is not defined here, but only assigned a new valie.
 
 /obj/item/weapon/item1/New() //Constructor proc
   ..() //should always be present in New() procs, see ..() for more information
   item_property = 3 //An action that is performed in the object constructor.

Procs (Methods, functions, procedures)

You're used to the standards of methods, functions and procedures, right? Well procs ignore some aspects of these. They can best be compared to Java methods, as they're tied to specific objects. They cannot be defined as static, private, public, etc. tho. You can write static methods, however the compiler will not restrict you from calling them in a non-static way or environment. Same applies for non-static methods.

 proc/proc_name(var/argument1, var/argument2)
   world << "[argument1] [argument2]"

The above would declare a global proc. If you wish to tie it to a certain level

..()

This is the same as super() in Java. It calls the parent object type's proc with the same name and same arguments.

Example:

 /obj/item
   name = "Item"
 
 /obj/item/New() //New() is the proc that gets called whenever a new object of this type is created. A constructor if you will.
   src.name = "It's an item!"
 
 /obj/item/stack
   name = "Stack"
 
 /obj/item/stack/New() 
   src.name = "It's a stack!"
   ..()

If you have the code from the example above and create a new object of type /obj/item/stack, it will first make the item in the game world with the name "Stack", because it's defined to be that by default. Then the New() proc will be called immedietally after. This will change the name to "It's a Stack!" but the call of the parent type's New() proc with the ..() command will then set it to "It's an item!". So in the end, the new object will be called "It's an item!". The ..() command is however very important in many cases as some things are defined only in the common parent's New() procs. In Del(), the proc which gets called prior to an object's deletion, it requires the code to get to the root Del() proc to even delete it. See examples of Del() in the code.

Important procs

New()

This proc is called whenever a new instance of the object is created. It can have arguments if needed. It should call ..() where applicable so that parent constructors can be applied.

If you wish to create a New() proc for atoms with custom arguments, ensure the first argument is for the object's location. Example:

 obj/item/weapon/my_item/New(var/location, var/i)
   ..()
   //Whatever else you need to do

To make a general object use

 new /datum/test_datum

To make an atom (which usually has a locaiton)

 new /obj/item/weapon(src.loc)

For the custom example above, the code to create a new such object would be: The 5 is just an example of a value which could be assigned to the var/i in the constructor.

 new /obj/item/weapon/my_item(src.loc, 5)

Where src is the proc owner, which contains the line above. src.loc is the locaiton of the src object.

Del()

This proc gets called before an object's delection. It MUST call ..() at the end as the actual deletion is done in the root Del() proc.

An object is deleted by using the del(O) proc with O being the object to be deleted.

attack_hand(mob/M as mob)

Whenever a user (M) clicks on the object with an empty active hand

attack_paw(mob/M as mob)

Whenever a monkey (M) clicks the object with an empty active hand

If a custom attack_paw(mob/user) proc is not written for an atom, it defaults to calling attack_hand(user)

attack_ai(mob/user)

Whenever an AI or cyborg clicks the object with an empty active hand

If a custom attack_ai(mob/user) proc is not written for an atom, it defaults to calling attack_hand(user)

attack(mob/M as mob, mob/user as mob)

When the object is used to attack mob M by mob user

attackby(obj/item/W, mob/user)

When the object is being attacked by user with W (Example: If you click on wires with wirecutters)

ex_act(severity)

How the item reacts to explosions. Severity can either be 1, 2 or 3 with 1 being the most destructive.

blob_act()

How the item reacts to a blob (magma) attack

emp_act(severity)

How the item reacts to an EMP. Severity can either be 1 or 2 with 1 being the more powerful EMP surge.

Topic(href, href_list)

This one's called when you click a link in a pop-up window. Like when you increase the output of SMES cells. The href_list variable is the important one as it's a parsed version of the arguments you add into a link. To make a link in the pop-up window, add the following line to the text you display (dat in the example):

 dat += text("<A href='?src=\ref[src];select=[i]'>[src.name]</a><br>")

Check the code for more examples of this.

process()

This gets called for all objects on every tick. If possible, avoid it as it's processor heavy, but for some things it just can't be avoided.

SS13 common variable meanings

Datum

Datums have the smallest number of pre-defined variables. These are present in all objects in the game:

 type //The type of an object. If your object is of type /obj/item/weapon/shovel writing the following: new src.type(src.loc) will make another shovel in the same tile.
 parent_type //Parent type of /obj/item/weapon/shovel is /obj/item/weapon... seems streight-foward enough.
 tag //The tag is used to help you identify things when using several instances. It has to be set manually for each instance tho. Lazy coders and mappers resulted in not many tags being used. Instances in the map editor are sorted by tag.
 vars //List of object vars the datum has defined

Atom

These variables are shared by all areas, mobs, objs and turfs.

 contents //List of contents. Closets store their contents in this var as do all storage items. All the items on a turf are in the turf's contents var.
 density //If density is at 0, you can walk over the object, if it's set to 1, you can't.
 desc //Description. When you right-click and examine an object, this will show under the name.
 dir //Object direction. Sprites have a direction variable which can have 8 'legal' states. More info
 gender //not used
 icon //The dmi file where the sprite is saved. Must be written in single quotations (Example: 'items.dmi')
 icon_state //The name of the sprite in the dmi file. If it's not a valid name or is left blank, the sprite without a name in the dmi file will be used. If such a sprite doesn't exist it will default to being blank.
 invisibility //Invisibility is used to determine what you can and what you can't see. Check the code or wait for someone who knows how exactly this works to write it here.
 infra_luminosity //Only mecha use this
 underlays //List of images (see image() proc) which are underlayed under the current sprite
 overlays //List of images (see image() proc) which are overlayed over the current sprite
 loc //Contains a reference to the turf file where the object currently is.
 layer //A numerical variable which determins how objects are layered. Tables with a layer of 2.8 are always under most items which have a layer of 3.0. Layers go up to 20, which is reserved for HUD items.
 luminosity //How much the item will glow. Note that the picking up and dropping of luminous items needs to be specially handled. See flashlight code for an example.
 mouse_over_pointer //not used
 mouse_drag_pointer //(almost) not used
 mouse_drop_pointer //not used
 mouse_drop_zone //not used
 mouse_opacity //Used in a few places. Check the description in the reference page
 name //The name of the object which is displayed when you right click the object and in the bottom left of the screen when you hover your mouse over it.
 opacity //Whether you can see through/past it (glass, floor) when set to 0 or whether you can't (walls, mecha) when set to 1.
 pixel_x //How many pixels in the x direction should the sprite be offset from the starting set. See the APC's New() proc for an example and how fire alarms are defined on the map. pixel_x = -5 will move it 5 pixels to the left and pixel_x = 5 will move it 5 pixels to the right
 pixel_y //Same as pixel_y but in the y direction. Positive values move it to the north, negative to the south.
 pixel_z //Used in isometric maps, so it's not used in SS13
 suffix //Rarely used. See the reference page for more information
 text //How to represent the object on text clients. Not used.
 type //The type of the object
 vars //See Datum above
 verbs //The verbs you can use with the item. Verbs are the options in the right click menu.
 x //X position, read only. Set the loc variable to move it or use the inbulit functions.
 y //Y position, read only. 
 z //Z position (Which z-level it's on), read only.

Area

 var/requires_power = 1 //Areas which are to work without an APC (Such as centcom areas) should have this at 0. All other areas should have it at 1.
 var/music = null //Music to be played when you enter the area.
 luminosity = 0 //Areas which should be lit at all times (such as space and centcom) should have this at 1 as well as the sd_lighting var at 0
 var/sd_lighting = 0 //This var determines whether dynamic lighting is to be calculated for the area's tiles. Turn this to off only for areas which have the luminosity var set to 1

Most other variables exist only for technical reasons and should not be messed with unless done through existing procs, they are defined in:

 code/defines/area/Space Station 13 areas.dm

Mob

There is a huge amount of variables for mobs. Take a look at the following files:

 code/defines/mob/mob.dm
 code/defines/mob/dead/observer.dm
 code/defines/mob/living/living.dm
 code/defines/mob/living/carbon/carbon.dm
 code/defines/mob/living/carbon/human.dm
 code/defines/mob/living/carbon/monkey.dm
 code/defines/mob/living/silicon/silicon.dm
 code/defines/mob/living/silicon/ai.dm
 code/defines/mob/living/silicon/robot.dm

There are also additional files for aliens, larva, facehuggers and more there, but the files above will have most of the variables you might need.

Obj

 var/m_amt = 0	// How much metal the item has. Used to determine how much metal you get when feeding it into an autolathe and how much it costs to produce it at the lathe
 var/g_amt = 0	// How much glass the item has. Used to determine how much glass you get when feeding it into an autolathe and how much it costs to produce it at the lathe
 var/w_amt = 0	// waster amounts. Not used
 var/origin_tech = null //Used by R&D to determine what research bonuses it grants. See examples in item definitions in code.
 var/reliability = 100	//Used by SOME devices to determine how reliable they are. The number represents the percentual chance for them to work properly.
 var/unacidable = 0 //universal "unacidabliness" var, objects with this set to 1 cannot be destroyed by acids.
 var/throwforce = 0 //The amount of damage applies to a target when they're hit by the item.

More variables are defined in:

 code/defines/obj.dm

Item

Items are objs which can be picked up. They're divided into several categories according to their function.

/obj/item is defined in the following file:

 code/defines/obj.dm

It adds the following variables (Look at the file for more, but these are the more important ones):

 var/force = null //This determins how much damage the target takes when they're attacked by the item in hand. Small items usually have it at 0, medium ones between 5 and 10, rare and powerful items around 10-15 and two-handed items at 15 and more. Syndicate items have it even higher at 40 and more.
 var/item_state = null //This it the var that determines which sprite will be used for the item from icons/mob/items_lefthand.dmi and items_righthand.dmi.
 var/damtype = "brute" //Determines what damage type the item produces.
 var/health = null //Some items use this to determine when they'll break from use or damage. Not common tho.
 var/hitsound = null //Sound that's played when you hit something with the item. Not commonly used.
 var/w_class = 3.0 //Weight class.
   // w_class = 1 means it's an item that can fit in a pocket (diskette, pen, cigarette packet)
   // w_class = 2 means the item can't fit in pockets but can fit in a box (clipboard, analyzer, cleaner)
   // w_class = 3 means the item can't fit in a box but can fit in backpacks (box, rods, metal)
   // w_class = 4 means the item can't even fit in a backpack (packpack, pickaxe, fireaxe)
   // w_class = 5 is used but not for weight classes.
 var/wielded = 0 //Used for double-handed items which can be carried in one hand but needs to be wielded by two hands before they can be used. This is determined by code when wielding and unwielding. All items should start with this at 0.
 var/twohanded = 0 ///Set this to 1 if your item is two-handed.
 flags = FPRINT | TABLEPASS //Flags

Machinery

Defined in:

 code/defines/obj/machinery.dm

Machinery are objs which cannot be picked up and generally require power to operate. They have the following vars defined for all of them:

 var/use_power = 0 //Determines if and how much power the machine will use each tick.
   //use_power = 0 - no power is used
   //use_power = 1 - idle power is used
   //use_power = 2 - active power is used
 var/idle_power_usage = 0 //How many watts of power the machine will use each tick when use_power is set to 1
 var/active_power_usage = 0 //How many watts of power the machine will use each tick when use_power is set to 2
 var/power_channel = EQUIP //Determines which APC power category the device falls under. EQUIP, ENVIRON or LIGHT
 var/list/component_parts = null //A list of parts needed to construct the machine from a machine frame.

Turf

 var/intact = 1 //This determines if the turf will hide pipes, cable and such. Set to 1 to hide and to 0 to not hide them. Only pipes and wire with level set to 1 will be hidden. Set their level var to 2 to keep them from being hidden.
 var/blocks_air = 0 //Determines if the turf prevents air from passing (walls) if set to 1.

Other variables exist but they're tied to atmospherics code which is not to be touched as whenever anything is changed in it it results in a million things breaking.

 code/defines/turf.dm

Simulated

Simulated floors are tiles which simulate air movement and temperature. The station is made entirely from these while centcom is made from unsimulated floors to prevent massive and unneeded lag.

 var/wet = 0 //If this it a positive number, it is wet and you'll slip on it if you run.
 var/thermite = 0 //Will be set to 1 when thermite is poured on it.
Simulated floors
 var/icon_regular_floor = "floor" //Determines what icon the steel version of the floor should have. Determined at floor creation (New() proc). If the icon_state of the floor at that point is one from the global icons_to_ignore_at_floor_init var, then this variable is assigned the value "floor". The icons_to_ignore_at_floor_init list contains broken, plating, burnt and non-steel icon_states from icons/turf/floors.dmi
 heat_capacity = 10000 //When a fire (hotspot) on the tile exceeds this number, the floor has a chance of melting. The more the number is exceeded, the higher the chance of melting.
 var/broken = 0 //This mostly only determins if you'll get the tile back when you use the crowbar
 var/burnt = 0 //This mostly only determins if you'll get the tile back when you use the crowbar
 var/obj/item/stack/tile/floor_tile = new/obj/item/stack/tile/steel //What floor tile is on the tile

Simulated floors are defined in:

 code/game/turf.dm
Simulated walls

Doesn't really contain any special new variables.

Defined in:

 code/defines/turf.dm
Contribution Guides & Game Resources
General Guide to Setting Up a Server, Downloading the Source Code, Guide to Contributing to the Game, Game Resources category
Coding Basics of Coding in BYOND, SS13 for Experienced Programmers, [NanoUI]
Mapping Guide to Mapping
Spriting Guide to Spriting
Wiki Guide to Contributing to the Wiki, Style Guide