Merge branch 'master' into shep-dev-multicam

This commit is contained in:
Rykka Stormheart
2020-06-01 14:23:03 -04:00
committed by GitHub
717 changed files with 13010 additions and 8457 deletions
+3 -12
View File
@@ -19,19 +19,10 @@
icon_state = pick(event_icon_states)
GLOB.overmap_event_handler.update_hazards(loc)
/obj/effect/overmap/event/Move()
var/turf/old_loc = loc
/obj/effect/overmap/event/Moved(atom/old_loc, direction, forced = FALSE)
. = ..()
if(.)
GLOB.overmap_event_handler.update_hazards(old_loc)
GLOB.overmap_event_handler.update_hazards(loc)
/obj/effect/overmap/event/forceMove(atom/destination)
var/old_loc = loc
. = ..()
if(.)
GLOB.overmap_event_handler.update_hazards(old_loc)
GLOB.overmap_event_handler.update_hazards(loc)
GLOB.overmap_event_handler.update_hazards(old_loc)
GLOB.overmap_event_handler.update_hazards(loc)
/obj/effect/overmap/event/Destroy()//takes a look at this one as well, make sure everything is A-OK
var/turf/T = loc
+2 -2
View File
@@ -160,11 +160,11 @@
if(W.is_crowbar())
if(opened)
to_chat(user, "<spawn class='notice'>You tightly shut \the [src] door.")
playsound(src.loc, 'sound/effects/locker_close.ogg', 25, 0, -3)
playsound(src, 'sound/effects/locker_close.ogg', 25, 0, -3)
opened = 0
else
to_chat(user, "<spawn class='notice'>You open up \the [src] door.")
playsound(src.loc, 'sound/effects/locker_open.ogg', 15, 1, -3)
playsound(src, 'sound/effects/locker_open.ogg', 15, 1, -3)
opened = 1
else if(istype(W,/obj/item/weapon/tank))
if(!opened)
+1 -1
View File
@@ -150,7 +150,7 @@
var/area/overmap/A = new
for (var/square in block(locate(1,1,global.using_map.overmap_z), locate(global.using_map.overmap_size,global.using_map.overmap_size,global.using_map.overmap_z)))
var/turf/T = square
if(T.x == global.using_map.overmap_size || T.y == global.using_map.overmap_size)
if(T.x == 1 || T.y == 1 || T.x == global.using_map.overmap_size || T.y == global.using_map.overmap_size)
T = T.ChangeTurf(/turf/unsimulated/map/edge)
else
T = T.ChangeTurf(/turf/unsimulated/map)
@@ -12,10 +12,6 @@
// Power
//
// This will have this machine have its area eat this much power next tick, and not afterwards. Do not use for continued power draw.
/obj/machinery/proc/use_power_oneoff(var/amount, var/chan = -1)
return use_power(amount, chan)
// Change one of the power consumption vars
/obj/machinery/proc/change_power_consumption(new_power_consumption, use_power_mode = USE_POWER_IDLE)
switch(use_power_mode)
@@ -95,7 +91,7 @@
/obj/machinery/computer/ship/attack_ghost(mob/user)
interface_interact(user)
// If you don't call parent in this proc, you must make all appropriate checks yourself.
// If you don't call parent in this proc, you must make all appropriate checks yourself.
// If you do, you must respect the return value.
/obj/machinery/computer/ship/attack_hand(mob/user)
if((. = ..()))
@@ -98,7 +98,7 @@
if (href_list["scan"])
var/obj/effect/overmap/O = locate(href_list["scan"])
if(istype(O) && !QDELETED(O) && (O in view(7,linked)))
playsound(loc, "sound/machines/dotprinter.ogg", 30, 1)
playsound(src, "sound/machines/dotprinter.ogg", 30, 1)
new/obj/item/weapon/paper/(get_turf(src), O.get_scan_data(user), "paper (Sensor Scan - [O])")
return TOPIC_HANDLED
@@ -58,6 +58,7 @@ somewhere on that shuttle. Subtypes of these can be then used to perform ship ov
/obj/machinery/computer/ship/proc/look(var/mob/user)
if(linked)
apply_visual(user)
user.reset_view(linked)
user.set_viewsize(world.view + extra_view)
GLOB.moved_event.register(user, src, /obj/machinery/computer/ship/proc/unlook)
@@ -150,7 +150,7 @@
/obj/machinery/atmospherics/unary/engine/proc/burn()
if(!is_on())
return 0
if(!check_fuel() || (0 < use_power_oneoff(charge_per_burn)) || check_blockage())
if(!check_fuel() || (use_power_oneoff(charge_per_burn) < charge_per_burn) || check_blockage())
audible_message(src,"<span class='warning'>[src] coughs once and goes silent!</span>")
update_use_power(USE_POWER_OFF)
return 0
@@ -159,7 +159,7 @@
if(!removed)
return 0
. = calculate_thrust(removed)
playsound(loc, 'sound/machines/thruster.ogg', 100 * thrust_limit, 0, world.view * 4, 0.1)
playsound(src, 'sound/machines/thruster.ogg', 100 * thrust_limit, 0, world.view * 4, 0.1)
if(network)
network.update = 1
+71 -25
View File
@@ -12,18 +12,21 @@
/obj/effect/overmap/visitable/ship
name = "generic ship"
desc = "Space faring vessel."
dir = NORTH
icon_state = "ship"
appearance_flags = TILE_BOUND|KEEP_TOGETHER|LONG_GLIDE
var/moving_state = "ship_moving"
var/vessel_mass = 10000 //tonnes, arbitrary number, affects acceleration provided by engines
var/vessel_size = SHIP_SIZE_LARGE //arbitrary number, affects how likely are we to evade meteors
var/max_speed = 1/(1 SECOND) //"speed of light" for the ship, in turfs/tick.
var/max_speed = 1/(1 SECOND) //"speed of light" for the ship, in turfs/decisecond.
var/min_speed = 1/(2 MINUTES) // Below this, we round speed to 0 to avoid math errors.
var/position_x // Pixel coordinates in the world
var/position_y // Pixel coordinates in the world.
var/list/speed = list(0,0) //speed in x,y direction
var/last_burn = 0 //worldtime when ship last acceleated
var/burn_delay = 1 SECOND //how often ship can do burns
var/list/last_movement = list(0,0) //worldtime when ship last moved in x,y direction
var/fore_dir = NORTH //what dir ship flies towards for purpose of moving stars effect procs
var/list/engines = list()
@@ -38,10 +41,11 @@
min_speed = round(min_speed, SHIP_MOVE_RESOLUTION)
max_speed = round(max_speed, SHIP_MOVE_RESOLUTION)
SSshuttles.ships += src
START_PROCESSING(SSobj, src)
position_x = ((loc.x - 1) * WORLD_ICON_SIZE) + (WORLD_ICON_SIZE/2) + pixel_x + 1
position_y = ((loc.y - 1) * WORLD_ICON_SIZE) + (WORLD_ICON_SIZE/2) + pixel_y + 1
/obj/effect/overmap/visitable/ship/Destroy()
STOP_PROCESSING(SSobj, src)
STOP_PROCESSING(SSprocessing, src)
SSshuttles.ships -= src
. = ..()
@@ -93,14 +97,22 @@
return (ATAN2(speed[2], speed[1]) + 360) % 360 // Yes ATAN2(y, x) is correct to get clockwise degrees
/obj/effect/overmap/visitable/ship/proc/adjust_speed(n_x, n_y)
var/old_still = is_still()
CHANGE_SPEED_BY(speed[1], n_x)
CHANGE_SPEED_BY(speed[2], n_y)
for(var/zz in map_z)
if(is_still())
toggle_move_stars(zz)
else
toggle_move_stars(zz, fore_dir)
update_icon()
var/still = is_still()
if(still == old_still)
return
else if(still)
STOP_PROCESSING(SSprocessing, src)
for(var/zz in map_z)
toggle_move_stars(zz)
else
START_PROCESSING(SSprocessing, src)
glide_size = WORLD_ICON_SIZE/max(DS2TICKS(SSprocessing.wait), 1) //Down to whatever decimal
for(var/zz in map_z)
toggle_move_stars(zz, fore_dir)
/obj/effect/overmap/visitable/ship/proc/get_brake_path()
if(!get_acceleration())
@@ -136,26 +148,55 @@
if(direction & SOUTH)
adjust_speed(0, -acceleration)
/obj/effect/overmap/visitable/ship/process()
if(!halted && !is_still())
var/list/deltas = list(0,0)
for(var/i=1, i<=2, i++)
if(MOVING(speed[i]) && world.time > last_movement[i] + 1/abs(speed[i]))
deltas[i] = SIGN(speed[i])
last_movement[i] = world.time
var/turf/newloc = locate(x + deltas[1], y + deltas[2], z)
if(newloc)
Move(newloc)
update_icon()
/obj/effect/overmap/visitable/ship/process(wait)
var/new_position_x = position_x + (speed[1] * WORLD_ICON_SIZE * wait)
var/new_position_y = position_y + (speed[2] * WORLD_ICON_SIZE * wait)
// For simplicity we assume that you can't travel more than one turf per tick. That would be hella-fast.
var/new_turf_x = CEILING(new_position_x / WORLD_ICON_SIZE, 1)
var/new_turf_y = CEILING(new_position_y / WORLD_ICON_SIZE, 1)
var/new_pixel_x = MODULUS(new_position_x, WORLD_ICON_SIZE) - (WORLD_ICON_SIZE/2) - 1
var/new_pixel_y = MODULUS(new_position_y, WORLD_ICON_SIZE) - (WORLD_ICON_SIZE/2) - 1
var/new_loc = locate(new_turf_x, new_turf_y, z)
position_x = new_position_x
position_y = new_position_y
if(new_loc != loc)
var/turf/old_loc = loc
Move(new_loc, NORTH, wait)
if(get_dist(old_loc, loc) > 1)
pixel_x = new_pixel_x
pixel_y = new_pixel_y
return
animate(src, pixel_x = new_pixel_x, pixel_y = new_pixel_y, time = wait, flags = ANIMATION_END_NOW)
// If we get moved, update our internal tracking to account for it
/obj/effect/overmap/visitable/ship/Moved(atom/old_loc, direction, forced = FALSE)
. = ..()
// If moving out of another sector start off centered in the turf.
if(!isturf(old_loc))
position_x = (WORLD_ICON_SIZE/2) + 1
position_y = (WORLD_ICON_SIZE/2) + 1
pixel_x = 0
pixel_y = 0
position_x = ((loc.x - 1) * WORLD_ICON_SIZE) + MODULUS(position_x, WORLD_ICON_SIZE)
position_y = ((loc.y - 1) * WORLD_ICON_SIZE) + MODULUS(position_y, WORLD_ICON_SIZE)
/obj/effect/overmap/visitable/ship/update_icon()
if(!is_still())
icon_state = moving_state
dir = get_heading()
transform = matrix().Turn(get_heading_degrees())
else
icon_state = initial(icon_state)
transform = null
..()
/obj/effect/overmap/visitable/ship/set_dir(new_dir)
return ..(NORTH) // NO! We always face north.
/obj/effect/overmap/visitable/ship/proc/burn()
for(var/datum/ship_engine/E in engines)
. += E.burn()
@@ -175,10 +216,15 @@
//deciseconds to next step
/obj/effect/overmap/visitable/ship/proc/ETA()
. = INFINITY
for(var/i=1, i<=2, i++)
if(MOVING(speed[i]))
. = min(last_movement[i] - world.time + 1/abs(speed[i]), .)
. = max(.,0)
if(MOVING(speed[1]))
var/offset = MODULUS(position_x, WORLD_ICON_SIZE)
var/dist_to_go = (speed[1] > 0) ? (WORLD_ICON_SIZE - offset) : offset
. = min(., (dist_to_go / abs(speed[1])) * (1/WORLD_ICON_SIZE))
if(MOVING(speed[2]))
var/offset = MODULUS(position_y, WORLD_ICON_SIZE)
var/dist_to_go = (speed[2] > 0) ? (WORLD_ICON_SIZE - offset) : offset
. = min(., (dist_to_go / abs(speed[2])) * (1/WORLD_ICON_SIZE))
. = max(., 0)
/obj/effect/overmap/visitable/ship/proc/halt()
adjust_speed(-speed[1], -speed[2])
+4 -1
View File
@@ -19,7 +19,10 @@ var/global/list/map_sectors = list()
var/turf/unsimulated/map/edge/wrap_buddy
/turf/unsimulated/map/edge/Initialize()
. = ..()
..()
return INITIALIZE_HINT_LATELOAD
/turf/unsimulated/map/edge/LateInitialize()
//This could be done by using the using_map.overmap_size much faster, HOWEVER, doing it programatically to 'find'
// the edges this way allows for 'sub overmaps' elsewhere and whatnot.
for(var/side in alldirs) //The order of this list is relevant: It should definitely break on finding a cardinal FIRST.