Put shuttles in their proper place, split out secure crates

This commit is contained in:
Bjorn Neergaard
2016-02-07 01:18:56 -06:00
parent 1449640867
commit ede93b63a6
9 changed files with 380 additions and 382 deletions
+58
View File
@@ -0,0 +1,58 @@
/obj/docking_port/mobile/assault_pod
name = "assault pod"
id = "steel_rain"
dwidth = 3
width = 7
height = 7
/obj/docking_port/mobile/assault_pod/request()
if(z == initial(src.z)) //No launching pods that have already launched
return ..()
/obj/docking_port/mobile/assault_pod/dock(obj/docking_port/stationary/S1)
..()
if(!istype(S1, /obj/docking_port/stationary/transit))
playsound(get_turf(src.loc), 'sound/effects/Explosion1.ogg',50,1)
/obj/item/device/assault_pod
name = "Assault Pod Targetting Device"
icon_state = "gangtool-red"
item_state = "walkietalkie"
desc = "Used to select a landing zone for assault pods."
var/shuttle_id = "steel_rain"
var/dwidth = 3
var/dheight = 0
var/width = 7
var/height = 7
var/lz_dir = 1
/obj/item/device/assault_pod/attack_self(mob/living/user)
var/target_area
target_area = input("Area to land", "Select a Landing Zone", target_area) in teleportlocs
var/area/picked_area = teleportlocs[target_area]
if(!src || qdeleted(src))
return
var/turf/T = safepick(get_area_turfs(picked_area))
if(!T)
return
var/obj/docking_port/stationary/landing_zone = new /obj/docking_port/stationary(T)
landing_zone.id = "assault_pod(\ref[src])"
landing_zone.name = "Landing Zone"
landing_zone.dwidth = dwidth
landing_zone.dheight = dheight
landing_zone.width = width
landing_zone.height = height
landing_zone.dir = lz_dir
for(var/obj/machinery/computer/shuttle/S in machines)
if(S.shuttleId == shuttle_id)
S.possible_destinations = "[landing_zone.id]"
user << "Landing zone set."
qdel(src)
+264 -1
View File
@@ -73,4 +73,267 @@
log_game("[key_name(user)] has emagged the emergency shuttle in ([x],[y],[z]) [time] seconds before launch.")
minor_announce("The emergency shuttle will launch in 10 seconds", "SYSTEM ERROR:",null,1)
SSshuttle.emergency.setTimer(100)
emagged = 1
emagged = 1
/obj/docking_port/mobile/emergency
name = "emergency shuttle"
id = "emergency"
dwidth = 9
width = 22
height = 11
dir = 4
travelDir = -90
roundstart_move = "emergency_away"
var/sound_played = 0 //If the launch sound has been sent to all players on the shuttle itself
/obj/docking_port/mobile/emergency/New()
..()
SSshuttle.emergency = src
/obj/docking_port/mobile/emergency/timeLeft(divisor)
if(divisor <= 0)
divisor = 10
if(!timer)
return round(SSshuttle.emergencyCallTime/divisor, 1)
var/dtime = world.time - timer
switch(mode)
if(SHUTTLE_ESCAPE)
dtime = max(SSshuttle.emergencyEscapeTime - dtime, 0)
if(SHUTTLE_DOCKED)
dtime = max(SSshuttle.emergencyDockTime - dtime, 0)
else
dtime = max(SSshuttle.emergencyCallTime - dtime, 0)
return round(dtime/divisor, 1)
/obj/docking_port/mobile/emergency/request(obj/docking_port/stationary/S, coefficient=1, area/signalOrigin, reason, redAlert)
SSshuttle.emergencyCallTime = initial(SSshuttle.emergencyCallTime) * coefficient
switch(mode)
if(SHUTTLE_RECALL)
mode = SHUTTLE_CALL
timer = world.time - timeLeft(1)
if(SHUTTLE_IDLE)
mode = SHUTTLE_CALL
timer = world.time
if(SHUTTLE_CALL)
if(world.time < timer) //this is just failsafe
timer = world.time
else
return
if(prob(70))
SSshuttle.emergencyLastCallLoc = signalOrigin
else
SSshuttle.emergencyLastCallLoc = null
priority_announce("The emergency shuttle has been called. [redAlert ? "Red Alert state confirmed: Dispatching priority shuttle. " : "" ]It will arrive in [timeLeft(600)] minutes.[reason][SSshuttle.emergencyLastCallLoc ? "\n\nCall signal traced. Results can be viewed on any communications console." : "" ]", null, 'sound/AI/shuttlecalled.ogg', "Priority")
/obj/docking_port/mobile/emergency/cancel(area/signalOrigin)
if(mode != SHUTTLE_CALL)
return
timer = world.time - timeLeft(1)
mode = SHUTTLE_RECALL
if(prob(70))
SSshuttle.emergencyLastCallLoc = signalOrigin
else
SSshuttle.emergencyLastCallLoc = null
priority_announce("The emergency shuttle has been recalled.[SSshuttle.emergencyLastCallLoc ? " Recall signal traced. Results can be viewed on any communications console." : "" ]", null, 'sound/AI/shuttlerecalled.ogg', "Priority")
/*
/obj/docking_port/mobile/emergency/findTransitDock()
. = SSshuttle.getDock("emergency_transit")
if(.)
return .
return ..()
*/
/obj/docking_port/mobile/emergency/check()
if(!timer)
return
var/time_left = timeLeft(1)
switch(mode)
if(SHUTTLE_RECALL)
if(time_left <= 0)
mode = SHUTTLE_IDLE
timer = 0
if(SHUTTLE_CALL)
if(time_left <= 0)
//move emergency shuttle to station
if(dock(SSshuttle.getDock("emergency_home")))
setTimer(20)
return
mode = SHUTTLE_DOCKED
timer = world.time
send2irc("Server", "The Emergency Shuttle has docked with the station.")
priority_announce("The Emergency Shuttle has docked with the station. You have [timeLeft(600)] minutes to board the Emergency Shuttle.", null, 'sound/AI/shuttledock.ogg', "Priority")
//Gangs only have one attempt left if the shuttle has docked with the station to prevent suffering from dominator delays
for(var/datum/gang/G in ticker.mode.gangs)
if(isnum(G.dom_timer))
G.dom_attempts = 0
else
G.dom_attempts = min(1,G.dom_attempts)
if(SHUTTLE_DOCKED)
if(time_left <= 50 && !sound_played) //4 seconds left:REV UP THOSE ENGINES BOYS. - should sync up with the launch
sound_played = 1 //Only rev them up once.
for(var/area/shuttle/escape/E in world)
E << 'sound/effects/hyperspace_begin.ogg'
if(time_left <= 0 && SSshuttle.emergencyNoEscape)
priority_announce("Hostile environment detected. Departure has been postponed indefinitely pending conflict resolution.", null, 'sound/misc/notice1.ogg', "Priority")
sound_played = 0 //Since we didn't launch, we will need to rev up the engines again next pass.
mode = SHUTTLE_STRANDED
if(time_left <= 0 && !SSshuttle.emergencyNoEscape)
//move each escape pod (or applicable spaceship) to its corresponding transit dock
for(var/A in SSshuttle.mobile)
var/obj/docking_port/mobile/M = A
if(M.launch_status == UNLAUNCHED) //Pods will not launch from the mine/planet, and other ships won't launch unless we tell them to.
M.launch_status = ENDGAME_LAUNCHED
M.enterTransit()
//now move the actual emergency shuttle to its transit dock
for(var/area/shuttle/escape/E in world)
E << 'sound/effects/hyperspace_progress.ogg'
enterTransit()
mode = SHUTTLE_ESCAPE
launch_status = ENDGAME_LAUNCHED
timer = world.time
priority_announce("The Emergency Shuttle has left the station. Estimate [timeLeft(600)] minutes until the shuttle docks at Central Command.", null, null, "Priority")
if(SHUTTLE_ESCAPE)
if(time_left <= 0)
//move each escape pod to its corresponding escape dock
for(var/A in SSshuttle.mobile)
var/obj/docking_port/mobile/M = A
if(M.launch_status == ENDGAME_LAUNCHED)
if(istype(M, /obj/docking_port/mobile/pod))
M.dock(SSshuttle.getDock("[M.id]_away")) //Escape pods dock at centcomm
else
continue //Mapping a new docking point for each ship mappers could potentially want docking with centcomm would take up lots of space, just let them keep flying off into the sunset for their greentext
//now move the actual emergency shuttle to centcomm
for(var/area/shuttle/escape/E in world)
E << 'sound/effects/hyperspace_end.ogg'
dock(SSshuttle.getDock("emergency_away"))
mode = SHUTTLE_ENDGAME
timer = 0
open_dock()
/obj/docking_port/mobile/emergency/proc/open_dock()
for(var/obj/machinery/door/poddoor/shuttledock/D in airlocks)
var/turf/T = get_step(D, D.checkdir)
if(!istype(T,/turf/space))
spawn(0)
D.open()
/obj/docking_port/mobile/pod
name = "escape pod"
id = "pod"
dwidth = 1
width = 3
height = 4
launch_status = UNLAUNCHED
/obj/docking_port/mobile/pod/request()
if((security_level == SEC_LEVEL_RED || security_level == SEC_LEVEL_DELTA) && launch_status == UNLAUNCHED)
launch_status = EARLY_LAUNCHED
return ..()
/obj/docking_port/mobile/pod/New()
if(id == "pod")
WARNING("[type] id has not been changed from the default. Use the id convention \"pod1\" \"pod2\" etc.")
..()
/obj/docking_port/mobile/pod/cancel()
return
/obj/machinery/computer/shuttle/pod
name = "pod control computer"
admin_controlled = 1
shuttleId = "pod"
possible_destinations = "pod_asteroid"
icon = 'icons/obj/terminals.dmi'
icon_state = "dorm_available"
density = 0
/obj/machinery/computer/shuttle/pod/update_icon()
return
/obj/docking_port/stationary/random
name = "escape pod"
id = "pod"
dwidth = 1
width = 3
height = 4
var/target_area = /area/mine/unexplored
/obj/docking_port/stationary/random/initialize()
..()
var/list/turfs = get_area_turfs(target_area)
var/turf/T = pick(turfs)
src.loc = T
//Pod suits/pickaxes
/obj/item/clothing/head/helmet/space/orange
name = "emergency space helmet"
icon_state = "syndicate-helm-orange"
item_state = "syndicate-helm-orange"
/obj/item/clothing/suit/space/orange
name = "emergency space suit"
icon_state = "syndicate-orange"
item_state = "syndicate-orange"
slowdown = 3
/obj/item/weapon/pickaxe/emergency
name = "emergency disembarkation tool"
desc = "For extracting yourself from rough landings."
/obj/item/weapon/storage/pod
name = "emergency space suits"
desc = "A wall mounted safe containing space suits. Will only open in emergencies."
anchored = 1
density = 0
icon = 'icons/obj/storage.dmi'
icon_state = "safe"
/obj/item/weapon/storage/pod/New()
..()
new /obj/item/clothing/head/helmet/space/orange(src)
new /obj/item/clothing/head/helmet/space/orange(src)
new /obj/item/clothing/suit/space/orange(src)
new /obj/item/clothing/suit/space/orange(src)
new /obj/item/clothing/mask/gas(src)
new /obj/item/clothing/mask/gas(src)
new /obj/item/weapon/tank/internals/oxygen/red(src)
new /obj/item/weapon/tank/internals/oxygen/red(src)
new /obj/item/weapon/pickaxe/emergency(src)
new /obj/item/weapon/pickaxe/emergency(src)
new /obj/item/weapon/survivalcapsule(src)
/obj/item/weapon/storage/pod/attackby(obj/item/weapon/W, mob/user, params)
return
/obj/item/weapon/storage/pod/MouseDrop(over_object, src_location, over_location)
if(security_level == SEC_LEVEL_RED || security_level == SEC_LEVEL_DELTA)
return ..()
else
usr << "The storage unit will only unlock during a Red or Delta security alert."
/obj/item/weapon/storage/pod/attack_hand(mob/user)
return
#undef UNLAUNCHED
#undef LAUNCHED
#undef EARLY_LAUNCHED
+223
View File
@@ -0,0 +1,223 @@
/obj/docking_port/mobile/supply
name = "supply shuttle"
id = "supply"
callTime = 1200
dir = 8
travelDir = 90
width = 12
dwidth = 5
height = 7
roundstart_move = "supply_away"
var/list/blacklist = list(
/mob/living,
/obj/effect/blob,
/obj/effect/rune,
/obj/effect/spider/spiderling,
/obj/item/weapon/disk/nuclear,
/obj/machinery/nuclearbomb,
/obj/item/device/radio/beacon,
/obj/machinery/the_singularitygen,
/obj/singularity,
/obj/machinery/teleport/station,
/obj/machinery/teleport/hub,
/obj/machinery/telepad,
/obj/machinery/clonepod
)
/obj/docking_port/mobile/supply/New()
..()
SSshuttle.supply = src
/obj/docking_port/mobile/supply/canMove()
if(z == ZLEVEL_STATION)
return check_blacklist(areaInstance)
return ..()
/obj/docking_port/mobile/supply/proc/check_blacklist(atom/A)
if(is_type_in_list(A, blacklist))
return 1
for(var/thing in A)
if(.(thing))
return 1
/obj/docking_port/mobile/supply/request()
if(mode != SHUTTLE_IDLE)
return 2
return ..()
/obj/docking_port/mobile/supply/dock()
if(getDockedId() == "supply_away") // Buy when we leave home.
buy()
if(..()) // Fly/enter transit.
return
if(getDockedId() == "supply_away") // Sell when we get home
sell()
/obj/docking_port/mobile/supply/proc/buy()
if(!SSshuttle.shoppinglist.len)
return
var/list/emptyTurfs = list()
for(var/turf/simulated/floor/T in areaInstance)
if(T.density || T.contents.len)
continue
emptyTurfs += T
for(var/datum/supply_order/SO in SSshuttle.shoppinglist)
if(!SO.object)
continue
if(SO.object.cost > SSshuttle.points)
continue
var/errors = 0
if(prob(5))
errors |= MANIFEST_ERROR_COUNT
if(prob(5))
errors |= MANIFEST_ERROR_NAME
if(prob(5))
errors |= MANIFEST_ERROR_ITEM
var/turf/T = pick_n_take(emptyTurfs)
SO.createObject(T, errors)
SSshuttle.points -= SO.object.cost
SSshuttle.shoppinglist -= SO
/obj/docking_port/mobile/supply/proc/sell()
var/crates = 0
var/plasma = 0
var/intel = 0
var/msg = ""
var/pointsEarned = 0
for(var/atom/movable/AM in areaInstance)
if(AM.anchored)
continue
SSshuttle.sold_atoms += " [AM.name]"
if(istype(AM, /obj/structure/closet/crate) || istype(AM, /obj/structure/closet/critter))
crates++
SSshuttle.sold_atoms += ":"
if(!AM.contents.len)
SSshuttle.sold_atoms += " (empty)"
else
var/slip_found = FALSE
for(var/atom/movable/thing in AM)
SSshuttle.sold_atoms += " [thing.name]"
if(!slip_found && istype(thing, /obj/item/weapon/paper/manifest))
var/obj/item/weapon/paper/manifest/slip = thing
if(slip.stamped && slip.stamped.len)
slip_found = TRUE
var/denied = FALSE
for(var/stamp in slip.stamped)
if(stamp == /obj/item/weapon/stamp/denied)
denied = TRUE
break
if(slip.erroneous && denied) // Caught a mistake by Centcom.
pointsEarned = slip.points - SSshuttle.points_per_crate
SSshuttle.points += pointsEarned // Give a full refund (minus the crate).
msg += "[pointsEarned]: Station correctly denied package [slip.ordernumber]: "
if(slip.erroneous & MANIFEST_ERROR_NAME)
msg += "Destination station incorrect. "
else if(slip.erroneous & MANIFEST_ERROR_COUNT)
msg += "Packages incorrectly counted. "
else if(slip.erroneous & MANIFEST_ERROR_ITEM)
msg += "Package incomplete. "
msg += "Points refunded."
else if(!slip.erroneous && !denied) // Approved a slip correctly.
pointsEarned = SSshuttle.points_per_slip
SSshuttle.points += pointsEarned
msg += "+[pointsEarned]: Package [slip.ordernumber] accorded."
else if(slip.erroneous) // You done goofed.
pointsEarned = -SSshuttle.points_per_slip
SSshuttle.points += pointsEarned
msg += "[pointsEarned]: Station erroneously approved package [slip.ordernumber]: "
if(slip.erroneous & MANIFEST_ERROR_NAME)
msg += "Destination station incorrect."
else if(slip.erroneous & MANIFEST_ERROR_COUNT)
msg += "Packages incorrectly counted."
else if(slip.erroneous & MANIFEST_ERROR_ITEM)
msg += "We found unshipped items on our dock."
msg += " Be more vigilant."
else
pointsEarned = round(SSshuttle.points_per_crate - slip.points)
SSshuttle.points += pointsEarned
msg += "[pointsEarned]: Station erroneously denied package [slip.ordernumber]."
// Sell plasma
if(istype(thing, /obj/item/stack/sheet/mineral/plasma))
var/obj/item/stack/sheet/mineral/plasma/P = thing
plasma += P.amount
// Sell syndicate intel
if(istype(thing, /obj/item/documents/syndicate))
intel++
// Sell tech levels
if(istype(thing, /obj/item/weapon/disk/tech_disk))
var/obj/item/weapon/disk/tech_disk/disk = thing
if(!disk.stored)
continue
var/datum/tech/tech = disk.stored
var/cost = tech.getCost(SSshuttle.techLevels[tech.id])
if(cost)
SSshuttle.techLevels[tech.id] = tech.level
SSshuttle.points += cost
msg += "+[cost]: Data: [tech.name]."
// Sell max reliablity designs
if(istype(thing, /obj/item/weapon/disk/design_disk))
var/obj/item/weapon/disk/design_disk/disk = thing
if(!disk.blueprint)
continue
var/datum/design/design = disk.blueprint
if(design.id in SSshuttle.researchDesigns)
continue
if(initial(design.reliability) < 100 && design.reliability >= 100)
// Maxed out reliability designs only.
SSshuttle.points += SSshuttle.points_per_design
SSshuttle.researchDesigns += design.id
msg += "+[SSshuttle.points_per_design]: Design: [design.name]."
// Sell exotic plants
if(istype(thing, /obj/item/seeds))
var/obj/item/seeds/S = thing
if(S.rarity == 0) // Mundane species
msg += "+0: We don't need samples of mundane species \"[capitalize(S.species)]\"."
else if(SSshuttle.discoveredPlants[S.type]) // This species has already been sent to CentComm
var/potDiff = S.potency - SSshuttle.discoveredPlants[S.type] // Compare it to the previous best
if(potDiff > 0) // This sample is better
SSshuttle.discoveredPlants[S.type] = S.potency
msg += "+[potDiff]: New sample of \"[capitalize(S.species)]\" is superior. Good work."
SSshuttle.points += potDiff
else // This sample is worthless
msg += "+0: New sample of \"[capitalize(S.species)]\" is not more potent than existing sample ([SSshuttle.discoveredPlants[S.type]] potency)."
else // This is a new discovery!
SSshuttle.discoveredPlants[S.type] = S.potency
msg += "[S.rarity]: New species discovered: \"[capitalize(S.species)]\". Excellent work."
SSshuttle.points += S.rarity // That's right, no bonus for potency. Send a crappy sample first to "show improvement" later
qdel(thing)
qdel(AM)
SSshuttle.sold_atoms += "."
if(plasma > 0)
pointsEarned = round(plasma * SSshuttle.points_per_plasma)
msg += "[pointsEarned]: Received [plasma] unit(s) of exotic material."
SSshuttle.points += pointsEarned
if(intel > 0)
pointsEarned = round(intel * SSshuttle.points_per_intel)
msg += "[pointsEarned]: Received [intel] article(s) of enemy intelligence."
SSshuttle.points += pointsEarned
if(crates > 0)
pointsEarned = round(crates * SSshuttle.points_per_crate)
msg += "+[pointsEarned]: Received [crates] crate(s)."
SSshuttle.points += pointsEarned
SSshuttle.centcom_message = msg