Skip to content

Commit

Permalink
Merge branch 'master' of github.com:tgstation/-tg-station into assemb…
Browse files Browse the repository at this point in the history
…lyfun

Conflicts:
	code/game/objects/items/weapons/grenades/chem_grenade.dm
	html/changelog.html
  • Loading branch information
Petethegoat committed Jun 15, 2013
2 parents 6d62ead + 18edc90 commit c7c3bd4
Show file tree
Hide file tree
Showing 144 changed files with 2,278 additions and 1,631 deletions.
12 changes: 6 additions & 6 deletions code/ATMOSPHERICS/components/binary_devices/dp_vent_pump.dm
Original file line number Diff line number Diff line change
Expand Up @@ -169,23 +169,23 @@
pump_direction = 1

if("set_input_pressure" in signal.data)
input_pressure_min = between(
0,
input_pressure_min = Clamp(
text2num(signal.data["set_input_pressure"]),
0,
ONE_ATMOSPHERE*50
)

if("set_output_pressure" in signal.data)
output_pressure_max = between(
0,
output_pressure_max = Clamp(
text2num(signal.data["set_output_pressure"]),
0,
ONE_ATMOSPHERE*50
)

if("set_external_pressure" in signal.data)
external_pressure_bound = between(
0,
external_pressure_bound = Clamp(
text2num(signal.data["set_external_pressure"]),
0,
ONE_ATMOSPHERE*50
)

Expand Down
4 changes: 2 additions & 2 deletions code/ATMOSPHERICS/components/binary_devices/passive_gate.dm
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ obj/machinery/atmospherics/binary/passive_gate
on = !on

if("set_output_pressure" in signal.data)
target_pressure = between(
0,
target_pressure = Clamp(
text2num(signal.data["set_output_pressure"]),
0,
ONE_ATMOSPHERE*50
)

Expand Down
4 changes: 2 additions & 2 deletions code/ATMOSPHERICS/components/binary_devices/pump.dm
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ obj/machinery/atmospherics/binary/pump
on = !on

if("set_output_pressure" in signal.data)
target_pressure = between(
0,
target_pressure = Clamp(
text2num(signal.data["set_output_pressure"]),
0,
ONE_ATMOSPHERE*50
)

Expand Down
4 changes: 2 additions & 2 deletions code/ATMOSPHERICS/components/binary_devices/volume_pump.dm
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ obj/machinery/atmospherics/binary/volume_pump
on = !on

if("set_transfer_rate" in signal.data)
transfer_rate = between(
0,
transfer_rate = Clamp(
text2num(signal.data["set_transfer_rate"]),
0,
air1.volume
)

Expand Down
8 changes: 4 additions & 4 deletions code/ATMOSPHERICS/components/trinary_devices/filter.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ obj/machinery/atmospherics/trinary/filter
/*
Filter types:
-1: Nothing
0: Carbon Molecules: Plasma Toxin, Oxygen Agent B
0: Plasma: Plasma Toxin, Oxygen Agent B
1: Oxygen: Oxygen ONLY
2: Nitrogen: Nitrogen ONLY
3: Carbon Dioxide: Carbon Dioxide ONLY
Expand Down Expand Up @@ -85,7 +85,7 @@ Filter types:
filtered_out.temperature = removed.temperature

switch(filter_type)
if(0) //removing hydrocarbons
if(0) //removing plasma
filtered_out.toxins = removed.toxins
removed.toxins = 0

Expand Down Expand Up @@ -172,7 +172,7 @@ obj/machinery/atmospherics/trinary/filter/attack_hand(user as mob) // -- TLE
var/current_filter_type
switch(filter_type)
if(0)
current_filter_type = "Carbon Molecules"
current_filter_type = "Plasma"
if(1)
current_filter_type = "Oxygen"
if(2)
Expand All @@ -190,7 +190,7 @@ obj/machinery/atmospherics/trinary/filter/attack_hand(user as mob) // -- TLE
<b>Power: </b><a href='?src=\ref[src];power=1'>[on?"On":"Off"]</a><br>
<b>Filtering: </b>[current_filter_type]<br><HR>
<h4>Set Filter Type:</h4>
<A href='?src=\ref[src];filterset=0'>Carbon Molecules</A><BR>
<A href='?src=\ref[src];filterset=0'>Plasma</A><BR>
<A href='?src=\ref[src];filterset=1'>Oxygen</A><BR>
<A href='?src=\ref[src];filterset=2'>Nitrogen</A><BR>
<A href='?src=\ref[src];filterset=3'>Carbon Dioxide</A><BR>
Expand Down
9 changes: 7 additions & 2 deletions code/ATMOSPHERICS/components/trinary_devices/mixer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,13 @@ obj/machinery/atmospherics/trinary/mixer
var/air2_moles = air2.total_moles()

if((air1_moles < transfer_moles1) || (air2_moles < transfer_moles2))
if(!transfer_moles1 || !transfer_moles2) return
var/ratio = min(air1_moles/transfer_moles1, air2_moles/transfer_moles2)
var/ratio = 0
if (( transfer_moles1 > 0 ) && (transfer_moles2 >0 ))
ratio = min(air1_moles/transfer_moles1, air2_moles/transfer_moles2)
if (( transfer_moles2 == 0 ) && ( transfer_moles1 > 0 ))
ratio = air1_moles/transfer_moles1
if (( transfer_moles1 == 0 ) && ( transfer_moles2 > 0 ))
ratio = air2_moles/transfer_moles2

transfer_moles1 *= ratio
transfer_moles2 *= ratio
Expand Down
2 changes: 1 addition & 1 deletion code/ATMOSPHERICS/components/unary/outlet_injector.dm
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@

if("set_volume_rate" in signal.data)
var/number = text2num(signal.data["set_volume_rate"])
volume_rate = between(0, number, air_contents.volume)
volume_rate = Clamp(number, 0, air_contents.volume)

if("status" in signal.data)
spawn(2)
Expand Down
16 changes: 8 additions & 8 deletions code/ATMOSPHERICS/components/unary/vent_pump.dm
Original file line number Diff line number Diff line change
Expand Up @@ -214,30 +214,30 @@
pump_direction = text2num(signal.data["direction"])

if("set_internal_pressure" in signal.data)
internal_pressure_bound = between(
0,
internal_pressure_bound = Clamp(
text2num(signal.data["set_internal_pressure"]),
0,
ONE_ATMOSPHERE*50
)

if("set_external_pressure" in signal.data)
external_pressure_bound = between(
0,
external_pressure_bound = Clamp(
text2num(signal.data["set_external_pressure"]),
0,
ONE_ATMOSPHERE*50
)

if("adjust_internal_pressure" in signal.data)
internal_pressure_bound = between(
0,
internal_pressure_bound = Clamp(
internal_pressure_bound + text2num(signal.data["adjust_internal_pressure"]),
0,
ONE_ATMOSPHERE*50
)

if("adjust_external_pressure" in signal.data)
external_pressure_bound = between(
0,
external_pressure_bound = Clamp(
external_pressure_bound + text2num(signal.data["adjust_external_pressure"]),
0,
ONE_ATMOSPHERE*50
)

Expand Down
6 changes: 2 additions & 4 deletions code/FEA/FEA_turf_tile.dm
Original file line number Diff line number Diff line change
Expand Up @@ -262,16 +262,14 @@ turf/simulated
//See what kind of border it is
if(istype(T,/turf/space))
if(parent.space_borders)
parent.space_borders -= src
parent.space_borders += src
parent.space_borders |= src
else
parent.space_borders = list(src)
length_space_border++

else
if(parent.borders)
parent.borders -= src
parent.borders += src
parent.borders |= src
else
parent.borders = list(src)

Expand Down
12 changes: 11 additions & 1 deletion code/__DEFINES.dm
Original file line number Diff line number Diff line change
Expand Up @@ -456,4 +456,14 @@ var/list/be_special_flags = list(
#define DNA_HAIR_STYLE_BLOCK 7

#define DNA_STRUC_ENZYMES_BLOCKS 14
#define DNA_UNIQUE_ENZYMES_LEN 32
#define DNA_UNIQUE_ENZYMES_LEN 32

//Transformation proc stuff
#define TR_KEEPITEMS 1
#define TR_KEEPVIRUS 2
#define TR_KEEPDAMAGE 4
#define TR_HASHNAME 8 // hashing names (e.g. monkey(e34f)) (only in monkeyize)
#define TR_KEEPIMPLANTS 16
#define TR_KEEPSE 32 // changelings shouldn't edit the DNA's SE when turning into a monkey
#define TR_DEFAULTMSG 64
#define TR_KEEPSRC 128
3 changes: 2 additions & 1 deletion code/__HELPERS/global_lists.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ var/global/list/player_list = list() //List of all mobs **with clients attach
var/global/list/mob_list = list() //List of all mobs, including clientless
var/global/list/living_mob_list = list() //List of all alive mobs, including clientless. Excludes /mob/new_player
var/global/list/dead_mob_list = list() //List of all dead mobs, including clientless. Excludes /mob/new_player
var/global/list/joined_player_list = list() //List of all clients that have joined the game at round-start or as a latejoin.

var/global/list/cable_list = list() //Index for all cables, so that powernets don't have to look through the entire world all the time
var/global/list/chemical_reactions_list //list of all /datum/chemical_reaction datums. Used during chemical reactions
Expand Down Expand Up @@ -73,4 +74,4 @@ var/global/list/backbaglist = list("Nothing", "Backpack", "Satchel")
for(var/path in typesof(prototype))
if(path == prototype) continue
L += new path()
return L
return L
48 changes: 34 additions & 14 deletions code/__HELPERS/lists.dm
Original file line number Diff line number Diff line change
Expand Up @@ -31,29 +31,28 @@
return "[output][and_text][input[index]]"

//Returns list element or null. Should prevent "index out of bounds" error.
proc/listgetindex(var/list/list,index)
if(istype(list) && list.len)
proc/listgetindex(list/L, index)
if(istype(L))
if(isnum(index))
if(InRange(index,1,list.len))
return list[index]
else if(index in list)
return list[index]
if(IsInRange(index,1,L.len))
return L[index]
else if(index in L)
return L[index]
return

proc/islist(list/list)
if(istype(list))
proc/islist(list/L)
if(istype(L))
return 1
return 0

//Return either pick(list) or null if list is not of type /list or is empty
proc/safepick(list/list)
if(!islist(list) || !list.len)
return
return pick(list)
proc/safepick(list/L)
if(istype(L) && L.len)
return pick(L)

//Checks if the list is empty
proc/isemptylist(list/list)
if(!list.len)
proc/isemptylist(list/L)
if(!L.len)
return 1
return 0

Expand Down Expand Up @@ -291,6 +290,27 @@ proc/listclearnulls(list/list)
return (result + L.Copy(Li, 0))
return (result + R.Copy(Ri, 0))

//Mergesort: any value in a list, preserves key=value structure
/proc/sortAssoc(var/list/L)
if(L.len < 2)
return L
var/middle = L.len / 2 + 1 // Copy is first,second-1
return mergeAssoc(sortAssoc(L.Copy(0,middle)), sortAssoc(L.Copy(middle))) //second parameter null = to end of list

/proc/mergeAssoc(var/list/L, var/list/R)
var/Li=1
var/Ri=1
var/list/result = new()
while(Li <= L.len && Ri <= R.len)
if(sorttext(L[Li], R[Ri]) < 1)
result += R&R[Ri++]
else
result += L&L[Li++]

if(Li <= L.len)
return (result + L.Copy(Li, 0))
return (result + R.Copy(Ri, 0))


//Converts a bitfield to a list of numbers (or words if a wordlist is provided)
/proc/bitfield2list(bitfield = 0, list/wordlist)
Expand Down
4 changes: 3 additions & 1 deletion code/__HELPERS/maths.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
var/const/E = 2.71828183
var/const/Sqrt2 = 1.41421356

/proc/sign(x)
return x!=0?x/abs(x):0

/proc/Atan2(x, y)
if(!x && !y) return 0
Expand Down Expand Up @@ -110,7 +112,7 @@ var/const/Sqrt2 = 1.41421356
var/t = round((val - min) / d)
return val - (t * d)

//polar variant of a gaussian distributed PRNG
//converts a uniform distributed random number into a normal distributed one
//since this method produces two random numbers, one is saved for subsequent calls
//(making the cost negligble for every second call)
//This will return +/- decimals, situated about mean with standard deviation stddev
Expand Down
Loading

0 comments on commit c7c3bd4

Please sign in to comment.