SS13 for experienced programmers: Difference between revisions

no edit summary
imported>LiamLime
No edit summary
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Delete|Horribly outdated and unmaintained|[[User:LoliconSlayer|LoliconSlayer]], Gundam Enthusiast 22:29, 24 April 2023 (UTC)}}
Other related guides: [[Understanding SS13 code]] and [[Guide to mapping]]
Other related guides: [[Understanding SS13 code]] and [[Guide to mapping]]


Line 76: Line 78:
   TD.test_variable //will output 10 to all connected users
   TD.test_variable //will output 10 to all connected users


==== [[Binary flags|Bitflags]] ====
====Bitflags====
 
See the main article at [[Binary flags]].


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
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
Line 173: Line 173:
angle2dir(var/degree)<br>
angle2dir(var/degree)<br>
angle2text(var/degree)<br>
angle2text(var/degree)<br>
(Defined in [https://github.com/tgstation/-tg-station/blob/master/code/__HELPERS/type2type.dm code/__HELPERS/type2type.dm])
(Defined in [https://github.com/yogstation13/Yogstation/blob/master/code/__HELPERS/type2type.dm code/__HELPERS/type2type.dm])


For more useful procs see<br>
For more useful procs see<br>
[https://github.com/tgstation/-tg-station/tree/master/code/__HELPERS code/__HELPERS/] <br>
[https://github.com/yogstation13/Yogstation/tree/master/code/__HELPERS code/__HELPERS/] <br>
<s>[http://code.google.com/p/tgstation13/source/browse/trunk/code/defines/procs/helpers.dm code/defines/procs/helpers.dm]</s> (Dead link)<br>
<s>[http://code.google.com/p/tgstation13/source/browse/trunk/code/defines/procs/helpers.dm code/defines/procs/helpers.dm]</s> (Dead link)<br>
<s>[http://code.google.com/p/tgstation13/source/browse/trunk/code/game/objects/items/helper_procs.dm code/game/objects/items/helper_procs.dm]</s> (Dead link) <br>
<s>[http://code.google.com/p/tgstation13/source/browse/trunk/code/game/objects/items/helper_procs.dm code/game/objects/items/helper_procs.dm]</s> (Dead link) <br>
Line 403: Line 403:


Most other variables exist only for technical reasons and should not be messed with unless done through existing procs, they are defined in:
Most other variables exist only for technical reasons and should not be messed with unless done through existing procs, they are defined in:
   [https://github.com/tgstation/-tg-station/blob/master/code/game/area/Space%20Station%2013%20areas.dm code/game/area/Space Station 13 areas.dm]
   [https://github.com/yogstation13/Yogstation/blob/master/code/game/area/Space_Station_13_areas.dm code/game/area/Space Station 13 areas.dm]


=== Mob ===
=== Mob ===


There is a huge amount of variables for mobs. Take a look at the following files:
There is a huge amount of variables for mobs. Take a look at the following files:
   [https://github.com/tgstation/-tg-station/blob/master/code/modules/mob/mob.dm code/modules/mob/mob.dm]
   [https://github.com/yogstation13/Yogstation/blob/master/code/modules/mob/mob.dm code/modules/mob/mob.dm]
   [https://github.com/tgstation/-tg-station/blob/master/code/modules/mob/dead/observer/observer.dm code.modules/mob/dead/observer/observer.dm]
   [https://github.com/yogstation13/Yogstation/blob/master/code/modules/mob/dead/observer/observer.dm code.modules/mob/dead/observer/observer.dm]
   [https://github.com/tgstation/-tg-station/blob/master/code/modules/mob/living/living.dm code/modules/mob/living/living.dm]
   [https://github.com/yogstation13/Yogstation/blob/master/code/modules/mob/living/living.dm code/modules/mob/living/living.dm]
   [https://github.com/tgstation/-tg-station/blob/master/code/modules/mob/living/carbon/carbon.dm code/modules/mob/living/carbon/carbon.dm]
   [https://github.com/yogstation13/Yogstation/blob/master/code/modules/mob/living/carbon/carbon.dm code/modules/mob/living/carbon/carbon.dm]
   [https://github.com/tgstation/-tg-station/blob/master/code/modules/mob/living/carbon/human/human.dm code/modules/mob/living/carbon/human/human.dm]
   [https://github.com/yogstation13/Yogstation/blob/master/code/modules/mob/living/carbon/human/human.dm code/modules/mob/living/carbon/human/human.dm]
   [https://github.com/tgstation/-tg-station/blob/master/code/modules/mob/living/carbon/monkey/monkey.dm code/modules/mob/living/carbon/monkey/monkey.dm]
   [https://github.com/yogstation13/Yogstation/blob/master/code/modules/mob/living/carbon/monkey/monkey.dm code/modules/mob/living/carbon/monkey/monkey.dm]
   [https://github.com/tgstation/-tg-station/blob/master/code/modules/mob/living/silicon/silicon.dm code/modules/mob/living/silicon/silicon.dm]
   [https://github.com/yogstation13/Yogstation/blob/master/code/modules/mob/living/silicon/silicon.dm code/modules/mob/living/silicon/silicon.dm]
   [https://github.com/tgstation/-tg-station/blob/master/code/modules/mob/living/silicon/ai/ai.dm code/modules/mob/living/silicon/ai/ai.dm]
   [https://github.com/yogstation13/Yogstation/blob/master/code/modules/mob/living/silicon/ai/ai.dm code/modules/mob/living/silicon/ai/ai.dm]
   [https://github.com/tgstation/-tg-station/blob/master/code/modules/mob/living/silicon/robot/robot.dm code/modules/mob/living/silicon/robot/robot.dm]
   [https://github.com/yogstation13/Yogstation/blob/master/code/modules/mob/living/silicon/robot/robot.dm code/modules/mob/living/silicon/robot/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.
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.


Line 430: Line 430:


More variables are defined in:
More variables are defined in:
   [https://github.com/tgstation/-tg-station/blob/master/code/game/objects/objs.dm code/game/objects/obj.dm]
   [https://github.com/yogstation13/Yogstation/blob/master/code/game/objects/objs.dm code/game/objects/obj.dm]


==== Item ====
==== Item ====
Line 437: Line 437:


/obj/item is defined in the following file:
/obj/item is defined in the following file:
   [https://github.com/tgstation/-tg-station/blob/master/code/game/objects/items.dm code/game/objects/items.dm]
   [https://github.com/yogstation13/Yogstation/blob/master/code/game/objects/items.dm code/game/objects/items.dm]


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


Defined in:
Defined in:
   [https://github.com/tgstation/-tg-station/blob/master/code/game/machinery/machinery.dm code/game/machinery/machinery.dm]
   [https://github.com/yogstation13/Yogstation/blob/master/code/game/machinery/_machinery.dm code/game/machinery/_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:
Machinery are objs which cannot be picked up and generally require power to operate. They have the following vars defined for all of them:
Line 475: Line 475:
   var/blocks_air = 0 //Determines if the turf prevents air from passing (walls) if set to 1.
   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.
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.
   [https://github.com/tgstation/-tg-station/blob/master/code/game/turfs/turf.dm code/game/turfs/turf.dm]
   [https://github.com/yogstation13/Yogstation/blob/master/code/game/turfs/turf.dm code/game/turfs/turf.dm]


==== Simulated ====
==== Simulated ====
Line 493: Line 493:


Simulated floors are defined in:
Simulated floors are defined in:
   [https://github.com/tgstation/-tg-station/blob/master/code/game/turfs/simulated/floor.dm code/game/turfs/simulated/floor.dm]
   [https://github.com/yogstation13/Yogstation/blob/master/code/game/turfs/simulated/floor.dm code/game/turfs/simulated/floor.dm]


===== Simulated walls =====
===== Simulated walls =====
Line 500: Line 500:


Defined in:
Defined in:
   [https://github.com/tgstation/-tg-station/blob/master/code/game/turfs/simulated/walls.dm code/game/turfs/simulated/walls.dm]
   [https://github.com/yogstation13/Yogstation/blob/master/code/game/turfs/simulated/walls.dm code/game/turfs/simulated/walls.dm]


==Performance References==
==Performance References==
Wiki Staff
1,000

edits