Merge tgstation13 r4570 into bs12_with_tgport

Conflicts:
	baystation12.dme
	code/defines/obj.dm
	code/defines/procs/helpers.dm
	code/defines/turf.dm
	code/game/gamemodes/changeling/modularchangling.dm
	code/game/gamemodes/cult/cult_structures.dm
	code/game/gamemodes/events.dm
	code/game/machinery/telecomms/machine_interactions.dm
	code/game/master_controller.dm
	code/game/objects/items/blueprints.dm
	code/game/objects/items/devices/uplinks.dm
	code/game/objects/items/item.dm
	code/game/objects/items/weapons/gift_wrappaper.dm
	code/game/objects/items/weapons/wires.dm
	code/game/objects/weapons.dm
	code/game/turfs/turf.dm
	code/modules/clothing/head/hardhat.dm
	code/modules/mining/mine_items.dm
	code/modules/mining/mine_turfs.dm
	code/modules/mob/living/silicon/robot/life.dm
	code/modules/mob/mob_defines.dm
	code/modules/mob/new_player/login.dm
	code/modules/paperwork/pen.dm
	code/modules/paperwork/stamps.dm
	code/unused/toilets.dm
	html/changelog.html
	icons/effects/alert.dmi

Signed-off-by: Cael_Aislinn <cael_aislinn@yahoo.com.au>
This commit is contained in:
Cael_Aislinn
2012-08-28 19:57:11 +10:00
269 changed files with 14389 additions and 13349 deletions
+5 -12
View File
@@ -50,20 +50,13 @@
//Magic constants obtained by using linear regression on right-angled triangles of sides 0<x<1, 0<y<1
//They should approximate pythagoras theorem well enough for our needs.
//In fact, less accuracy is kinda better for explosions anyway :P Maybe k1=1, k2=0.5?
#define k1 0.934
#define k2 0.427
/proc/approx_dist(center=usr, T) // T is just the second atom to check distance to center with
var/turf/centerturf = get_turf(center)
var/turf/targetturf = get_turf(T)
var/a = abs(targetturf.x - centerturf.x) //sides of right-angled triangle
var/b = abs(targetturf.y - centerturf.y)
if(a>=b)
return (k1*a) + (k2*b) //No sqrt or powers :)
else
return (k1*b) + (k2*a)
/proc/cheap_hypotenuse(Ax,Ay,Bx,By) // T is just the second atom to check distance to center with
var/dx = abs(Ax - Bx) //sides of right-angled triangle
var/dy = abs(Ay - By)
if(dx>=dy) return (k1*dx) + (k2*dy) //No sqrt or powers :)
else return (k1*dx) + (k2*dy)
#undef k1
#undef k2
+30
View File
@@ -57,6 +57,13 @@ proc/isemptylist(list/list)
return 1
return 0
//Checks for specific types in a list
/proc/is_type_in_list(var/atom/A, var/list/L)
for(var/type in L)
if(istype(A, type))
return 1
return 0
//Empties the list by setting the length to 0. Hopefully the elements get garbage collected
proc/clearlist(list/list)
if(istype(list))
@@ -166,6 +173,29 @@ proc/listclearnulls(list/list)
K += item
return K
//Mergesort: divides up the list into halves to begin the sort
/proc/sortKey(var/list/client/L, var/order = 1)
if(isnull(L) || L.len < 2)
return L
var/middle = L.len / 2 + 1
return mergeKey(sortKey(L.Copy(0,middle)), sortKey(L.Copy(middle)), order)
//Mergsort: does the actual sorting and returns the results back to sortAtom
/proc/mergeKey(var/list/client/L, var/list/client/R, var/order = 1)
var/Li=1
var/Ri=1
var/list/result = new()
while(Li <= L.len && Ri <= R.len)
var/client/rL = L[Li]
var/client/rR = R[Ri]
if(sorttext(rL.ckey, rR.ckey) == order)
result += L[Li++]
else
result += R[Ri++]
if(Li <= L.len)
return (result + L.Copy(Li, 0))
return (result + R.Copy(Ri, 0))
//Mergesort: divides up the list into halves to begin the sort
/proc/sortAtom(var/list/atom/L, var/order = 1)
+44
View File
@@ -199,6 +199,50 @@ proc/tg_list2text(list/list, glue=",")
file = file(file_path)
return dd_text2list(file2text(file), separator)
//Turns a direction into text
/proc/dir2text(direction)
switch(direction)
if(1.0)
return "north"
if(2.0)
return "south"
if(4.0)
return "east"
if(8.0)
return "west"
if(5.0)
return "northeast"
if(6.0)
return "southeast"
if(9.0)
return "northwest"
if(10.0)
return "southwest"
else
return
//Turns text into proper directions
/proc/text2dir(direction)
switch(uppertext(direction))
if("NORTH")
return 1
if("SOUTH")
return 2
if("EAST")
return 4
if("WEST")
return 8
if("NORTHEAST")
return 5
if("NORTHWEST")
return 9
if("SOUTHEAST")
return 6
if("SOUTHWEST")
return 10
else
return
//Converts an angle (degrees) into an ss13 direction
/proc/angle2dir(var/degree)
degree = ((degree+22.5)%365)
+198 -53
View File
@@ -320,6 +320,10 @@ Turf and target are seperate in case you want to teleport some distance from a t
oldname = null//don't bother with the records update crap
world << "<b>[newname] is the AI!</b>"
world << sound('sound/AI/newAI.ogg')
for(var/mob/aiEye/E in mob_list)
if(E.ai && E.ai == src)
E.name = "[newname] (AI Eye)"
break
fully_replace_character_name(oldname,newname)
@@ -399,30 +403,31 @@ Turf and target are seperate in case you want to teleport some distance from a t
return creatures
//Orders mobs by type
//Orders mobs by type then by name
/proc/sortmobs()
var/list/moblist = list()
for(var/mob/living/silicon/ai/M in mob_list)
var/list/sortmob = sortAtom(mob_list)
for(var/mob/living/silicon/ai/M in sortmob)
moblist.Add(M)
for(var/mob/living/silicon/pai/M in mob_list)
for(var/mob/living/silicon/pai/M in sortmob)
moblist.Add(M)
for(var/mob/living/silicon/robot/M in mob_list)
for(var/mob/living/silicon/robot/M in sortmob)
moblist.Add(M)
for(var/mob/living/carbon/human/M in mob_list)
for(var/mob/living/carbon/human/M in sortmob)
moblist.Add(M)
for(var/mob/living/carbon/brain/M in mob_list)
for(var/mob/living/carbon/brain/M in sortmob)
moblist.Add(M)
for(var/mob/living/carbon/alien/M in mob_list)
for(var/mob/living/carbon/alien/M in sortmob)
moblist.Add(M)
for(var/mob/dead/observer/M in mob_list)
for(var/mob/dead/observer/M in sortmob)
moblist.Add(M)
for(var/mob/new_player/M in mob_list)
for(var/mob/new_player/M in sortmob)
moblist.Add(M)
for(var/mob/living/carbon/monkey/M in mob_list)
for(var/mob/living/carbon/monkey/M in sortmob)
moblist.Add(M)
for(var/mob/living/carbon/metroid/M in mob_list)
for(var/mob/living/carbon/metroid/M in sortmob)
moblist.Add(M)
for(var/mob/living/simple_animal/M in mob_list)
for(var/mob/living/simple_animal/M in sortmob)
moblist.Add(M)
// for(var/mob/living/silicon/hivebot/M in world)
// mob_list.Add(M)
@@ -762,6 +767,17 @@ proc/anim(turf/location as turf,target as mob|obj,a_icon,a_icon_state as text,fl
if(A.vars.Find(lowertext(varname))) return 1
else return 0
//Returns: all the areas in the world
/proc/return_areas()
var/list/area/areas = list()
for(var/area/A in world)
areas += A
return areas
//Returns: all the areas in the world, sorted.
/proc/return_sorted_areas()
return sortAtom(return_areas())
//Takes: Area type as text string or as typepath OR an instance of the area.
//Returns: A list of all areas of that type in the world.
/proc/get_areas(var/areatype)
@@ -907,25 +923,25 @@ proc/anim(turf/location as turf,target as mob|obj,a_icon,a_icon_state as text,fl
if(!istype(O,/obj)) continue
O.loc = X
for(var/mob/M in T)
if(!istype(M,/mob)) continue
if(!istype(M,/mob) || istype(M, /mob/aiEye)) continue // If we need to check for more mobs, I'll add a variable
M.loc = X
var/area/AR = X.loc
// var/area/AR = X.loc
if(AR.sd_lighting)
X.opacity = !X.opacity
X.sd_SetOpacity(!X.opacity)
// if(AR.lighting_use_dynamic) //TODO: rewrite this code so it's not messed by lighting ~Carn
// X.opacity = !X.opacity
// X.SetOpacity(!X.opacity)
toupdate += X
if(turftoleave)
var/turf/ttl = new turftoleave(T)
var/area/AR2 = ttl.loc
// var/area/AR2 = ttl.loc
if(AR2.sd_lighting)
ttl.opacity = !ttl.opacity
ttl.sd_SetOpacity(!ttl.opacity)
// if(AR2.lighting_use_dynamic) //TODO: rewrite this code so it's not messed by lighting ~Carn
// ttl.opacity = !ttl.opacity
// ttl.sd_SetOpacity(!ttl.opacity)
fromupdate += ttl
@@ -942,13 +958,19 @@ proc/anim(turf/location as turf,target as mob|obj,a_icon,a_icon_state as text,fl
for(var/turf/simulated/T1 in toupdate)
for(var/obj/machinery/door/D2 in T1)
doors += D2
air_master.tiles_to_update |= T1
/*if(T1.parent)
air_master.groups_to_rebuild += T1.parent
else
air_master.tiles_to_update += T1*/
if(fromupdate.len)
for(var/turf/simulated/T2 in fromupdate)
for(var/obj/machinery/door/D2 in T2)
doors += D2
air_master.tiles_to_update |= T2
/*if(T2.parent)
air_master.groups_to_rebuild += T2.parent
else
air_master.tiles_to_update += T2*/
for(var/obj/O in doors)
O:update_nearby_tiles(1)
@@ -1062,9 +1084,7 @@ proc/DuplicateObject(obj/original, var/perfectcopy = 0 , var/sameloc = 0)
for(var/mob/M in T)
if(!istype(M,/mob))
continue
if(!istype(M,/mob) || istype(M, /mob/aiEye)) continue // If we need to check for more mobs, I'll add a variable
mobs += M
for(var/mob/M in mobs)
@@ -1079,14 +1099,14 @@ proc/DuplicateObject(obj/original, var/perfectcopy = 0 , var/sameloc = 0)
for(var/V in T.vars)
if(!(V in list("type","loc","locs","vars", "parent", "parent_type","verbs","ckey","key","x","y","z","contents", "luminosity", "sd_light_spill",)))
if(!(V in list("type","loc","locs","vars", "parent", "parent_type","verbs","ckey","key","x","y","z","contents", "luminosity")))
X.vars[V] = T.vars[V]
var/area/AR = X.loc
// var/area/AR = X.loc
if(AR.sd_lighting)
X.opacity = !X.opacity
X.sd_SetOpacity(!X.opacity)
// if(AR.lighting_use_dynamic)
// X.opacity = !X.opacity
// X.sd_SetOpacity(!X.opacity) //TODO: rewrite this code so it's not messed by lighting ~Carn
toupdate += X
@@ -1099,12 +1119,11 @@ proc/DuplicateObject(obj/original, var/perfectcopy = 0 , var/sameloc = 0)
var/list/doors = new/list()
//skytodo: wtf is going on here?
/*if(toupdate.len)
if(toupdate.len)
for(var/turf/simulated/T1 in toupdate)
for(var/obj/machinery/door/D2 in T1)
doors += D2
if(T1.parent)
/*if(T1.parent)
air_master.groups_to_rebuild += T1.parent
else
air_master.tiles_to_update += T1*/
@@ -1151,26 +1170,152 @@ proc/get_mob_with_client_list()
mobs += M
return mobs
/atom/proc/transfer_fingerprints_to(var/atom/A)
if(!istype(A.fingerprints,/list))
A.fingerprints = list()
if(!istype(A.fingerprintshidden,/list))
A.fingerprintshidden = list()
A.fingerprints |= fingerprints //detective
A.fingerprintshidden |= fingerprintshidden //admin
A.fingerprintslast = fingerprintslast
/proc/parse_zone(zone)
if(zone == "r_hand") return "right hand"
else if (zone == "l_hand") return "left hand"
else if (zone == "l_arm") return "left arm"
else if (zone == "r_arm") return "right arm"
else if (zone == "l_leg") return "left leg"
else if (zone == "r_leg") return "right leg"
else if (zone == "l_foot") return "left foot"
else if (zone == "r_foot") return "right foot"
else return zone
//todo: this func is missing diagonals
/proc/get_turf(turf/location)
while(location)
if(isturf(location))
return location
location = location.loc
return null
/proc/get_turf_or_move(turf/location)
return get_turf(location)
//Quick type checks for some tools
var/global/list/common_tools = list(
/obj/item/weapon/cable_coil,
/obj/item/weapon/wrench,
/obj/item/weapon/weldingtool,
/obj/item/weapon/screwdriver,
/obj/item/weapon/wirecutters,
/obj/item/device/multitool,
/obj/item/weapon/crowbar)
/proc/istool(O)
if(O && is_type_in_list(O, common_tools))
return 1
return 0
/proc/iswrench(O)
if(istype(O, /obj/item/weapon/wrench))
return 1
return 0
/proc/iswelder(O)
if(istype(O, /obj/item/weapon/weldingtool))
return 1
return 0
/proc/iscoil(O)
if(istype(O, /obj/item/weapon/cable_coil))
return 1
return 0
/proc/iswirecutter(O)
if(istype(O, /obj/item/weapon/wirecutters))
return 1
return 0
/proc/isscrewdriver(O)
if(istype(O, /obj/item/weapon/screwdriver))
return 1
return 0
/proc/ismultitool(O)
if(istype(O, /obj/item/device/multitool))
return 1
return 0
/proc/iscrowbar(O)
if(istype(O, /obj/item/weapon/crowbar))
return 1
return 0
proc/is_hot(obj/item/W as obj)
switch(W.type)
if(/obj/item/weapon/weldingtool)
var/obj/item/weapon/weldingtool/WT = W
if(WT.isOn())
return 3800
else
return 0
if(/obj/item/weapon/lighter)
if(W:lit)
return 1500
else
return 0
if(/obj/item/weapon/match)
if(W:lit)
return 1000
else
return 0
if(/obj/item/clothing/mask/cigarette)
if(W:lit)
return 1000
else
return 0
if(/obj/item/weapon/pickaxe/plasmacutter)
return 3800
if(/obj/item/weapon/melee/energy)
return 3500
else
return 0
return 0
//Is this even used for anything besides balloons? Yes I took out the W:lit stuff because : really shouldnt be used.
/proc/is_sharp(obj/item/W as obj) // For the record, WHAT THE HELL IS THIS METHOD OF DOING IT?
return ( \
istype(W, /obj/item/weapon/screwdriver) || \
istype(W, /obj/item/weapon/pen) || \
istype(W, /obj/item/weapon/weldingtool) || \
istype(W, /obj/item/weapon/lighter/zippo) || \
istype(W, /obj/item/weapon/match) || \
istype(W, /obj/item/clothing/mask/cigarette) || \
istype(W, /obj/item/weapon/wirecutters) || \
istype(W, /obj/item/weapon/circular_saw) || \
istype(W, /obj/item/weapon/melee/energy/sword) || \
istype(W, /obj/item/weapon/melee/energy/blade) || \
istype(W, /obj/item/weapon/shovel) || \
istype(W, /obj/item/weapon/kitchenknife) || \
istype(W, /obj/item/weapon/butch) || \
istype(W, /obj/item/weapon/scalpel) || \
istype(W, /obj/item/weapon/kitchen/utensil/knife) || \
istype(W, /obj/item/weapon/shard) || \
istype(W, /obj/item/weapon/broken_bottle) || \
istype(W, /obj/item/weapon/reagent_containers/syringe) || \
istype(W, /obj/item/weapon/kitchen/utensil/fork) && W.icon_state != "forkloaded" || \
istype(W, /obj/item/weapon/twohanded/fireaxe) \
)
/proc/reverse_direction(var/dir)
switch(dir)
if(1)
return 2
if(4)
return 8
if(2)
return 1
if(8)
return 4
else
return dir
if(NORTH)
return SOUTH
if(NORTHEAST)
return SOUTHWEST
if(EAST)
return WEST
if(SOUTHEAST)
return NORTHWEST
if(SOUTH)
return NORTH
if(SOUTHWEST)
return NORTHEAST
if(WEST)
return EAST
if(NORTHWEST)
return SOUTHEAST