proving to the world i'm retarded one commit line at a time
This commit is contained in:
226
code/modules/antagonists/traitor/equipment/contractor.dm
Normal file
226
code/modules/antagonists/traitor/equipment/contractor.dm
Normal file
@@ -0,0 +1,226 @@
|
||||
// Support unit gets it's own very basic antag datum for admin logging.
|
||||
/datum/antagonist/traitor/contractor_support
|
||||
name = "Contractor Support Unit"
|
||||
antag_moodlet = /datum/mood_event/focused
|
||||
show_in_roundend = FALSE /// We're already adding them in to the contractor's roundend.
|
||||
give_objectives = TRUE /// We give them their own custom objective.
|
||||
show_in_antagpanel = FALSE /// Not a proper/full antag.
|
||||
should_equip = FALSE /// Don't give them an uplink.
|
||||
var/datum/team/contractor_team/contractor_team
|
||||
|
||||
/datum/team/contractor_team // Team for storing both the contractor and their support unit - only really for the HUD and admin logging.
|
||||
show_roundend_report = FALSE
|
||||
|
||||
/datum/antagonist/traitor/contractor_support/forge_traitor_objectives()
|
||||
var/datum/objective/generic_objective = new
|
||||
generic_objective.name = "Follow Contractor's Orders"
|
||||
generic_objective.explanation_text = "Follow your orders. Assist agents in this mission area."
|
||||
generic_objective.completed = TRUE
|
||||
add_objective(generic_objective)
|
||||
|
||||
/datum/contractor_hub
|
||||
var/contract_rep = 0
|
||||
var/list/hub_items = list()
|
||||
var/list/purchased_items = list()
|
||||
var/static/list/contractor_items = typecacheof(/datum/contractor_item/, TRUE)
|
||||
var/datum/syndicate_contract/current_contract
|
||||
var/list/datum/syndicate_contract/assigned_contracts = list()
|
||||
var/list/assigned_targets = list() // used as a blacklist to make sure we're not assigning targets already assigned
|
||||
var/contract_TC_payed_out = 0 // Keeping track for roundend reporting
|
||||
var/contract_TC_to_redeem = 0 // Used internally and roundend reporting - what TC we have available to cashout.
|
||||
|
||||
/datum/contractor_hub/proc/create_hub_items()
|
||||
for(var/path in contractor_items)
|
||||
var/datum/contractor_item/contractor_item = new path
|
||||
hub_items.Add(contractor_item)
|
||||
|
||||
/datum/contractor_hub/proc/create_contracts(datum/mind/owner) // 6 initial contracts
|
||||
var/list/to_generate = list(
|
||||
CONTRACT_PAYOUT_LARGE,
|
||||
CONTRACT_PAYOUT_MEDIUM,
|
||||
CONTRACT_PAYOUT_SMALL,
|
||||
CONTRACT_PAYOUT_SMALL,
|
||||
CONTRACT_PAYOUT_SMALL,
|
||||
CONTRACT_PAYOUT_SMALL
|
||||
)
|
||||
var/lowest_TC_threshold = 30 // We don't want the sum of all the payouts to be under this amount
|
||||
var/total = 0
|
||||
var/lowest_paying_sum = 0
|
||||
var/datum/syndicate_contract/lowest_paying_contract
|
||||
|
||||
to_generate = shuffle(to_generate) // Randomise order, so we don't have contracts always in payout order.
|
||||
var/start_index = 1 // Support contract generation happening multiple times
|
||||
if(assigned_contracts.len != 0)
|
||||
start_index = assigned_contracts.len + 1
|
||||
|
||||
for(var/i = 1; i <= to_generate.len; i++) // Generate contracts, and find the lowest paying.
|
||||
var/datum/syndicate_contract/contract_to_add = new(owner, assigned_targets, to_generate[i])
|
||||
var/contract_payout_total = contract_to_add.contract.payout + contract_to_add.contract.payout_bonus
|
||||
assigned_targets.Add(contract_to_add.contract.target)
|
||||
if(!lowest_paying_contract || (contract_payout_total < lowest_paying_sum))
|
||||
lowest_paying_sum = contract_payout_total
|
||||
lowest_paying_contract = contract_to_add
|
||||
total += contract_payout_total
|
||||
contract_to_add.id = start_index
|
||||
assigned_contracts.Add(contract_to_add)
|
||||
start_index++
|
||||
if(total < lowest_TC_threshold) // If the threshold for TC payouts isn't reached, boost the lowest paying contract
|
||||
lowest_paying_contract.contract.payout_bonus += (lowest_TC_threshold - total)
|
||||
|
||||
/datum/contractor_item
|
||||
var/name // Name of item
|
||||
var/desc // description of item
|
||||
var/item // item path, no item path means the purchase needs it's own handle_purchase()
|
||||
var/item_icon = "fa-broadcast-tower" // fontawesome icon to use inside the hub - https://fontawesome.com/icons/
|
||||
var/limited = -1 // Any number above 0 for how many times it can be bought in a round for a single traitor. -1 is unlimited.
|
||||
var/cost // Cost of the item in contract rep.
|
||||
|
||||
/datum/contractor_item/contract_reroll
|
||||
name = "Contract Reroll"
|
||||
desc = "Request a reroll of your current contract list. Will generate a new target, payment, and dropoff for the contracts you currently have available."
|
||||
item_icon = "fa-dice"
|
||||
limited = 2
|
||||
cost = 0
|
||||
|
||||
/datum/contractor_item/contract_reroll/handle_purchase(var/datum/contractor_hub/hub)
|
||||
. = ..()
|
||||
if (.)
|
||||
var/list/new_target_list = list() // We're not regenerating already completed/aborted/extracting contracts, but we don't want to repeat their targets.
|
||||
for(var/datum/syndicate_contract/contract_check in hub.assigned_contracts)
|
||||
if (contract_check.status != CONTRACT_STATUS_ACTIVE && contract_check.status != CONTRACT_STATUS_INACTIVE)
|
||||
if (contract_check.contract.target)
|
||||
new_target_list.Add(contract_check.contract.target)
|
||||
continue
|
||||
for(var/datum/syndicate_contract/rerolling_contract in hub.assigned_contracts) // Reroll contracts without duplicates
|
||||
if (rerolling_contract.status != CONTRACT_STATUS_ACTIVE && rerolling_contract.status != CONTRACT_STATUS_INACTIVE)
|
||||
continue
|
||||
rerolling_contract.generate(new_target_list)
|
||||
new_target_list.Add(rerolling_contract.contract.target)
|
||||
hub.assigned_targets = new_target_list // Set our target list with the new set we've generated.
|
||||
|
||||
/datum/contractor_item/contractor_pinpointer
|
||||
name = "Contractor Pinpointer"
|
||||
desc = "A pinpointer that finds targets even without active suit sensors. Due to taking advantage of an exploit within the system, it can't pinpoint to the same accuracy as the traditional models. Becomes permanently locked to the user that first activates it."
|
||||
item = /obj/item/pinpointer/crew/contractor
|
||||
item_icon = "fa-search-location"
|
||||
limited = 2
|
||||
cost = 1
|
||||
|
||||
/datum/contractor_item/fulton_extraction_kit
|
||||
name = "Fulton Extraction Kit"
|
||||
desc = "For getting your target across the station to those difficult dropoffs. Place the beacon somewhere secure, and link the pack. Activating the pack on your target in space will send them over to the beacon - make sure they're not just going to run away though!"
|
||||
item = /obj/item/storage/box/contractor/fulton_extraction
|
||||
item_icon = "fa-parachute-box"
|
||||
limited = 1
|
||||
cost = 1
|
||||
|
||||
/datum/contractor_item/contractor_partner
|
||||
name = "Reinforcements"
|
||||
desc = "Upon purchase we'll contact available units in the area. Should there be an agent free, we'll send them down to assist you immediately. If no units are free, we give a full refund."
|
||||
item_icon = "fa-user-friends"
|
||||
limited = 1
|
||||
cost = 2
|
||||
var/datum/mind/partner_mind = null
|
||||
|
||||
/datum/contractor_item/contractor_partner/handle_purchase(var/datum/contractor_hub/hub, mob/living/user)
|
||||
. = ..()
|
||||
if (.)
|
||||
to_chat(user, "<span class='notice'>The uplink vibrates quietly, connecting to nearby agents...</span>")
|
||||
var/list/mob/dead/observer/candidates = pollGhostCandidates("Do you want to play as the Contractor Support Unit for [user.real_name]?", ROLE_PAI, null, FALSE, 100, POLL_IGNORE_CONTRACTOR_SUPPORT)
|
||||
if(LAZYLEN(candidates))
|
||||
var/mob/dead/observer/C = pick(candidates)
|
||||
spawn_contractor_partner(user, C.key)
|
||||
else
|
||||
to_chat(user, "<span class='notice'>No available agents at this time, please try again later.</span>")
|
||||
limited += 1 // refund and add the limit back.
|
||||
hub.contract_rep += cost
|
||||
hub.purchased_items -= src
|
||||
|
||||
/datum/outfit/contractor_partner
|
||||
name = "Contractor Support Unit"
|
||||
uniform = /obj/item/clothing/under/chameleon
|
||||
suit = /obj/item/clothing/suit/chameleon
|
||||
back = /obj/item/storage/backpack
|
||||
belt = /obj/item/pda/chameleon
|
||||
mask = /obj/item/clothing/mask/cigarette/syndicate
|
||||
shoes = /obj/item/clothing/shoes/chameleon/noslip
|
||||
ears = /obj/item/radio/headset/chameleon
|
||||
id = /obj/item/card/id/syndicate
|
||||
r_hand = /obj/item/storage/toolbox/syndicate
|
||||
backpack_contents = list(/obj/item/storage/box/survival, /obj/item/implanter/uplink, /obj/item/clothing/mask/chameleon,
|
||||
/obj/item/storage/fancy/cigarettes/cigpack_syndicate, /obj/item/lighter)
|
||||
|
||||
/datum/outfit/contractor_partner/post_equip(mob/living/carbon/human/H, visualsOnly)
|
||||
. = ..()
|
||||
var/obj/item/clothing/mask/cigarette/syndicate/cig = H.get_item_by_slot(SLOT_WEAR_MASK)
|
||||
cig.light() // pre-light their cig for extra badass
|
||||
|
||||
/datum/contractor_item/contractor_partner/proc/spawn_contractor_partner(mob/living/user, key)
|
||||
var/mob/living/carbon/human/partner = new()
|
||||
var/datum/outfit/contractor_partner/partner_outfit = new()
|
||||
partner_outfit.equip(partner)
|
||||
var/obj/structure/closet/supplypod/arrival_pod = new()
|
||||
arrival_pod.style = STYLE_SYNDICATE
|
||||
arrival_pod.explosionSize = list(0,0,0,1)
|
||||
arrival_pod.bluespace = TRUE
|
||||
var/turf/free_location = find_obstruction_free_location(2, user)
|
||||
if (!free_location) // We really want to send them - if we can't find a nice location just land it on top of them.
|
||||
free_location = get_turf(user)
|
||||
partner.forceMove(arrival_pod)
|
||||
partner.ckey = key
|
||||
partner_mind = partner.mind // We give a reference to the mind that'll be the support unit
|
||||
partner_mind.make_Contractor_Support()
|
||||
to_chat(partner_mind.current, "\n<span class='alertwarning'>[user.real_name] is your superior. Follow any, and all orders given by them. You're here to support their mission only.</span>")
|
||||
to_chat(partner_mind.current, "<span class='alertwarning'>Should they perish, or be otherwise unavailable, you're to assist other active agents in this mission area to the best of your ability.</span>\n\n")
|
||||
new /obj/effect/abstract/DPtarget(free_location, arrival_pod)
|
||||
|
||||
/datum/contractor_item/blackout
|
||||
name = "Blackout"
|
||||
desc = "Request Syndicate Command to distrupt the station's powernet. Disables power across the station for a short duration."
|
||||
item_icon = "fa-bolt"
|
||||
limited = 2
|
||||
cost = 3
|
||||
|
||||
/datum/contractor_item/blackout/handle_purchase(var/datum/contractor_hub/hub)
|
||||
. = ..()
|
||||
if (.)
|
||||
power_fail(35, 50)
|
||||
priority_announce("Abnormal activity detected in [station_name()]'s powernet. As a precautionary measure, the station's power will be shut off for an indeterminate duration.", "Critical Power Failure", "poweroff")
|
||||
|
||||
// Subtract cost, and spawn if it's an item.
|
||||
/datum/contractor_item/proc/handle_purchase(var/datum/contractor_hub/hub, mob/living/user)
|
||||
if (hub.contract_rep >= cost)
|
||||
hub.contract_rep -= cost
|
||||
else
|
||||
return FALSE
|
||||
if (limited >= 1)
|
||||
limited -= 1
|
||||
else if (limited == 0)
|
||||
return FALSE
|
||||
hub.purchased_items.Add(src)
|
||||
if (item && ispath(item))
|
||||
var/atom/item_to_create = new item(get_turf(user))
|
||||
|
||||
if(user.put_in_hands(item_to_create))
|
||||
to_chat(user, "<span class='notice'>Your purchase materializes into your hands!</span>")
|
||||
else
|
||||
to_chat(user, "<span class='notice'>Your purchase materializes onto the floor.</span>")
|
||||
return item_to_create
|
||||
return TRUE
|
||||
|
||||
/obj/item/pinpointer/crew/contractor
|
||||
name = "contractor pinpointer"
|
||||
desc = "A handheld tracking device that locks onto certain signals. Ignores suit sensors, but is much less accurate."
|
||||
icon_state = "pinpointer_syndicate"
|
||||
minimum_range = 25
|
||||
has_owner = TRUE
|
||||
ignore_suit_sensor_level = TRUE
|
||||
|
||||
/obj/item/storage/box/contractor/fulton_extraction
|
||||
name = "Fulton Extraction Kit"
|
||||
icon_state = "syndiebox"
|
||||
illustration = "writing_syndie"
|
||||
|
||||
/obj/item/storage/box/contractor/fulton_extraction/PopulateContents()
|
||||
new /obj/item/extraction_pack(src)
|
||||
new /obj/item/fulton_core(src)
|
||||
141
code/modules/antagonists/traitor/syndicate_contract.dm
Normal file
141
code/modules/antagonists/traitor/syndicate_contract.dm
Normal file
@@ -0,0 +1,141 @@
|
||||
/datum/syndicate_contract
|
||||
var/id = 0
|
||||
var/status = CONTRACT_STATUS_INACTIVE
|
||||
var/datum/objective/contract/contract = new()
|
||||
var/ransom = 0
|
||||
var/payout_type = null
|
||||
var/list/victim_belongings = list()
|
||||
|
||||
/datum/syndicate_contract/New(contract_owner, blacklist, type=CONTRACT_PAYOUT_SMALL)
|
||||
contract.owner = contract_owner
|
||||
payout_type = type
|
||||
generate(blacklist)
|
||||
|
||||
/datum/syndicate_contract/proc/generate(blacklist)
|
||||
contract.find_target(null, blacklist)
|
||||
if (payout_type == CONTRACT_PAYOUT_LARGE)
|
||||
contract.payout_bonus = rand(9,13)
|
||||
else if(payout_type == CONTRACT_PAYOUT_MEDIUM)
|
||||
contract.payout_bonus = rand(6,8)
|
||||
else
|
||||
contract.payout_bonus = rand(2,4)
|
||||
contract.payout = rand(0, 2)
|
||||
contract.generate_dropoff()
|
||||
ransom = 100 * rand(18, 45)
|
||||
|
||||
/datum/syndicate_contract/proc/handle_extraction(var/mob/living/user)
|
||||
if (contract.target && contract.dropoff_check(user, contract.target.current))
|
||||
var/turf/free_location = find_obstruction_free_location(3, user, contract.dropoff)
|
||||
if(free_location) // We've got a valid location, launch.
|
||||
launch_extraction_pod(free_location)
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
// Launch the pod to collect our victim.
|
||||
/datum/syndicate_contract/proc/launch_extraction_pod(turf/empty_pod_turf)
|
||||
var/obj/structure/closet/supplypod/extractionpod/empty_pod = new()
|
||||
RegisterSignal(empty_pod, COMSIG_ATOM_ENTERED, .proc/enter_check)
|
||||
empty_pod.stay_after_drop = TRUE
|
||||
empty_pod.reversing = TRUE
|
||||
empty_pod.explosionSize = list(0,0,0,1)
|
||||
empty_pod.leavingSound = 'sound/effects/podwoosh.ogg'
|
||||
new /obj/effect/abstract/DPtarget(empty_pod_turf, empty_pod)
|
||||
|
||||
/datum/syndicate_contract/proc/enter_check(datum/source, sent_mob)
|
||||
if(istype(source, /obj/structure/closet/supplypod/extractionpod))
|
||||
if(isliving(sent_mob))
|
||||
var/mob/living/M = sent_mob
|
||||
var/datum/antagonist/traitor/traitor_data = contract.owner.has_antag_datum(/datum/antagonist/traitor)
|
||||
if(M == contract.target.current)
|
||||
traitor_data.contractor_hub.contract_TC_to_redeem += contract.payout
|
||||
if(M.stat != DEAD)
|
||||
traitor_data.contractor_hub.contract_TC_to_redeem += contract.payout_bonus
|
||||
status = CONTRACT_STATUS_COMPLETE
|
||||
if(traitor_data.contractor_hub.current_contract == src)
|
||||
traitor_data.contractor_hub.current_contract = null
|
||||
traitor_data.contractor_hub.contract_rep += 2
|
||||
else
|
||||
status = CONTRACT_STATUS_ABORTED // Sending a target that wasn't even yours is as good as just aborting it
|
||||
if(traitor_data.contractor_hub.current_contract == src)
|
||||
traitor_data.contractor_hub.current_contract = null
|
||||
if(iscarbon(M))
|
||||
for(var/obj/item/W in M)
|
||||
if(ishuman(M))
|
||||
var/mob/living/carbon/human/H = M
|
||||
if(W == H.w_uniform || W == H.shoes)
|
||||
continue //So all they're left with are shoes and uniform.
|
||||
M.transferItemToLoc(W)
|
||||
victim_belongings.Add(W)
|
||||
var/obj/structure/closet/supplypod/extractionpod/pod = source
|
||||
pod.send_up(pod) // Handle the pod returning
|
||||
handleVictimExperience(M) // After pod is sent we start the victim narrative/heal.
|
||||
var/points_to_check = SSshuttle.points // This is slightly delayed because of the sleep calls above to handle the narrative. We don't want to tell the station instantly.
|
||||
if(points_to_check >= ransom)
|
||||
SSshuttle.points -= ransom
|
||||
else
|
||||
SSshuttle.points -= points_to_check
|
||||
priority_announce("One of your crew was captured by a rival organisation - we've needed to pay their ransom to bring them back. \
|
||||
As is policy we've taken a portion of the station's funds to offset the overall cost.", null, "attention", null, "Nanotrasen Asset Protection")
|
||||
|
||||
/datum/syndicate_contract/proc/handleVictimExperience(var/mob/living/M) // They're off to holding - handle the return timer and give some text about what's going on.
|
||||
addtimer(CALLBACK(src, .proc/returnVictim, M), (60 * 10) * 4) // Ship 'em back - dead or alive... 4 minutes wait.
|
||||
if(M.stat != DEAD) //Even if they weren't the target, we're still treating them the same.
|
||||
M.reagents.add_reagent(/datum/reagent/medicine/omnizine, 20) // Heal them up - gets them out of crit/soft crit.
|
||||
M.flash_act()
|
||||
M.confused += 10
|
||||
M.blur_eyes(5)
|
||||
to_chat(M, "<span class='warning'>You feel strange...</span>")
|
||||
sleep(60)
|
||||
to_chat(M, "<span class='warning'>That pod did something to you...</span>")
|
||||
M.Dizzy(35)
|
||||
sleep(65)
|
||||
to_chat(M, "<span class='warning'>Your head pounds... It feels like it's going to burst out your skull!</span>")
|
||||
M.flash_act()
|
||||
M.confused += 20
|
||||
M.blur_eyes(3)
|
||||
sleep(30)
|
||||
to_chat(M, "<span class='warning'>Your head pounds...</span>")
|
||||
sleep(100)
|
||||
M.flash_act()
|
||||
M.Unconscious(200)
|
||||
to_chat(M, "<span class='reallybig hypnophrase'>A million voices echo in your head... <i>\"Your mind held many valuable secrets - \
|
||||
we thank you for providing them. Your value is expended, and you will be ransomed back to your station. We always get paid, \
|
||||
so it's only a matter of time before we ship you back...\"</i></span>")
|
||||
M.blur_eyes(10)
|
||||
M.Dizzy(15)
|
||||
M.confused += 20
|
||||
|
||||
/datum/syndicate_contract/proc/returnVictim(var/mob/living/M) // We're returning the victim
|
||||
var/list/possible_drop_loc = list()
|
||||
for(var/turf/possible_drop in contract.dropoff.contents)
|
||||
if(!is_blocked_turf(possible_drop))
|
||||
possible_drop_loc.Add(possible_drop)
|
||||
if(possible_drop_loc.len > 0)
|
||||
var/pod_rand_loc = rand(1, possible_drop_loc.len)
|
||||
var/obj/structure/closet/supplypod/return_pod = new()
|
||||
return_pod.bluespace = TRUE
|
||||
return_pod.explosionSize = list(0,0,0,0)
|
||||
return_pod.style = STYLE_SYNDICATE
|
||||
do_sparks(8, FALSE, M)
|
||||
M.visible_message("<span class='notice'>[M] vanishes...</span>")
|
||||
for(var/obj/item/W in M)
|
||||
if(ishuman(M))
|
||||
var/mob/living/carbon/human/H = M
|
||||
if(W == H.w_uniform || W == H.shoes)
|
||||
continue //So all they're left with are shoes and uniform.
|
||||
M.dropItemToGround(W)
|
||||
for(var/obj/item/W in victim_belongings)
|
||||
W.forceMove(return_pod)
|
||||
M.forceMove(return_pod)
|
||||
M.flash_act()
|
||||
M.blur_eyes(30)
|
||||
M.Dizzy(35)
|
||||
M.confused += 20
|
||||
new /obj/effect/abstract/DPtarget(possible_drop_loc[pod_rand_loc], return_pod)
|
||||
else
|
||||
to_chat(M, "<span class='reallybig hypnophrase'>A million voices echo in your head... <i>\"Seems where you got sent here from won't \
|
||||
be able to handle our pod... You will die here instead.\"</i></span>")
|
||||
if(iscarbon(M))
|
||||
var/mob/living/carbon/C = M
|
||||
if(C.can_heartattack())
|
||||
C.set_heartattack(TRUE)
|
||||
@@ -0,0 +1,177 @@
|
||||
/datum/computer_file/program/contract_uplink
|
||||
filename = "contractor uplink"
|
||||
filedesc = "Syndicate Contract Uplink"
|
||||
program_icon_state = "assign"
|
||||
extended_desc = "A standard, Syndicate issued system for handling important contracts while on the field."
|
||||
size = 10
|
||||
requires_ntnet = 0
|
||||
available_on_ntnet = 0
|
||||
unsendable = 1
|
||||
undeletable = 1
|
||||
tgui_id = "synd_contract"
|
||||
ui_style = "syndicate"
|
||||
ui_x = 600
|
||||
ui_y = 600
|
||||
var/error = ""
|
||||
var/page = CONTRACT_UPLINK_PAGE_CONTRACTS
|
||||
var/assigned = FALSE
|
||||
|
||||
/datum/computer_file/program/contract_uplink/run_program(var/mob/living/user)
|
||||
. = ..(user)
|
||||
|
||||
/datum/computer_file/program/contract_uplink/ui_act(action, params)
|
||||
if(..())
|
||||
return 1
|
||||
var/mob/living/user = usr
|
||||
var/obj/item/computer_hardware/hard_drive/small/syndicate/hard_drive = computer.all_components[MC_HDD]
|
||||
switch(action)
|
||||
if("PRG_contract-accept")
|
||||
var/contract_id = text2num(params["contract_id"])
|
||||
// Set as the active contract
|
||||
hard_drive.traitor_data.contractor_hub.assigned_contracts[contract_id].status = CONTRACT_STATUS_ACTIVE
|
||||
hard_drive.traitor_data.contractor_hub.current_contract = hard_drive.traitor_data.contractor_hub.assigned_contracts[contract_id]
|
||||
program_icon_state = "single_contract"
|
||||
return 1
|
||||
if("PRG_login")
|
||||
var/datum/antagonist/traitor/traitor_data = user.mind.has_antag_datum(/datum/antagonist/traitor)
|
||||
if(traitor_data) // Bake their data right into the hard drive, or we don't allow non-antags gaining access to unused contract system. We also create their contracts at this point.
|
||||
if(!traitor_data.contractor_hub) // Only play greet sound, and handle contractor hub when assigning for the first time.
|
||||
traitor_data.contractor_hub = new
|
||||
traitor_data.contractor_hub.create_hub_items()
|
||||
user.playsound_local(user, 'sound/effects/contractstartup.ogg', 100, 0)
|
||||
traitor_data.contractor_hub.create_contracts()
|
||||
hard_drive.traitor_data = traitor_data
|
||||
// Stops any topic exploits such as logging in multiple times on a single system.
|
||||
if(!assigned)
|
||||
traitor_data.contractor_hub.create_contracts(traitor_data.owner)
|
||||
hard_drive.traitor_data = traitor_data
|
||||
program_icon_state = "contracts"
|
||||
assigned = TRUE
|
||||
else
|
||||
error = "Incorrect login details."
|
||||
return 1
|
||||
if("PRG_call_extraction")
|
||||
if(hard_drive.traitor_data.contractor_hub.current_contract.status != CONTRACT_STATUS_EXTRACTING)
|
||||
if(hard_drive.traitor_data.contractor_hub.current_contract.handle_extraction(user))
|
||||
user.playsound_local(user, 'sound/effects/confirmdropoff.ogg', 100, 1)
|
||||
hard_drive.traitor_data.contractor_hub.current_contract.status = CONTRACT_STATUS_EXTRACTING
|
||||
program_icon_state = "extracted"
|
||||
else
|
||||
user.playsound_local(user, 'sound/machines/uplinkerror.ogg', 50)
|
||||
error = "Either both you or your target aren't at the dropoff location, or the pod hasn't got a valid place to land. Clear space, or make sure you're both inside."
|
||||
else
|
||||
user.playsound_local(user, 'sound/machines/uplinkerror.ogg', 50)
|
||||
error = "Already extracting... Place the target into the pod. If the pod was destroyed, you will need to cancel this contract."
|
||||
return 1
|
||||
if("PRG_contract_abort")
|
||||
var/contract_id = hard_drive.traitor_data.contractor_hub.current_contract.id
|
||||
hard_drive.traitor_data.contractor_hub.current_contract = null
|
||||
hard_drive.traitor_data.contractor_hub.assigned_contracts[contract_id].status = CONTRACT_STATUS_ABORTED
|
||||
program_icon_state = "contracts"
|
||||
return 1
|
||||
if("PRG_redeem_TC")
|
||||
if(hard_drive.traitor_data.contractor_hub.contract_TC_to_redeem)
|
||||
var/obj/item/stack/telecrystal/crystals = new /obj/item/stack/telecrystal(get_turf(user), hard_drive.traitor_data.contractor_hub.contract_TC_to_redeem)
|
||||
if(ishuman(user))
|
||||
var/mob/living/carbon/human/H = user
|
||||
if(H.put_in_hands(crystals))
|
||||
to_chat(H, "<span class='notice'>Your payment materializes into your hands!</span>")
|
||||
else
|
||||
to_chat(user, "<span class='notice'>Your payment materializes onto the floor.</span>")
|
||||
hard_drive.traitor_data.contractor_hub.contract_TC_payed_out += hard_drive.traitor_data.contractor_hub.contract_TC_to_redeem
|
||||
hard_drive.traitor_data.contractor_hub.contract_TC_to_redeem = 0
|
||||
return 1
|
||||
else
|
||||
user.playsound_local(user, 'sound/machines/uplinkerror.ogg', 50)
|
||||
return 1
|
||||
if("PRG_clear_error")
|
||||
error = ""
|
||||
if("PRG_contractor_hub")
|
||||
page = CONTRACT_UPLINK_PAGE_HUB
|
||||
program_icon_state = "store"
|
||||
if("PRG_hub_back")
|
||||
page = CONTRACT_UPLINK_PAGE_CONTRACTS
|
||||
program_icon_state = "contracts"
|
||||
if("buy_hub")
|
||||
if(hard_drive.traitor_data.owner.current == user)
|
||||
var/item = params["item"]
|
||||
for (var/datum/contractor_item/hub_item in hard_drive.traitor_data.contractor_hub.hub_items)
|
||||
if (hub_item.name == item)
|
||||
hub_item.handle_purchase(hard_drive.traitor_data.contractor_hub, user)
|
||||
else
|
||||
error = "Invalid user... You weren't recognised as the user of this system."
|
||||
|
||||
/datum/computer_file/program/contract_uplink/ui_data(mob/user)
|
||||
var/list/data = list()
|
||||
var/obj/item/computer_hardware/hard_drive/small/syndicate/hard_drive = computer.all_components[MC_HDD]
|
||||
var/screen_to_be = null
|
||||
|
||||
if(hard_drive && hard_drive.traitor_data != null)
|
||||
var/datum/antagonist/traitor/traitor_data = hard_drive.traitor_data
|
||||
error = ""
|
||||
data = get_header_data()
|
||||
if(traitor_data.contractor_hub.current_contract)
|
||||
data["ongoing_contract"] = TRUE
|
||||
screen_to_be = "single_contract"
|
||||
if(traitor_data.contractor_hub.current_contract.status == CONTRACT_STATUS_EXTRACTING)
|
||||
data["extraction_enroute"] = TRUE
|
||||
screen_to_be = "extracted"
|
||||
data["logged_in"] = TRUE
|
||||
data["station_name"] = GLOB.station_name
|
||||
data["redeemable_tc"] = traitor_data.contractor_hub.contract_TC_to_redeem
|
||||
data["contract_rep"] = traitor_data.contractor_hub.contract_rep
|
||||
data["page"] = page
|
||||
data["error"] = error
|
||||
for(var/datum/contractor_item/hub_item in traitor_data.contractor_hub.hub_items)
|
||||
data["contractor_hub_items"] += list(list(
|
||||
"name" = hub_item.name,
|
||||
"desc" = hub_item.desc,
|
||||
"cost" = hub_item.cost,
|
||||
"limited" = hub_item.limited,
|
||||
"item_icon" = hub_item.item_icon
|
||||
))
|
||||
for(var/datum/syndicate_contract/contract in traitor_data.contractor_hub.assigned_contracts)
|
||||
var/target_rank = ""
|
||||
if(contract.contract.target)
|
||||
var/datum/data/record/record = find_record("name", contract.contract.target.current.real_name, GLOB.data_core.general)
|
||||
if(record)
|
||||
target_rank = record.fields["rank"]
|
||||
else
|
||||
target_rank = "Unknown"
|
||||
data["contracts"] += list(list(
|
||||
"target" = contract.contract.target,
|
||||
"target_rank" = target_rank,
|
||||
"payout" = contract.contract.payout,
|
||||
"payout_bonus" = contract.contract.payout_bonus,
|
||||
"dropoff" = contract.contract.dropoff,
|
||||
"id" = contract.id,
|
||||
"status" = contract.status
|
||||
))
|
||||
|
||||
var/direction
|
||||
if(traitor_data.contractor_hub.current_contract)
|
||||
var/turf/curr = get_turf(user)
|
||||
var/turf/dropoff_turf
|
||||
data["current_location"] = "[get_area_name(curr, TRUE)]"
|
||||
for(var/turf/content in traitor_data.contractor_hub.current_contract.contract.dropoff.contents)
|
||||
if(isturf(content))
|
||||
dropoff_turf = content
|
||||
break
|
||||
if(curr.z == dropoff_turf.z) //Direction calculations for same z-level only
|
||||
direction = uppertext(dir2text(get_dir(curr, dropoff_turf))) //Direction text (East, etc). Not as precise, but still helpful.
|
||||
if(get_area(user) == traitor_data.contractor_hub.current_contract.contract.dropoff)
|
||||
direction = "LOCATION CONFIRMED"
|
||||
else
|
||||
direction = "???"
|
||||
data["dropoff_direction"] = direction
|
||||
if (page == CONTRACT_UPLINK_PAGE_HUB)
|
||||
screen_to_be = "store"
|
||||
if (!screen_to_be)
|
||||
screen_to_be = "contracts"
|
||||
else
|
||||
data["logged_in"] = FALSE
|
||||
if (!screen_to_be)
|
||||
screen_to_be = "assign"
|
||||
program_icon_state = screen_to_be
|
||||
update_computer_icon()
|
||||
return data
|
||||
Reference in New Issue
Block a user