Revert "?"

This reverts commit c6b5bac0d8.
This commit is contained in:
EmeraldSundisk
2020-07-04 21:39:23 -07:00
parent c6b5bac0d8
commit 45a14f16d4
871 changed files with 96125 additions and 411183 deletions
@@ -0,0 +1,370 @@
#define SHUTTLE_CREATOR_MAX_SIZE CONFIG_GET(number/max_shuttle_size)
#define CUSTOM_SHUTTLE_LIMIT CONFIG_GET(number/max_shuttle_count)
#define CARDINAL_DIRECTIONS_X list(1, 0, -1, 0)
#define CARDINAL_DIRECTIONS_Y list(0, 1, 0, -1)
GLOBAL_VAR_INIT(custom_shuttle_count, 0) //The amount of custom shuttles created to prevent creating hundreds
GLOBAL_LIST_EMPTY(custom_shuttle_machines) //Machines that require updating (Heaters, engines)
//============ Shuttle Creator Object ============
/obj/item/shuttle_creator
name = "Rapid Shuttle Designator"
icon = 'icons/obj/tools.dmi'
icon_state = "rsd"
lefthand_file = 'icons/mob/inhands/equipment/tools_lefthand.dmi'
righthand_file = 'icons/mob/inhands/equipment/tools_righthand.dmi'
desc = "A device used to define the area required for custom ships. Uses bluespace crystals to create bluespace-capable ships."
density = FALSE
anchored = FALSE
flags_1 = CONDUCT_1
item_flags = NOBLUDGEON
force = 0
throwforce = 8
throw_speed = 3
throw_range = 5
w_class = WEIGHT_CLASS_NORMAL
req_access_txt = "11"
armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 100, "acid" = 50)
resistance_flags = FIRE_PROOF
var/ready = TRUE
//pre-designation
var/override_max_shuttles = FALSE
var/obj/machinery/computer/camera_advanced/shuttle_creator/internal_shuttle_creator
//During designation
var/overwritten_area = /area/space
var/list/loggedTurfs = list()
var/loggedOldArea
var/recorded_shuttle_area
var/datum/shuttle_creator_overlay_holder/overlay_holder
//After designation
var/linkedShuttleId
/obj/item/shuttle_creator/Initialize()
. = ..()
internal_shuttle_creator = new()
internal_shuttle_creator.owner_rsd = src
overlay_holder = new()
/obj/item/shuttle_creator/Destroy()
. = ..()
if(internal_shuttle_creator)
internal_shuttle_creator.owner_rsd = null
QDEL_NULL(internal_shuttle_creator)
if(overlay_holder)
QDEL_NULL(overlay_holder)
/obj/item/shuttle_creator/attack_self(mob/user)
..()
if(linkedShuttleId)
return
if(GLOB.custom_shuttle_count > CUSTOM_SHUTTLE_LIMIT && !override_max_shuttles)
to_chat(user, "<span class='warning'>Too many shuttles have been created.</span>")
message_admins("[ADMIN_FLW(user)] attempted to create a shuttle, however [CUSTOM_SHUTTLE_LIMIT] have already been created.")
return
if(!internal_shuttle_creator)
return
overlay_holder.add_client(user.client)
internal_shuttle_creator.attack_hand(user)
/obj/item/shuttle_creator/afterattack(atom/target, mob/user, proximity_flag)
. = ..()
if(!ready)
to_chat(user, "<span class='warning'>You need to define a shuttle area first.</span>")
return
if(!proximity_flag)
return
if(istype(target, /obj/machinery/computer/custom_shuttle))
if(!linkedShuttleId)
to_chat(user, "<span class='warning'>Error, no defined shuttle linked to device</span>")
return
var/obj/machinery/computer/custom_shuttle/console = target
console.linkShuttle(linkedShuttleId)
to_chat(user, "<span class='notice'>Console linked successfully!</span>")
return
else if(istype(target, /obj/machinery/computer/camera_advanced/shuttle_docker/custom))
if(!linkedShuttleId)
to_chat(user, "<span class='warning'>Error, no defined shuttle linked to device</span>")
return
var/obj/machinery/computer/camera_advanced/shuttle_docker/custom/console = target
console.linkShuttle(linkedShuttleId)
to_chat(user, "<span class='notice'>Console linked successfully!</span>")
return
to_chat(user, "<span class='warning'>The [src] bleeps. Select an airlock to create a docking port, or a valid machine to link.</span>")
return
//=========== shuttle designation actions ============
/obj/item/shuttle_creator/proc/calculate_bounds(obj/docking_port/mobile/port)
if(!port || !istype(port, /obj/docking_port/mobile))
return FALSE
//Heights is the distance away from the port
//width is the distance perpendicular to the port
var/minX = INFINITY
var/maxX = 0
var/minY = INFINITY
var/maxY = 0
for(var/turf/T in loggedTurfs)
minX = min(T.x, minX)
maxX = max(T.x, maxX)
minY = min(T.y, minY)
maxY = max(T.y, maxY)
//Make sure shuttle was actually found.
if(maxX == INFINITY || maxY == INFINITY)
return FALSE
minX--
minY--
var/width = maxX - minX
var/height = maxY - minY
var/offset_x = port.x - minX
var/offset_y = port.y - minY
switch(port.dir) //Source: code/datums/shuttles.dm line 77 (14/03/2020) :)
if(NORTH)
port.width = width
port.height = height
port.dwidth = offset_x - 1
port.dheight = offset_y - 1
if(EAST)
port.width = height
port.height = width
port.dwidth = height - offset_y
port.dheight = offset_x - 1
if(SOUTH)
port.width = width
port.height = height
port.dwidth = width - offset_x
port.dheight = height - offset_y
if(WEST)
port.width = height
port.height = width
port.dwidth = offset_y - 1
port.dheight = width - offset_x
return TRUE
//Go through all the all_turfs and check which direction doesn't have the shuttle
/obj/item/shuttle_creator/proc/getNonShuttleDirection(turf/targetTurf)
var/position = null
if(!(get_offset_target_turf(targetTurf, 0, 1) in loggedTurfs))
if(position != null)
return null
position = NORTH
if(!(get_offset_target_turf(targetTurf, 0, -1) in loggedTurfs))
if(position != null)
return null
position = SOUTH
if(!(get_offset_target_turf(targetTurf, 1, 0) in loggedTurfs))
if(position != null)
return null
position = EAST
if(!(get_offset_target_turf(targetTurf, -1, 0) in loggedTurfs))
if(position != null)
return null
position = WEST
return position
/obj/item/shuttle_creator/proc/invertDir(var/input_dir)
if(input_dir == NORTH)
return SOUTH
else if(input_dir == SOUTH)
return NORTH
else if(input_dir == EAST)
return WEST
else if(input_dir == WEST)
return EAST
return null
/obj/item/shuttle_creator/proc/shuttle_create_docking_port(atom/target, mob/user)
if(loggedTurfs.len == 0 || !recorded_shuttle_area)
to_chat(user, "<span class='warning'>Invalid shuttle, restarting bluespace systems...</span>")
return FALSE
var/datum/map_template/shuttle/new_shuttle = new /datum/map_template/shuttle()
var/obj/docking_port/mobile/port = new /obj/docking_port/mobile(get_turf(target))
var/obj/docking_port/stationary/stationary_port = new /obj/docking_port/stationary(get_turf(target))
port.callTime = 50
port.dir = 1 //Point away from space.
port.id = "custom_[GLOB.custom_shuttle_count]"
linkedShuttleId = port.id
port.ignitionTime = 25
port.name = "Custom Shuttle"
port.port_direction = 2
port.preferred_direction = 4
port.area_type = recorded_shuttle_area
stationary_port.area_type = overwritten_area
var/portDirection = getNonShuttleDirection(get_turf(port))
var/invertedDir = invertDir(portDirection)
if(!portDirection || !invertedDir)
to_chat(usr, "<span class='warning'>Shuttle creation aborted, docking airlock must be on an external wall. Please select a new airlock.</span>")
port.Destroy()
stationary_port.Destroy()
linkedShuttleId = null
return FALSE
port.dir = invertedDir
port.port_direction = portDirection
if(!calculate_bounds(port))
to_chat(usr, "<span class='warning'>Bluespace calculations failed, please select a new airlock.</span>")
port.Destroy()
stationary_port.Destroy()
linkedShuttleId = null
return FALSE
port.shuttle_areas = list()
//var/list/all_turfs = port.return_ordered_turfs(port.x, port.y, port.z, port.dir)
var/list/all_turfs = loggedTurfs
for(var/i in 1 to all_turfs.len)
var/turf/curT = all_turfs[i]
var/area/cur_area = curT.loc
//Add the area to the shuttle <3
if(istype(cur_area, recorded_shuttle_area))
if(istype(curT, /turf/open/space))
continue
if(length(curT.baseturfs) < 2)
continue
//Add the shuttle base shit to the shuttle
curT.baseturfs.Insert(3, /turf/baseturf_skipover/shuttle)
port.shuttle_areas[cur_area] = TRUE
port.linkup(new_shuttle, stationary_port)
port.movement_force = list("KNOCKDOWN" = 0, "THROW" = 0)
port.initiate_docking(stationary_port)
port.mode = SHUTTLE_IDLE
port.timer = 0
port.register()
icon_state = "rsd_used"
//Clear highlights
overlay_holder.clear_highlights()
GLOB.custom_shuttle_count ++
message_admins("[ADMIN_LOOKUPFLW(user)] created a new shuttle with a [src] at [ADMIN_VERBOSEJMP(user)] ([GLOB.custom_shuttle_count] custom shuttles, limit is [CUSTOM_SHUTTLE_LIMIT])")
log_game("[key_name(user)] created a new shuttle with a [src] at [AREACOORD(user)] ([GLOB.custom_shuttle_count] custom shuttles, limit is [CUSTOM_SHUTTLE_LIMIT])")
return TRUE
/obj/item/shuttle_creator/proc/create_shuttle_area(mob/user)
//Check to see if the user can make a new area to prevent spamming
if(user)
if(user.create_area_cooldown >= world.time)
to_chat(user, "<span class='warning'>Smoke vents from the [src], maybe you should let it cooldown before using it again.</span>")
return FALSE
user.create_area_cooldown = world.time + 10
if(!loggedTurfs)
return FALSE
if(!check_area(loggedTurfs, FALSE)) //Makes sure nothing (Shuttles) has moved into the area during creation
return FALSE
//Create the new area
var/area/shuttle/custom/powered/newS
var/area/oldA = loggedOldArea
var/str = stripped_input(user, "Shuttle Name:", "Blueprint Editing", "", MAX_NAME_LEN)
if(!str || !length(str))
return FALSE
if(length(str) > 50)
to_chat(user, "<span class='warning'>The provided ship name is too long, blares the [src]</span>")
return FALSE
newS = new /area/shuttle/custom/powered()
newS.setup(str)
newS.set_dynamic_lighting()
//Shuttles always have gravity
newS.has_gravity = TRUE
newS.requires_power = TRUE
//Record the area for use when creating the docking port
recorded_shuttle_area = newS
for(var/i in 1 to loggedTurfs.len)
var/turf/turf_holder = loggedTurfs[i]
var/area/old_area = turf_holder.loc
newS.contents += turf_holder
turf_holder.change_area(old_area, newS)
newS.reg_in_areas_in_z()
var/list/firedoors = oldA.firedoors
for(var/door in firedoors)
var/obj/machinery/door/firedoor/FD = door
FD.CalculateAffectingAreas()
return TRUE
//Checks an area to ensure that the turfs provided are valid to be made into a shuttle
/obj/item/shuttle_creator/proc/check_area(list/turfs, addingTurfs = TRUE)
if(!turfs)
to_chat(usr, "<span class='warning'>Shuttles must be created in an airtight space, ensure that the shuttle is airtight, including corners.</span>")
return FALSE
if(turfs.len + (addingTurfs ? loggedTurfs.len : 0) > SHUTTLE_CREATOR_MAX_SIZE)
to_chat(usr, "<span class='warning'>The [src]'s internal cooling system wizzes violently and a message appears on the screen, \"Caution, this device can only handle the creation of shuttles up to [SHUTTLE_CREATOR_MAX_SIZE] units in size. Please reduce your shuttle by [turfs.len-SHUTTLE_CREATOR_MAX_SIZE]. Sorry for the inconvinience\"</span>")
return FALSE
//Check to see if it's a valid shuttle
for(var/i in 1 to turfs.len)
var/area/place = get_area(turfs[i])
//If any of the turfs are on station / not in space, a shuttle cannot be forced there
if(!place)
to_chat(usr, "<span class='warning'>You can't seem to overpower the bluespace harmonics in this location, try somewhere else.</span>")
return FALSE
if(istype(place, /area/space))
overwritten_area = /area/space
else if(istype(place, /area/lavaland/surface/outdoors))
overwritten_area = /area/lavaland/surface/outdoors
else
to_chat(usr, "<span class='warning'>Caution, shuttle must not use any material connected to the station. Your shuttle is currenly overlapping with [place.name]</span>")
return FALSE
//Finally, check to see if the area is actually attached
if(!LAZYLEN(loggedTurfs))
return TRUE
for(var/turf/T in turfs)
if(turf_connected_to_saved_turfs(T))
return TRUE
CHECK_TICK
to_chat(usr, "<span class='warning'>Caution, new areas of the shuttle must be connected to the other areas of the shuttle.</span>")
return FALSE
/obj/item/shuttle_creator/proc/turf_connected_to_saved_turfs(turf/T)
for(var/i in 1 to 4)
var/turf/adjacentT = get_offset_target_turf(T, CARDINAL_DIRECTIONS_X[i], CARDINAL_DIRECTIONS_Y[i])
if(adjacentT in loggedTurfs)
return TRUE
return FALSE
/obj/item/shuttle_creator/proc/turf_in_list(turf/T)
return loggedTurfs.Find(T)
/obj/item/shuttle_creator/proc/add_single_turf(turf/T)
if(!check_area(list(T)))
return FALSE
loggedTurfs |= T
loggedOldArea = get_area(T)
overlay_holder.highlight_turf(T)
/obj/item/shuttle_creator/proc/add_saved_area(mob/user)
var/static/area_or_turf_fail_types = typecacheof(list(
/turf/open/space,
/area/shuttle
))
//Detect the turfs connected in the curerrent enclosed area
var/list/turfs = detect_room(get_turf(user), area_or_turf_fail_types)
if(!check_area(turfs))
return FALSE
loggedOldArea = get_area(get_turf(user))
loggedTurfs |= turfs
overlay_holder.highlight_area(turfs)
//TODO READD THIS SHIT: icon_state = "rsd_used"
to_chat(user, "<span class='notice'>You add the area into the buffer of the [src], you made add more areas or select an airlock to act as a docking port to complete the shuttle.</span>")
return turfs
/obj/item/shuttle_creator/proc/remove_single_turf(turf/T)
if(!turf_in_list(T))
return
loggedTurfs -= T
loggedOldArea = get_area(T)
overlay_holder.unhighlight_turf(T)
/obj/item/shuttle_creator/proc/reset_saved_area()
overlay_holder.clear_highlights()
loggedTurfs.Cut()
to_chat(usr, "<span class='notice'>You reset the area buffer on the [src].</span>")
#undef CARDINAL_DIRECTIONS_X
#undef CARDINAL_DIRECTIONS_Y
@@ -0,0 +1,101 @@
//============ Actions ============
/datum/action/innate/shuttle_creator
icon_icon = 'icons/mob/actions/actions_shuttle.dmi'
var/mob/living/C
var/mob/camera/aiEye/remote/shuttle_creation/remote_eye
var/obj/item/shuttle_creator/shuttle_creator
/datum/action/innate/shuttle_creator/Activate()
if(!target)
return TRUE
C = owner
remote_eye = C.remote_control
var/obj/machinery/computer/camera_advanced/shuttle_creator/internal_console = target
shuttle_creator = internal_console.owner_rsd
//Add an area
/datum/action/innate/shuttle_creator/designate_area
name = "Designate Room"
button_icon_state = "designate_area"
/datum/action/innate/shuttle_creator/designate_area/Activate()
if(..())
return
shuttle_creator.add_saved_area(remote_eye)
//Add a single turf
/datum/action/innate/shuttle_creator/designate_turf
name = "Designate Turf"
button_icon_state = "designate_turf"
/datum/action/innate/shuttle_creator/designate_turf/Activate()
if(..())
return
var/turf/T = get_turf(remote_eye)
if(istype(T, /turf/open/space))
var/connectors_exist = FALSE
for(var/obj/structure/lattice/lattice in T)
connectors_exist = TRUE
break
if(!connectors_exist)
to_chat(usr, "<span class='warning'>This turf requires support, build some catwalks or lattices.</span>")
return
if(!shuttle_creator.check_area(list(T)))
return
if(shuttle_creator.turf_in_list(T))
return
shuttle_creator.add_single_turf(T)
//Clear a single entire area
/datum/action/innate/shuttle_creator/clear_turf
name = "Clear Turf"
button_icon_state = "clear_turf"
/datum/action/innate/shuttle_creator/clear_turf/Activate()
if(..())
return
shuttle_creator.remove_single_turf(get_turf(remote_eye))
//Clear the entire area
/datum/action/innate/shuttle_creator/reset
name = "Reset Buffer"
button_icon_state = "clear_area"
/datum/action/innate/shuttle_creator/reset/Activate()
if(..())
return
shuttle_creator.reset_saved_area()
//Finish the shuttle
/datum/action/innate/shuttle_creator/airlock
name = "Select Docking Airlock"
button_icon_state = "select_airlock"
/datum/action/innate/shuttle_creator/airlock/Activate()
if(..())
return
var/turf/T = get_turf(remote_eye)
for(var/obj/machinery/door/airlock/A in T)
if(get_area(A) != shuttle_creator.loggedOldArea)
to_chat(C, "<span class='warning'>Caution, airlock must be on the shuttle to function as a dock.</span>")
return
if(shuttle_creator.linkedShuttleId)
return
if(GLOB.custom_shuttle_count > CUSTOM_SHUTTLE_LIMIT)
to_chat(C, "<span class='warning'>Shuttle limit reached, sorry.</span>")
return
if(shuttle_creator.loggedTurfs.len > SHUTTLE_CREATOR_MAX_SIZE)
to_chat(C, "<span class='warning'>This shuttle is too large!</span>")
return
if(!shuttle_creator.getNonShuttleDirection(T))
to_chat(C, "<span class='warning'>Docking port must be on an external wall, with only 1 side exposed to space.</span>")
return
if(!shuttle_creator.create_shuttle_area(C))
return
if(shuttle_creator.shuttle_create_docking_port(A, C))
to_chat(C, "<span class='notice'>Shuttle created!</span>")
//Remove eye control
var/obj/machinery/computer/camera_advanced/shuttle_creator/internal_console = target
internal_console.remove_eye_control()
qdel(internal_console)
return
@@ -0,0 +1,93 @@
//============The internal camera console used for designating the area=============
/obj/machinery/computer/camera_advanced/shuttle_creator
name = "internal shuttle creator console"
desc = "You should not have access to this, please report this as a bug"
networks = list()
var/obj/item/shuttle_creator/owner_rsd
var/datum/action/innate/shuttle_creator/designate_area/area_action = new
var/datum/action/innate/shuttle_creator/designate_turf/turf_action = new
var/datum/action/innate/shuttle_creator/clear_turf/clear_turf_action = new
var/datum/action/innate/shuttle_creator/reset/reset_action = new
var/datum/action/innate/shuttle_creator/airlock/airlock_action = new
/obj/machinery/computer/camera_advanced/shuttle_creator/check_eye(mob/user)
if(user.eye_blind || user.incapacitated())
user.unset_machine()
/obj/machinery/computer/camera_advanced/shuttle_creator/CreateEye()
eyeobj = new /mob/camera/aiEye/remote/shuttle_creation(get_turf(owner_rsd))
eyeobj.origin = src
eyeobj.use_static = USE_STATIC_NONE
/obj/machinery/computer/camera_advanced/shuttle_creator/is_operational()
return TRUE
/obj/machinery/computer/camera_advanced/shuttle_creator/can_interact(mob/user)
if(!isliving(user))
return FALSE
var/mob/living/L = user
if(L.incapacitated())
return FALSE
return TRUE
/obj/machinery/computer/camera_advanced/shuttle_creator/GrantActions(mob/living/user)
..(user)
eyeobj.invisibility = SEE_INVISIBLE_LIVING
if(area_action)
area_action.target = src
area_action.Grant(user)
actions += area_action
if(turf_action)
turf_action.target = src
turf_action.Grant(user)
actions += turf_action
if(clear_turf_action)
clear_turf_action.target = src
clear_turf_action.Grant(user)
actions += clear_turf_action
if(reset_action)
reset_action.target = src
reset_action.Grant(user)
actions += reset_action
if(airlock_action)
airlock_action.target = src
airlock_action.Grant(user)
actions += airlock_action
/obj/machinery/computer/camera_advanced/shuttle_creator/remove_eye_control(mob/living/user)
. = ..()
owner_rsd.overlay_holder.remove_client()
eyeobj.invisibility = INVISIBILITY_MAXIMUM
if(user?.client)
user.client.images -= eyeobj.user_image
/obj/machinery/computer/camera_advanced/shuttle_creator/attack_hand(mob/user)
if(!is_operational()) //you cant use broken machine you chumbis
return
if(current_user)
to_chat(user, "The console is already in use!")
return
var/mob/living/L = user
if(!can_use(user))
return
if(!eyeobj)
CreateEye()
if(!eyeobj.eye_initialized)
var/camera_location = get_turf(owner_rsd)
if(camera_location)
eyeobj.eye_initialized = TRUE
give_eye_control(L)
eyeobj.setLoc(camera_location)
var/mob/camera/aiEye/remote/shuttle_creation/shuttle_eye = eyeobj
shuttle_eye.source_turf = get_turf(user)
else
user.unset_machine()
else
var/camera_location = get_turf(owner_rsd)
var/mob/camera/aiEye/remote/shuttle_creation/eye = eyeobj
give_eye_control(L)
if(camera_location)
eye.source_turf = camera_location
eyeobj.setLoc(camera_location)
else
eyeobj.setLoc(eyeobj.loc)
@@ -0,0 +1,54 @@
//===============Camera Eye================
/mob/camera/aiEye/remote/shuttle_creation
name = "shuttle holo-drone"
icon = 'icons/obj/mining.dmi'
icon_state = "construction_drone"
visible_icon = FALSE
acceleration = 0
var/turf/source_turf
var/max_range = 12
/mob/camera/aiEye/remote/shuttle_creation/Initialize()
. = ..()
setLoc(get_turf(source_turf))
/mob/camera/aiEye/remote/shuttle_creation/update_remote_sight(mob/living/user)
user.sight = BLIND|SEE_TURFS
user.lighting_alpha = LIGHTING_PLANE_ALPHA_INVISIBLE
user.sync_lighting_plane_alpha()
return TRUE
/mob/camera/aiEye/remote/shuttle_creation/relaymove(mob/user, direct)
dir = direct //This camera eye is visible as a drone, and needs to keep the dir updated
var/initial = initial(sprint)
var/max_sprint = 50
if(cooldown && cooldown < world.timeofday) // 3 seconds
sprint = initial
for(var/i = 0; i < max(sprint, initial); i += 20)
var/turf/step = get_turf(get_step(src, direct))
if(step && can_move_to(step))
setLoc(step)
cooldown = world.timeofday + 5
if(acceleration)
sprint = min(sprint + 0.5, max_sprint)
else
sprint = initial
/mob/camera/aiEye/remote/shuttle_creation/proc/can_move_to(var/turf/T)
var/origin_x = source_turf.x
var/origin_y = source_turf.y
var/change_X = abs(origin_x - T.x)
var/change_Y = abs(origin_y - T.y)
return (change_X < max_range && change_Y < max_range)
/mob/camera/aiEye/remote/shuttle_creation/setLoc(T)
..()
if(eye_user?.client)
eye_user.client.images -= user_image
var/image/I = image(icon, loc, icon_state, FLY_LAYER, dir)
I.plane = MASSIVE_OBJ_LAYER
user_image = I
eye_user.client.images += user_image
@@ -0,0 +1,53 @@
/*
* Manages the overlays for the shuttle creator drone.
*/
/datum/shuttle_creator_overlay_holder
var/client/holder
var/list/images = list()
var/list/turfs = list()
/datum/shuttle_creator_overlay_holder/proc/add_client(client/C)
holder = C
holder.images += images
/datum/shuttle_creator_overlay_holder/proc/remove_client()
if(holder)
holder.images -= images
holder = null
/datum/shuttle_creator_overlay_holder/proc/clear_highlights()
if(holder)
holder.images -= images
images.Cut()
turfs.Cut()
/datum/shuttle_creator_overlay_holder/proc/create_hightlight(turf/T)
if(T in turfs)
return
var/image/I = image('icons/turf/overlays.dmi', T, "greenOverlay")
I.plane = ABOVE_LIGHTING_PLANE
images += I
holder.images += I
turfs += T
/datum/shuttle_creator_overlay_holder/proc/remove_hightlight(turf/T)
if(!(T in turfs))
return
turfs -= T
holder.images -= images
for(var/image/I in images)
if(get_turf(I) != T)
continue
images -= I
holder.images += images
/datum/shuttle_creator_overlay_holder/proc/highlight_area(list/turfs)
for(var/turf/T in turfs)
highlight_turf(T)
/datum/shuttle_creator_overlay_holder/proc/highlight_turf(turf/T)
create_hightlight(T)
/datum/shuttle_creator_overlay_holder/proc/unhighlight_turf(turf/T)
remove_hightlight(T)
@@ -0,0 +1,39 @@
/obj/item/shuttle_route_optimisation
name = "Route Optimisation Upgrade"
desc = "Used on a custom shuttle control console to calculate more efficient routes."
icon = 'icons/obj/module.dmi'
icon_state = "shuttledisk"
force = 0
throwforce = 0
throw_speed = 1
throw_range = 7
density = FALSE
anchored = FALSE
item_flags = NOBLUDGEON
var/upgrade_amount = 0.8
/obj/item/shuttle_route_optimisation/hyperlane
name = "Bluespace Hyperlane Calculator"
desc = "Used on a custom shuttle control console to allow for the following of bluespace hyperlanes, increasing the efficiency of the shuttle."
icon_state = "shuttledisk_better"
upgrade_amount = 0.6
/obj/item/shuttle_route_optimisation/void
name = "Voidspace Route Calculator"
desc = "Used on a custom shuttle control console to allow it to navigate into voidspace, making the routes almost instant."
icon_state = "shuttledisk_void"
upgrade_amount = 0.2
/obj/item/shuttle_route_optimisation/attack_obj(obj/O, mob/living/user)
. = ..()
if(!istype(O, /obj/machinery/computer))
return
if(!istype(O, /obj/machinery/computer/custom_shuttle))
to_chat(user, "<span class='warning'>This upgrade only works on a custom shuttle flight console.</span>")
return
if (!user.transferItemToLoc(src, get_turf(O)))
return
var/obj/machinery/computer/custom_shuttle/link_comp = O
link_comp.distance_multiplier = clamp(link_comp.distance_multiplier, 0, upgrade_amount)
playsound(src, 'sound/machines/terminal_insert_disc.ogg', 50, 0)
to_chat(usr, "<span class='notice'>You insert the disk into the flight computer, allowing for routes to be [upgrade_amount]x the original distance.</span>")