Fix conflict.

This commit is contained in:
ESwordTheCat
2014-04-27 04:08:29 -08:00

View File

@@ -1,467 +1,467 @@
/proc/dopage(src,target) /proc/dopage(src,target)
var/href_list var/href_list
var/href var/href
href_list = params2list("src=\ref[src]&[target]=1") href_list = params2list("src=\ref[src]&[target]=1")
href = "src=\ref[src];[target]=1" href = "src=\ref[src];[target]=1"
src:temphtml = null src:temphtml = null
src:Topic(href, href_list) src:Topic(href, href_list)
return null return null
/proc/get_area(O) /proc/get_area(O)
var/atom/location = O var/atom/location = O
var/i var/i
for(i=1, i<=20, i++) for(i=1, i<=20, i++)
if(isarea(location)) if(isarea(location))
return location return location
else if (istype(location)) else if (istype(location))
location = location.loc location = location.loc
else else
return null return null
return 0 return 0
/proc/get_area_master(O) /proc/get_area_master(O)
var/area/A = get_area(O) var/area/A = get_area(O)
if(A && A.master) if(A && A.master)
A = A.master A = A.master
return A return A
/proc/get_area_name(N) //get area by its name /proc/get_area_name(N) //get area by its name
for(var/area/A in world) for(var/area/A in world)
if(A.name == N) if(A.name == N)
return A return A
return 0 return 0
/proc/in_range(source, user) /proc/in_range(source, user)
if(get_dist(source, user) <= 1) if(get_dist(source, user) <= 1)
return 1 return 1
return 0 //not in range and not telekinetic return 0 //not in range and not telekinetic
// Like view but bypasses luminosity check // Like view but bypasses luminosity check
/proc/hear(var/range, var/atom/source) /proc/hear(var/range, var/atom/source)
var/lum = source.luminosity var/lum = source.luminosity
source.luminosity = 6 source.luminosity = 6
. = view(range, source) . = view(range, source)
source.luminosity = lum source.luminosity = lum
/proc/alone_in_area(var/area/the_area, var/mob/must_be_alone, var/check_type = /mob/living/carbon) /proc/alone_in_area(var/area/the_area, var/mob/must_be_alone, var/check_type = /mob/living/carbon)
var/area/our_area = get_area_master(the_area) var/area/our_area = get_area_master(the_area)
for(var/C in living_mob_list) for(var/C in living_mob_list)
if(!istype(C, check_type)) if(!istype(C, check_type))
continue continue
if(C == must_be_alone) if(C == must_be_alone)
continue continue
if(our_area == get_area_master(C)) if(our_area == get_area_master(C))
return 0 return 0
return 1 return 1
//Magic constants obtained by using linear regression on right-angled triangles of sides 0<x<1, 0<y<1 //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. //They should approximate pythagoras theorem well enough for our needs.
#define k1 0.934 #define k1 0.934
#define k2 0.427 #define k2 0.427
/proc/cheap_hypotenuse(Ax,Ay,Bx,By) // T is just the second atom to check distance to center with /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/dx = abs(Ax - Bx) //sides of right-angled triangle
var/dy = abs(Ay - By) var/dy = abs(Ay - By)
if(dx>=dy) return (k1*dx) + (k2*dy) //No sqrt or powers :) if(dx>=dy) return (k1*dx) + (k2*dy) //No sqrt or powers :)
else return (k2*dx) + (k1*dy) else return (k2*dx) + (k1*dy)
#undef k1 #undef k1
#undef k2 #undef k2
/proc/circlerange(center=usr,radius=3) /proc/circlerange(center=usr,radius=3)
var/turf/centerturf = get_turf(center) var/turf/centerturf = get_turf(center)
var/list/turfs = new/list() var/list/turfs = new/list()
var/rsq = radius * (radius+0.5) var/rsq = radius * (radius+0.5)
for(var/atom/T in range(radius, centerturf)) for(var/atom/T in range(radius, centerturf))
var/dx = T.x - centerturf.x var/dx = T.x - centerturf.x
var/dy = T.y - centerturf.y var/dy = T.y - centerturf.y
if(dx*dx + dy*dy <= rsq) if(dx*dx + dy*dy <= rsq)
turfs += T turfs += T
//turfs += centerturf //turfs += centerturf
return turfs return turfs
/proc/circleview(center=usr,radius=3) /proc/circleview(center=usr,radius=3)
var/turf/centerturf = get_turf(center) var/turf/centerturf = get_turf(center)
var/list/atoms = new/list() var/list/atoms = new/list()
var/rsq = radius * (radius+0.5) var/rsq = radius * (radius+0.5)
for(var/atom/A in view(radius, centerturf)) for(var/atom/A in view(radius, centerturf))
var/dx = A.x - centerturf.x var/dx = A.x - centerturf.x
var/dy = A.y - centerturf.y var/dy = A.y - centerturf.y
if(dx*dx + dy*dy <= rsq) if(dx*dx + dy*dy <= rsq)
atoms += A atoms += A
//turfs += centerturf //turfs += centerturf
return atoms return atoms
/proc/get_dist_euclidian(atom/Loc1 as turf|mob|obj,atom/Loc2 as turf|mob|obj) /proc/get_dist_euclidian(atom/Loc1 as turf|mob|obj,atom/Loc2 as turf|mob|obj)
var/dx = Loc1.x - Loc2.x var/dx = Loc1.x - Loc2.x
var/dy = Loc1.y - Loc2.y var/dy = Loc1.y - Loc2.y
var/dist = sqrt(dx**2 + dy**2) var/dist = sqrt(dx**2 + dy**2)
return dist return dist
/proc/circlerangeturfs(center=usr,radius=3) /proc/circlerangeturfs(center=usr,radius=3)
var/turf/centerturf = get_turf(center) var/turf/centerturf = get_turf(center)
var/list/turfs = new/list() var/list/turfs = new/list()
var/rsq = radius * (radius+0.5) var/rsq = radius * (radius+0.5)
for(var/turf/T in range(radius, centerturf)) for(var/turf/T in range(radius, centerturf))
var/dx = T.x - centerturf.x var/dx = T.x - centerturf.x
var/dy = T.y - centerturf.y var/dy = T.y - centerturf.y
if(dx*dx + dy*dy <= rsq) if(dx*dx + dy*dy <= rsq)
turfs += T turfs += T
return turfs return turfs
/proc/circleviewturfs(center=usr,radius=3) //Is there even a diffrence between this proc and circlerangeturfs()? /proc/circleviewturfs(center=usr,radius=3) //Is there even a diffrence between this proc and circlerangeturfs()?
var/turf/centerturf = get_turf(center) var/turf/centerturf = get_turf(center)
var/list/turfs = new/list() var/list/turfs = new/list()
var/rsq = radius * (radius+0.5) var/rsq = radius * (radius+0.5)
for(var/turf/T in view(radius, centerturf)) for(var/turf/T in view(radius, centerturf))
var/dx = T.x - centerturf.x var/dx = T.x - centerturf.x
var/dy = T.y - centerturf.y var/dy = T.y - centerturf.y
if(dx*dx + dy*dy <= rsq) if(dx*dx + dy*dy <= rsq)
turfs += T turfs += T
return turfs return turfs
//var/debug_mob = 0 //var/debug_mob = 0
// Will recursively loop through an atom's contents and check for mobs, then it will loop through every atom in that atom's contents. // Will recursively loop through an atom's contents and check for mobs, then it will loop through every atom in that atom's contents.
// It will keep doing this until it checks every content possible. This will fix any problems with mobs, that are inside objects, // It will keep doing this until it checks every content possible. This will fix any problems with mobs, that are inside objects,
// being unable to hear people due to being in a box within a bag. // being unable to hear people due to being in a box within a bag.
/proc/recursive_mob_check(var/atom/O, var/list/L = list(), var/recursion_limit = 3, var/client_check = 1, var/sight_check = 1, var/include_radio = 1) /proc/recursive_mob_check(var/atom/O, var/list/L = list(), var/recursion_limit = 3, var/client_check = 1, var/sight_check = 1, var/include_radio = 1)
//debug_mob += O.contents.len //debug_mob += O.contents.len
if(!recursion_limit) if(!recursion_limit)
return L return L
for(var/atom/movable/A in O.contents) for(var/atom/movable/A in O.contents)
if(ismob(A)) if(ismob(A))
var/mob/M = A var/mob/M = A
if(client_check && !M.client) if(client_check && !M.client)
L = recursive_mob_check(A, L, recursion_limit - 1, client_check, sight_check, include_radio) L = recursive_mob_check(A, L, recursion_limit - 1, client_check, sight_check, include_radio)
continue continue
if(sight_check && !isInSight(A, O)) if(sight_check && !isInSight(A, O))
continue continue
L |= M L |= M
//world.log << "[recursion_limit] = [M] - [get_turf(M)] - ([M.x], [M.y], [M.z])" //world.log << "[recursion_limit] = [M] - [get_turf(M)] - ([M.x], [M.y], [M.z])"
else if(include_radio && istype(A, /obj/item/device/radio)) else if(include_radio && istype(A, /obj/item/device/radio))
if(sight_check && !isInSight(A, O)) if(sight_check && !isInSight(A, O))
continue continue
L |= A L |= A
L = recursive_mob_check(A, L, recursion_limit - 1, client_check, sight_check, include_radio) L = recursive_mob_check(A, L, recursion_limit - 1, client_check, sight_check, include_radio)
return L return L
// The old system would loop through lists for a total of 5000 per function call, in an empty server. // The old system would loop through lists for a total of 5000 per function call, in an empty server.
// This new system will loop at around 1000 in an empty server. // This new system will loop at around 1000 in an empty server.
/proc/get_mobs_in_view(var/R, var/atom/source) /proc/get_mobs_in_view(var/R, var/atom/source)
// Returns a list of mobs in range of R from source. Used in radio and say code. // Returns a list of mobs in range of R from source. Used in radio and say code.
var/turf/T = get_turf(source) var/turf/T = get_turf(source)
var/list/hear = list() var/list/hear = list()
if(!T) if(!T)
return hear return hear
var/list/range = hear(R, T) var/list/range = hear(R, T)
for(var/atom/movable/A in range) for(var/atom/movable/A in range)
if(ismob(A)) if(ismob(A))
var/mob/M = A var/mob/M = A
if(M.client) if(M.client)
hear += M hear += M
//world.log << "Start = [M] - [get_turf(M)] - ([M.x], [M.y], [M.z])" //world.log << "Start = [M] - [get_turf(M)] - ([M.x], [M.y], [M.z])"
else if(istype(A, /obj/item/device/radio)) else if(istype(A, /obj/item/device/radio))
hear += A hear += A
hear = recursive_mob_check(A, hear, 3, 1, 0, 1) hear = recursive_mob_check(A, hear, 3, 1, 0, 1)
return hear return hear
/proc/get_mobs_in_radio_ranges(var/list/obj/item/device/radio/radios) /proc/get_mobs_in_radio_ranges(var/list/obj/item/device/radio/radios)
//set background = 1 //set background = 1
. = list() . = list()
// Returns a list of mobs who can hear any of the radios given in @radios // Returns a list of mobs who can hear any of the radios given in @radios
var/list/speaker_coverage = list() var/list/speaker_coverage = list()
for(var/i = 1; i <= radios.len; i++) for(var/i = 1; i <= radios.len; i++)
var/obj/item/device/radio/R = radios[i] var/obj/item/device/radio/R = radios[i]
if(R) if(R)
var/turf/speaker = get_turf(R) var/turf/speaker = get_turf(R)
if(speaker) if(speaker)
for(var/turf/T in hear(R.canhear_range,speaker)) for(var/turf/T in hear(R.canhear_range,speaker))
speaker_coverage[T] = T speaker_coverage[T] = T
// Try to find all the players who can hear the message // Try to find all the players who can hear the message
for(var/i = 1; i <= player_list.len; i++) for(var/i = 1; i <= player_list.len; i++)
var/mob/M = player_list[i] var/mob/M = player_list[i]
if(M) if(M)
var/turf/ear = get_turf(M) var/turf/ear = get_turf(M)
if(ear) if(ear)
// Ghostship is magic: Ghosts can hear radio chatter from anywhere // Ghostship is magic: Ghosts can hear radio chatter from anywhere
if(speaker_coverage[ear] || (istype(M, /mob/dead/observer) && (M.client) && (M.client.prefs.toggles & CHAT_GHOSTRADIO))) if(speaker_coverage[ear] || (istype(M, /mob/dead/observer) && (M.client) && (M.client.prefs.toggles & CHAT_GHOSTRADIO)))
. |= M // Since we're already looping through mobs, why bother using |= ? This only slows things down. . |= M // Since we're already looping through mobs, why bother using |= ? This only slows things down.
return . return .
#define SIGN(X) ((X<0)?-1:1) #define SIGN(X) ((X<0)?-1:1)
proc proc
inLineOfSight(X1,Y1,X2,Y2,Z=1,PX1=16.5,PY1=16.5,PX2=16.5,PY2=16.5) inLineOfSight(X1,Y1,X2,Y2,Z=1,PX1=16.5,PY1=16.5,PX2=16.5,PY2=16.5)
var/turf/T var/turf/T
if(X1==X2) if(X1==X2)
if(Y1==Y2) if(Y1==Y2)
return 1 //Light cannot be blocked on same tile return 1 //Light cannot be blocked on same tile
else else
var/s = SIGN(Y2-Y1) var/s = SIGN(Y2-Y1)
Y1+=s Y1+=s
while(Y1!=Y2) while(Y1!=Y2)
T=locate(X1,Y1,Z) T=locate(X1,Y1,Z)
if(T.opacity) if(T.opacity)
return 0 return 0
Y1+=s Y1+=s
else else
var/m=(32*(Y2-Y1)+(PY2-PY1))/(32*(X2-X1)+(PX2-PX1)) var/m=(32*(Y2-Y1)+(PY2-PY1))/(32*(X2-X1)+(PX2-PX1))
var/b=(Y1+PY1/32-0.015625)-m*(X1+PX1/32-0.015625) //In tiles var/b=(Y1+PY1/32-0.015625)-m*(X1+PX1/32-0.015625) //In tiles
var/signX = SIGN(X2-X1) var/signX = SIGN(X2-X1)
var/signY = SIGN(Y2-Y1) var/signY = SIGN(Y2-Y1)
if(X1<X2) if(X1<X2)
b+=m b+=m
while(X1!=X2 || Y1!=Y2) while(X1!=X2 || Y1!=Y2)
if(round(m*X1+b-Y1)) if(round(m*X1+b-Y1))
Y1+=signY //Line exits tile vertically Y1+=signY //Line exits tile vertically
else else
X1+=signX //Line exits tile horizontally X1+=signX //Line exits tile horizontally
T=locate(X1,Y1,Z) T=locate(X1,Y1,Z)
if(T.opacity) if(T.opacity)
return 0 return 0
return 1 return 1
#undef SIGN #undef SIGN
proc/isInSight(var/atom/A, var/atom/B) proc/isInSight(var/atom/A, var/atom/B)
var/turf/Aturf = get_turf(A) var/turf/Aturf = get_turf(A)
var/turf/Bturf = get_turf(B) var/turf/Bturf = get_turf(B)
if(!Aturf || !Bturf) if(!Aturf || !Bturf)
return 0 return 0
if(inLineOfSight(Aturf.x,Aturf.y, Bturf.x,Bturf.y,Aturf.z)) if(inLineOfSight(Aturf.x,Aturf.y, Bturf.x,Bturf.y,Aturf.z))
return 1 return 1
else else
return 0 return 0
/proc/get_cardinal_step_away(atom/start, atom/finish) //returns the position of a step from start away from finish, in one of the cardinal directions /proc/get_cardinal_step_away(atom/start, atom/finish) //returns the position of a step from start away from finish, in one of the cardinal directions
//returns only NORTH, SOUTH, EAST, or WEST //returns only NORTH, SOUTH, EAST, or WEST
var/dx = finish.x - start.x var/dx = finish.x - start.x
var/dy = finish.y - start.y var/dy = finish.y - start.y
if(abs(dy) > abs (dx)) //slope is above 1:1 (move horizontally in a tie) if(abs(dy) > abs (dx)) //slope is above 1:1 (move horizontally in a tie)
if(dy > 0) if(dy > 0)
return get_step(start, SOUTH) return get_step(start, SOUTH)
else else
return get_step(start, NORTH) return get_step(start, NORTH)
else else
if(dx > 0) if(dx > 0)
return get_step(start, WEST) return get_step(start, WEST)
else else
return get_step(start, EAST) return get_step(start, EAST)
/proc/try_move_adjacent(atom/movable/AM) /proc/try_move_adjacent(atom/movable/AM)
var/turf/T = get_turf(AM) var/turf/T = get_turf(AM)
for(var/direction in cardinal) for(var/direction in cardinal)
if(AM.Move(get_step(T, direction))) if(AM.Move(get_step(T, direction)))
break break
/proc/get_mob_by_key(var/key) /proc/get_mob_by_key(var/key)
for(var/mob/M in mob_list) for(var/mob/M in mob_list)
if(M.ckey == lowertext(key)) if(M.ckey == lowertext(key))
return M return M
return null return null
//i think this is used soley by verb/give(), cael //i think this is used soley by verb/give(), cael
proc/check_can_reach(atom/user, atom/target) proc/check_can_reach(atom/user, atom/target)
if(!in_range(user,target)) if(!in_range(user,target))
return 0 return 0
return CanReachThrough(get_turf(user), get_turf(target), target) return CanReachThrough(get_turf(user), get_turf(target), target)
//dummy caching, used to speed up reach checks //dummy caching, used to speed up reach checks
var/list/DummyCache = list() var/list/DummyCache = list()
/proc/CanReachThrough(turf/srcturf, turf/targetturf, atom/target, var/pass_flags=0) /proc/CanReachThrough(turf/srcturf, turf/targetturf, atom/target, var/pass_flags=0)
var/obj/item/weapon/dummy/D = locate() in DummyCache var/obj/item/weapon/dummy/D = locate() in DummyCache
if(!D) if(!D)
D = new /obj/item/weapon/dummy( srcturf ) D = new /obj/item/weapon/dummy( srcturf )
else else
DummyCache.Remove(D) DummyCache.Remove(D)
D.loc = srcturf D.loc = srcturf
D.flags=initial(D.flags) D.flags=initial(D.flags)
D.pass_flags=initial(D.pass_flags) D.pass_flags=initial(D.pass_flags)
if(pass_flags&PASSTABLE) if(pass_flags&PASSTABLE)
D.flags |= TABLEPASS D.flags |= TABLEPASS
D.pass_flags |= PASSTABLE D.pass_flags |= PASSTABLE
if(targetturf.density && targetturf != get_turf(target)) if(targetturf.density && targetturf != get_turf(target))
return 0 return 0
//Now, check objects to block exit that are on the border //Now, check objects to block exit that are on the border
for(var/obj/border_obstacle in srcturf) for(var/obj/border_obstacle in srcturf)
if(border_obstacle.flags & ON_BORDER) if(border_obstacle.flags & ON_BORDER)
if(!border_obstacle.CheckExit(D, targetturf)) if(!border_obstacle.CheckExit(D, targetturf))
D.loc = null D.loc = null
DummyCache.Add(D) DummyCache.Add(D)
return 0 return 0
//Next, check objects to block entry that are on the border //Next, check objects to block entry that are on the border
for(var/obj/border_obstacle in targetturf) for(var/obj/border_obstacle in targetturf)
if((border_obstacle.flags & ON_BORDER) && (target != border_obstacle)) if((border_obstacle.flags & ON_BORDER) && (target != border_obstacle))
if(!border_obstacle.CanPass(D, srcturf, 1, 0)) if(!border_obstacle.CanPass(D, srcturf, 1, 0))
D.loc = null D.loc = null
DummyCache.Add(D) DummyCache.Add(D)
return 0 return 0
D.loc = null D.loc = null
DummyCache.Add(D) DummyCache.Add(D)
return 1 return 1
// Will return a list of active candidates. It increases the buffer 5 times until it finds a candidate which is active within the buffer. // Will return a list of active candidates. It increases the buffer 5 times until it finds a candidate which is active within the buffer.
/proc/get_active_candidates(var/buffer = 1) /proc/get_active_candidates(var/buffer = 1)
var/list/candidates = list() //List of candidate KEYS to assume control of the new larva ~Carn var/list/candidates = list() //List of candidate KEYS to assume control of the new larva ~Carn
var/i = 0 var/i = 0
while(candidates.len <= 0 && i < 5) while(candidates.len <= 0 && i < 5)
for(var/mob/dead/observer/G in player_list) for(var/mob/dead/observer/G in player_list)
if(((G.client.inactivity/10)/60) <= buffer + i) // the most active players are more likely to become an alien if(((G.client.inactivity/10)/60) <= buffer + i) // the most active players are more likely to become an alien
if(!(G.mind && G.mind.current && G.mind.current.stat != DEAD)) if(!(G.mind && G.mind.current && G.mind.current.stat != DEAD))
candidates += G.key candidates += G.key
i++ i++
return candidates return candidates
// Same as above but for alien candidates. // Same as above but for alien candidates.
/proc/get_alien_candidates() /proc/get_alien_candidates()
var/list/candidates = list() //List of candidate KEYS to assume control of the new larva ~Carn var/list/candidates = list() //List of candidate KEYS to assume control of the new larva ~Carn
var/i = 0 var/i = 0
while(candidates.len <= 0 && i < 5) while(candidates.len <= 0 && i < 5)
for(var/mob/dead/observer/G in player_list) for(var/mob/dead/observer/G in player_list)
if(G.client.prefs.be_special & BE_ALIEN) if(G.client.prefs.be_special & BE_ALIEN)
if(((G.client.inactivity/10)/60) <= ALIEN_SELECT_AFK_BUFFER + i) // the most active players are more likely to become an alien if(((G.client.inactivity/10)/60) <= ALIEN_SELECT_AFK_BUFFER + i) // the most active players are more likely to become an alien
if(!(G.mind && G.mind.current && G.mind.current.stat != DEAD)) if(!(G.mind && G.mind.current && G.mind.current.stat != DEAD))
candidates += G.key candidates += G.key
i++ i++
return candidates return candidates
/proc/get_candidates(be_special_flag=0) /proc/get_candidates(be_special_flag=0)
. = list() . = list()
for(var/mob/dead/observer/G in player_list) for(var/mob/dead/observer/G in player_list)
if(!(G.mind && G.mind.current && G.mind.current.stat != DEAD)) if(!(G.mind && G.mind.current && G.mind.current.stat != DEAD))
if(!G.client.is_afk() && (G.client.prefs.be_special & be_special_flag)) if(!G.client.is_afk() && (G.client.prefs.be_special & be_special_flag))
. += G.client . += G.client
/proc/ScreenText(obj/O, maptext="", screen_loc="CENTER-7,CENTER-7", maptext_height=480, maptext_width=480) /proc/ScreenText(obj/O, maptext="", screen_loc="CENTER-7,CENTER-7", maptext_height=480, maptext_width=480)
if(!isobj(O)) O = new /obj/screen/text() if(!isobj(O)) O = new /obj/screen/text()
O.maptext = maptext O.maptext = maptext
O.maptext_height = maptext_height O.maptext_height = maptext_height
O.maptext_width = maptext_width O.maptext_width = maptext_width
O.screen_loc = screen_loc O.screen_loc = screen_loc
return O return O
/proc/Show2Group4Delay(obj/O, list/group, delay=0) /proc/Show2Group4Delay(obj/O, list/group, delay=0)
if(!isobj(O)) return if(!isobj(O)) return
if(!group) group = clients if(!group) group = clients
for(var/client/C in group) for(var/client/C in group)
C.screen += O C.screen += O
if(delay) if(delay)
spawn(delay) spawn(delay)
for(var/client/C in group) for(var/client/C in group)
C.screen -= O C.screen -= O
/proc/flick_overlay(image/I, list/show_to, duration) /proc/flick_overlay(image/I, list/show_to, duration)
for(var/client/C in show_to) for(var/client/C in show_to)
C.images += I C.images += I
sleep(duration) sleep(duration)
for(var/client/C in show_to) for(var/client/C in show_to)
C.images -= I C.images -= I
/proc/get_active_player_count() /proc/get_active_player_count()
// Get active players who are playing in the round // Get active players who are playing in the round
var/active_players = 0 var/active_players = 0
for(var/i = 1; i <= player_list.len; i++) for(var/i = 1; i <= player_list.len; i++)
var/mob/M = player_list[i] var/mob/M = player_list[i]
if(M && M.client) if(M && M.client)
if(istype(M, /mob/new_player)) // exclude people in the lobby if(istype(M, /mob/new_player)) // exclude people in the lobby
continue continue
else if(isobserver(M)) // Ghosts are fine if they were playing once (didn't start as observers) else if(isobserver(M)) // Ghosts are fine if they were playing once (didn't start as observers)
var/mob/dead/observer/O = M var/mob/dead/observer/O = M
if(O.started_as_observer) // Exclude people who started as observers if(O.started_as_observer) // Exclude people who started as observers
continue continue
active_players++ active_players++
return active_players return active_players
/datum/projectile_data /datum/projectile_data
var/src_x var/src_x
var/src_y var/src_y
var/time var/time
var/distance var/distance
var/power_x var/power_x
var/power_y var/power_y
var/dest_x var/dest_x
var/dest_y var/dest_y
/datum/projectile_data/New(var/src_x, var/src_y, var/time, var/distance, \ /datum/projectile_data/New(var/src_x, var/src_y, var/time, var/distance, \
var/power_x, var/power_y, var/dest_x, var/dest_y) var/power_x, var/power_y, var/dest_x, var/dest_y)
src.src_x = src_x src.src_x = src_x
src.src_y = src_y src.src_y = src_y
src.time = time src.time = time
src.distance = distance src.distance = distance
src.power_x = power_x src.power_x = power_x
src.power_y = power_y src.power_y = power_y
src.dest_x = dest_x src.dest_x = dest_x
src.dest_y = dest_y src.dest_y = dest_y
/proc/projectile_trajectory(var/src_x, var/src_y, var/rotation, var/angle, var/power) /proc/projectile_trajectory(var/src_x, var/src_y, var/rotation, var/angle, var/power)
// returns the destination (Vx,y) that a projectile shot at [src_x], [src_y], with an angle of [angle], // returns the destination (Vx,y) that a projectile shot at [src_x], [src_y], with an angle of [angle],
// rotated at [rotation] and with the power of [power] // rotated at [rotation] and with the power of [power]
// Thanks to VistaPOWA for this function // Thanks to VistaPOWA for this function
var/power_x = power * cos(angle) var/power_x = power * cos(angle)
var/power_y = power * sin(angle) var/power_y = power * sin(angle)
var/time = 2* power_y / 10 //10 = g var/time = 2* power_y / 10 //10 = g
var/distance = time * power_x var/distance = time * power_x
var/dest_x = src_x + distance*sin(rotation); var/dest_x = src_x + distance*sin(rotation);
var/dest_y = src_y + distance*cos(rotation); var/dest_y = src_y + distance*cos(rotation);
return new /datum/projectile_data(src_x, src_y, time, distance, power_x, power_y, dest_x, dest_y) return new /datum/projectile_data(src_x, src_y, time, distance, power_x, power_y, dest_x, dest_y)
/proc/mobs_in_area(var/area/the_area, var/client_needed=0, var/moblist=mob_list) /proc/mobs_in_area(var/area/the_area, var/client_needed=0, var/moblist=mob_list)
var/list/mobs_found[0] var/list/mobs_found[0]
var/area/our_area = get_area_master(the_area) var/area/our_area = get_area_master(the_area)
for(var/mob/M in moblist) for(var/mob/M in moblist)
if(client_needed && !M.client) if(client_needed && !M.client)
continue continue
if(our_area != get_area_master(M)) if(our_area != get_area_master(M))
continue continue
mobs_found += M mobs_found += M
return mobs_found return mobs_found