Adds overmap system and examples of it's usage.

Unticked, as it disables space edge transition.
This commit is contained in:
Chinsky
2014-06-28 14:07:21 +04:00
parent c6d6bdcb58
commit e7684dd6e9
9 changed files with 1223 additions and 32 deletions

View File

@@ -0,0 +1,74 @@
/obj/machinery/computer/helm
name = "helm control console"
icon_state = "id"
var/obj/effect/mapinfo/linked //connected overmap object
/obj/machinery/computer/helm/initialize()
linked = map_sectors["[z]"]
if (!linked)
testing("Helm console at level [z] was unable to find a corresponding overmap object.")
else
testing("Helm console at level [z] found a corresponding overmap object '[linked.name]'.")
/obj/machinery/computer/helm/relaymove(var/mob/user, direction)
if(linked)
linked.relaymove(user,direction)
return 1
/obj/machinery/computer/helm/check_eye(var/mob/user as mob)
if (get_dist(user, src) > 1 || user.blinded || !linked )
return null
user.reset_view(linked)
return 1
/obj/machinery/computer/helm/attack_hand(var/mob/user as mob)
if(!linked)
user << "<span class = 'warning'>Could not get navigation data!</span>"
return
if(stat & (NOPOWER|BROKEN))
user.unset_machine()
return
if(!isAI(user))
user.set_machine(src)
return
//Shuttle controller computer for shuttles going from ship to sectors
/obj/machinery/computer/shuttle_control/explore
name = "exploration shuttle console"
shuttle_tag = "Exploration"
req_access = list()
var/landing_type //area for shuttle ship-side
/obj/machinery/computer/shuttle_control/explore/initialize()
..()
shuttle_tag = "[shuttle_tag]-[z]"
if(!shuttle_controller.shuttles[shuttle_tag])
var/datum/shuttle/ferry/shuttle = new()
shuttle.warmup_time = 10
shuttle.area_station = locate(landing_type)
shuttle.area_offsite = shuttle.area_station
shuttle_controller.shuttles[shuttle_tag] = shuttle
shuttle_controller.process_shuttles += shuttle
testing("Exploration shuttle '[shuttle_tag]' at zlevel [z] successfully added.")
/obj/machinery/computer/shuttle_control/explore/proc/update_destination()
if(shuttle_controller.shuttles[shuttle_tag])
var/obj/effect/map/ship/S = map_sectors["[z]"]
if (!istype(S))
return
var/datum/shuttle/ferry/shuttle = shuttle_controller.shuttles[shuttle_tag]
if(S && S.current_sector)
var/obj/effect/map/M = S.current_sector
shuttle.area_offsite = M.shuttle_landing
testing("Shuttle controller now sends shuttle to [M]")
else
shuttle.area_offsite = shuttle.area_station
shuttle_controller.shuttles[shuttle_tag] = shuttle
/obj/machinery/computer/shuttle_control/explore/attack_hand(user as mob)
update_destination()
..()

View File

@@ -1,4 +1,20 @@
#define OVERMAP_ZLEVEL 1
//===================================================================================
//Hook for building overmap
//===================================================================================
var/global/list/map_sectors = list()
/hook/startup/proc/build_map()
accessable_z_levels = list() //no space travel with this system, at least not like this
testing("Building overmap...")
var/obj/effect/mapinfo/data
for(var/level in 1 to world.maxz)
data = locate("sector[level]")
if (data)
testing("Located sector \"[data.name]\" at [data.mapx],[data.mapy] corresponding to zlevel [level]")
map_sectors["[level]"] = new data.obj_type(data)
return 1
//===================================================================================
//Metaobject for storing information about sector this zlevel is representing.
//Should be placed only once on every zlevel.
@@ -9,6 +25,7 @@
icon_state = "x2"
invisibility = 101
var/obj_type //type of overmap object it spawns
var/landing_area //type of area used as inbound shuttle landing, null if no shuttle landing area
var/zlevel
var/mapx //coordinates on the
var/mapy //overmap zlevel
@@ -20,49 +37,57 @@
/obj/effect/mapinfo/sector
name = "generic sector"
desc = "Space sector with some stuff in it."
obj_type = /obj/effect/map/sector
/obj/effect/mapinfo/ship
name = "generic ship"
desc = "Space faring vessel."
obj_type = /obj/effect/map/ship
/obj/effect/mapinfo/ship/relaymove(var/mob/user, direction)
step(src,direction)
//===================================================================================
//Overmap object representing zlevel
//===================================================================================
/obj/effect/map
name = "map object"
icon = 'icons/obj/items.dmi'
icon_state = "sheet-plasteel"
var/map_z = 0
var/area/shuttle/shuttle_landing
/obj/effect/map/New(var/obj/effect/mapinfo/data)
name = data.name
desc = data.desc
map_z = data.zlevel
icon = data.icon
icon_state = data.icon_state
var/new_x = data.mapx
if (!new_x)
new_x = rand(1,world.maxx)
var/new_y = data.mapy
if (!new_y)
new_y = rand(1,world.maxy)
name = data.name
if (data.icon != 'icons/mob/screen1.dmi')
icon = data.icon
icon_state = data.icon_state
if(data.desc)
desc = data.desc
var/new_x = data.mapx ? data.mapx : rand(2,world.maxx-2)
var/new_y = data.mapy ? data.mapy : rand(2,world.maxy-2)
loc = locate(new_x, new_y, OVERMAP_ZLEVEL)
if(data.landing_area)
shuttle_landing = locate(data.landing_area)
/obj/effect/map/CanPass(atom/movable/A)
testing("[A] attempts to enter sector\"[name]\"")
if(prob(50))
testing("[A] was denied access to sector\"[name]\"")
return 0
return 1
/obj/effect/map/Crossed(atom/movable/A)
testing("[A] has entered sector\"[name]\"")
if (istype(A,/obj/effect/map/ship))
var/obj/effect/map/ship/S = A
S.current_sector = src
/obj/effect/map/Uncrossed(atom/movable/A)
testing("[A] has left sector\"[name]\"")
if (istype(A,/obj/effect/map/ship))
var/obj/effect/map/ship/S = A
S.current_sector = null
/obj/effect/map/sector
name = "generic sector"
@@ -72,22 +97,9 @@
/obj/effect/map/ship
name = "generic ship"
desc = "Space faring vessel."
icon_state = "sheet-sandstone"
density = 1
var/current_sector
/obj/effect/map/ship/relaymove(mob/user, direction)
step(src, direction)
//===================================================================================
//Hook for building overmap
//===================================================================================
var/global/list/map_sectors = list()
/hook/startup/proc/build_map()
testing("Building overmap...")
var/obj/effect/mapinfo/data
for(var/level in 1 to world.maxz)
data = locate("sector[level]")
if (data)
testing("Located sector \"[data.name]\" at [data.mapx],[data.mapy] corresponding to zlevel [level]")
map_sectors["[level]"] = new data.obj_type(data)
return 1
step(src,direction)