Traders Event (#4016)

* Traders Event

* lien notes

* Fixes indent

* Gets rid of things Fox doesn't like.

* how did that get deleted

* Get rid of things maintainers don't like

* Adds some crates to the shuttle, and a recall console to the base.

* EVENT_LEVEL_MAJOR, and make it weight 0 (out of rotation)

* line nutes
This commit is contained in:
monster860
2016-06-11 12:47:20 -04:00
committed by Fox McCloud
parent ec292c5240
commit 42639bcab5
13 changed files with 383 additions and 51 deletions
+1
View File
@@ -184,6 +184,7 @@ var/list/event_last_fired = list()
new /datum/event_meta(EVENT_LEVEL_MAJOR, "Meteor Wave", /datum/event/meteor_wave, 0, list(ASSIGNMENT_ENGINEER = 3), 1),
new /datum/event_meta(EVENT_LEVEL_MAJOR, "Abductor Visit", /datum/event/abductor, 80, is_one_shot = 1),
new /datum/event_meta/alien(EVENT_LEVEL_MAJOR, "Alien Infestation", /datum/event/alien_infestation, 0, list(ASSIGNMENT_SECURITY = 30), 1),
new /datum/event_meta(EVENT_LEVEL_MAJOR, "Traders", /datum/event/traders, 0, is_one_shot = 1),
)
+87
View File
@@ -0,0 +1,87 @@
var/global/list/unused_trade_stations = list("sol")
// Traders event.
// Heavily copy-pasted from "heist" gamemode.
/datum/event/traders
var/success_spawn = 0
var/station = null
var/spawn_count = 3
var/list/trader_objectives = list()
/datum/event/traders/setup()
if(unused_trade_stations.len)
station = pick_n_take(unused_trade_stations)
/datum/event/traders/start()
if(!station) // If there are no unused stations, just no.
return
var/list/spawnlocs = list()
for(var/obj/effect/landmark/landmark in landmarks_list)
if(landmark.name == "traderstart_[station]")
spawnlocs += get_turf(landmark)
if(!spawnlocs.len)
return
trader_objectives = forge_trader_objectives()
spawn()
var/list/candidates = pollCandidates("Do you want to play as a trader?", ROLE_TRADER, 1)
var/index = 1
while(spawn_count > 0 && candidates.len > 0)
if(index > spawnlocs.len)
index = 1
var/turf/picked_loc = spawnlocs[index]
index++
var/mob/C = pick_n_take(candidates)
if(C)
respawnable_list -= C.client
var/mob/living/carbon/human/M = create_trader(picked_loc)
M.ckey = C.ckey
M.mind.objectives += trader_objectives
greet_trader(M)
success_spawn = 1
if(!success_spawn)
unused_trade_stations += station // Return the station to the list of usable stations.
/datum/event/traders/proc/create_trader(var/turf/picked_loc)
var/mob/living/carbon/human/M
switch(station)
if("sol")
M = new /mob/living/carbon/human(picked_loc)
M.equip_to_slot_or_del(new /obj/item/device/radio/headset(M), slot_l_ear)
M.equip_to_slot_or_del(new /obj/item/clothing/under/rank/cargotech(M), slot_w_uniform)
M.equip_to_slot_or_del(new /obj/item/clothing/shoes/black(M), slot_shoes)
M.equip_to_slot_or_del(new /obj/item/weapon/storage/backpack/industrial(M), slot_back)
var/obj/item/weapon/card/id/supply/W = new(M)
W.name = "[M.real_name]'s ID Card (Sol Trader)"
W.assignment = "Sol Trader"
W.registered_name = M.real_name
W.access = list(access_trade_sol, access_maint_tunnels, access_external_airlocks)
M.equip_to_slot_or_del(W, slot_wear_id)
return M
/datum/event/traders/proc/greet_trader(var/mob/living/carbon/human/M)
to_chat(M, "<span class='boldnotice'>You are a trader!</span>")
to_chat(M, "<span class='notice'>You are currently docked at [get_area(M)].</span>")
to_chat(M, "<span class='notice'>You are about to trade with NSS Cyberiad.</span>")
to_chat(M, "<span class='notice'>Negotiate an agreement, and request docking.</span>")
spawn(25)
show_objectives(M.mind)
/datum/event/traders/proc/forge_trader_objectives()
var/i = 1
var/max_objectives = pick(2, 2, 2, 2, 3, 3, 3, 4)
var/list/objs = list()
var/list/goals = list("stockparts")
while(i<= max_objectives)
var/goal = pick(goals)
var/datum/objective/trade/O
if(goal == "stockparts")
O = new /datum/objective/trade/stock(station)
O.choose_target()
objs += O
i++
return objs
+43 -1
View File
@@ -135,6 +135,8 @@
var/turf_type = /turf/space
var/area_type = /area/space
var/lock_shuttle_doors = 0
/obj/docking_port/stationary/register()
if(!shuttle_master)
@@ -165,6 +167,8 @@
/obj/docking_port/stationary/transit
name = "In Transit"
turf_type = /turf/space/transit
lock_shuttle_doors = 1
/obj/docking_port/stationary/transit/register()
if(!..())
@@ -452,7 +456,7 @@
dir = S1.dir
unlockPortDoors(S1)
if(S1 && S1.id != "[id]_transit")
if(S1 && !S1.lock_shuttle_doors)
for(var/obj/machinery/door/airlock/A in door_unlock_list)
spawn(-1)
A.unlock()
@@ -615,6 +619,7 @@
var/possible_destinations = ""
var/admin_controlled
var/max_connect_range = 7
var/docking_request = 0
/obj/machinery/computer/shuttle/New(location, obj/item/weapon/circuitboard/shuttle/C)
..()
@@ -667,6 +672,8 @@
if(admin_controlled)
dat += "Authorized personnel only<br>"
dat += "<A href='?src=\ref[src];request=1]'>Request Authorization</A><br>"
if(docking_request)
dat += "<A href='?src=\ref[src];request=1]'>Request docking at NSS Cyberiad</A><br>"
dat += "<a href='?src=\ref[user];mach_close=computer'>Close</a>"
var/datum/browser/popup = new(user, "computer", M ? M.name : "shuttle", 300, 200)
@@ -768,6 +775,41 @@
shuttleId = "admin"
possible_destinations = "admin_home;admin_away"
var/global/trade_dock_timelimit = 0
var/global/trade_dockrequest_timelimit = 0
/obj/machinery/computer/shuttle/trade
name = "Freighter Console"
docking_request = 1
var/possible_destinations_dock
var/possible_destinations_nodock
var/docking_request_message = "A trading ship has requested docking aboard the NSS Cyberiad for trading. This request can be accepted or denied using a communications console."
/obj/machinery/computer/shuttle/trade/attack_hand(mob/user)
if(world.time < trade_dock_timelimit)
possible_destinations = possible_destinations_dock
else
possible_destinations = possible_destinations_nodock
docking_request = (world.time > trade_dockrequest_timelimit && world.time > trade_dock_timelimit)
..(user)
/obj/machinery/computer/shuttle/trade/Topic(href, href_list)
..()
if(href_list["request"])
if(world.time < trade_dockrequest_timelimit || world.time < trade_dock_timelimit)
return
to_chat(usr, "<span class='notice'>Request sent.</span>")
command_announcement.Announce(docking_request_message, "Docking Request")
trade_dockrequest_timelimit = world.time + 1200 // They have 2 minutes to approve the request.
/obj/machinery/computer/shuttle/trade/sol
req_access = list(access_trade_sol)
possible_destinations_dock = "trade_sol_base;trade_sol_offstation;trade_dock"
possible_destinations_nodock = "trade_sol_base;trade_sol_offstation"
shuttleId = "trade_sol"
docking_request_message = "A trading ship of Sol origin has requested docking aboard the NSS Cyberiad for trading. This request can be accepted or denied using a communications console."
#undef DOCKING_PORT_HIGHLIGHT