Skip to content

Commit

Permalink
Fixing more stuff
Browse files Browse the repository at this point in the history
Mint machine compile fixes and the syndicate contractor program.
  • Loading branch information
Arturlang committed Apr 23, 2020
1 parent 120615d commit f97f264
Show file tree
Hide file tree
Showing 16 changed files with 201 additions and 84 deletions.
4 changes: 3 additions & 1 deletion code/__DEFINES/DNA.dm
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@
#define TR_KEEPSE (1<<5) // changelings shouldn't edit the DNA's SE when turning into a monkey
#define TR_DEFAULTMSG (1<<6)
#define TR_KEEPORGANS (1<<8)
#define TR_KEEPREAGENTS (1<<10)
#define TR_KEEPSTUNS (1<<9)


#define CLONER_FRESH_CLONE "fresh"
Expand Down Expand Up @@ -184,4 +186,4 @@
#define G_MALE 1
#define G_FEMALE 2
#define G_PLURAL 3
#define G_NEUTER 4
#define G_NEUTER 4
2 changes: 2 additions & 0 deletions code/__DEFINES/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -523,3 +523,5 @@ GLOBAL_LIST_INIT(pda_reskins, list(PDA_SKIN_CLASSIC = 'icons/obj/pda.dmi', PDA_S
#define NIGHTSHIFT_AREA_NONE 4 //default/highest.

#define UNTIL(X) while(!(X)) stoplag()

#define WANTED_FILE "wanted_message.json"
1 change: 1 addition & 0 deletions code/__HELPERS/_string_lists.dm
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#define pick_list(FILE, KEY) (pick(strings(FILE, KEY)))
#define pick_list_weighted(FILE, KEY) (pickweight(strings(FILE, KEY)))
#define pick_list_replacements(FILE, KEY) (strings_replacement(FILE, KEY))
#define json_load(FILE) (json_decode(file2text(FILE)))

Expand Down
103 changes: 80 additions & 23 deletions code/modules/antagonists/traitor/syndicate_contract.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,94 +4,144 @@
var/datum/objective/contract/contract = new()
var/target_rank
var/ransom = 0
var/payout_type = null
var/payout_type
var/wanted_message

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)

var/datum/data/record/record
if(contract.target)
if (contract.target)
record = find_record("name", contract.target.name, GLOB.data_core.general)
if(record)

if (record)
target_rank = record.fields["rank"]
else
target_rank = "Unknown"
if(payout_type == CONTRACT_PAYOUT_LARGE)

if (payout_type == CONTRACT_PAYOUT_LARGE)
contract.payout_bonus = rand(9,13)
else if(payout_type == CONTRACT_PAYOUT_MEDIUM)
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)

var/base = pick_list(WANTED_FILE, "basemessage")
var/verb_string = pick_list(WANTED_FILE, "verb")
var/noun = pick_list_weighted(WANTED_FILE, "noun")
var/location = pick_list_weighted(WANTED_FILE, "location")
wanted_message = "[base] [verb_string] [noun] [location]."

/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.

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)

new /obj/effect/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
traitor_data.contractor_hub.contracts_completed += 1

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.
if(W == H.w_uniform)
continue //So all they're left with are shoes and uniform.
if(W == H.shoes)
continue


M.transferItemToLoc(W)
victim_belongings.Add(W)

var/obj/structure/closet/supplypod/extractionpod/pod = source
pod.send_up(pod) // Handle the pod returning

// Handle the pod returning
pod.send_up(pod)

if(ishuman(M))
var/mob/living/carbon/human/target = M // After we remove items, at least give them what they need to live.
var/mob/living/carbon/human/target = M

// After we remove items, at least give them what they need to live.
target.dna.species.give_important_for_life(target)
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.

// After pod is sent we start the victim narrative/heal.
handleVictimExperience(M)

// This is slightly delayed because of the sleep calls above to handle the narrative.
// We don't want to tell the station instantly.
var/points_to_check
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")
As is policy we've taken a portion of the station's funds to offset the overall cost.", null, 'sound/ai/attention.ogg', null, "Nanotrasen Asset Protection")

// They're off to holding - handle the return timer and give some text about what's going on.
/datum/syndicate_contract/proc/handleVictimExperience(var/mob/living/M)
// Ship 'em back - dead or alive, 4 minutes wait.
// Even if they weren't the target, we're still treating them the same.
addtimer(CALLBACK(src, .proc/returnVictim, M), (60 * 10) * 4)

if (M.stat != DEAD)
M.reagents.add_reagent(/datum/reagent/medicine/regen_jelly, 20)

/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), 4 MINUTES) // 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/regen_jelly, 20) // Heal them up - gets them out of crit/soft crit. -- now 100% toxinlover friendly!!
M.flash_act()
M.confused += 10
M.blur_eyes(5)
Expand All @@ -116,13 +166,18 @@
M.Dizzy(15)
M.confused += 20

/datum/syndicate_contract/proc/returnVictim(var/mob/living/M) // We're returning the victim
// We're returning the victim
/datum/syndicate_contract/proc/returnVictim(var/mob/living/M)
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(!isspaceturf(possible_drop) && !isclosedturf(possible_drop))
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)
Expand All @@ -132,8 +187,10 @@
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)
if(W == H.w_uniform)
continue //So all they're left with are shoes and uniform.
if(W == H.shoes)
continue
M.dropItemToGround(W)
for(var/obj/item/W in victim_belongings)
W.forceMove(return_pod)
Expand All @@ -142,7 +199,7 @@
M.blur_eyes(30)
M.Dizzy(35)
M.confused += 20
new /obj/effect/abstract/DPtarget(possible_drop_loc[pod_rand_loc], return_pod)
new /obj/effect/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>")
Expand Down
1 change: 1 addition & 0 deletions code/modules/mining/machine_processing.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
/obj/machinery/mineral
var/input_dir = NORTH
var/output_dir = SOUTH
var/needs_item_input

/obj/machinery/mineral/proc/unload_mineral(atom/movable/S)
S.forceMove(drop_location())
Expand Down
65 changes: 27 additions & 38 deletions code/modules/mining/mint.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
input_dir = EAST
ui_x = 300
ui_y = 250
needs_item_input = TRUE

var/produced_coins = 0 // how many coins the machine has made in it's last cycle
var/processing = FALSE
Expand All @@ -35,19 +34,16 @@
chosen = SSmaterials.GetMaterialRef(chosen)


/obj/machinery/mineral/mint/pickup_item(datum/source, atom/movable/target, atom/oldLoc)
if(!istype(target, /obj/item/stack))
return

/obj/machinery/mineral/mint/process()
var/turf/T = get_step(src, input_dir)
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
var/obj/item/stack/S = target

if(materials.insert_item(S))
qdel(S)

for(var/obj/item/stack/O in T)
var/inserted = materials.insert_item(O)
if(inserted)
qdel(O)

/obj/machinery/mineral/mint/process()
if(processing)
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
var/datum/material/M = chosen

if(!M)
Expand All @@ -63,42 +59,42 @@
for(var/coin_to_make in 1 to 5)
create_coins()
produced_coins++
else
else
var/found_new = FALSE
for(var/datum/material/inserted_material in materials.materials)
var/amount = materials.get_material_amount(inserted_material)

if(amount)
chosen = inserted_material
found_new = TRUE

if(!found_new)
processing = FALSE
else
end_processing()
icon_state = "coinpress0"

/obj/machinery/mineral/mint/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
ui = new(user, src, ui_key, "Mint", name, ui_x, ui_y, master_ui, state)
ui = new(user, src, ui_key, "mint", name, ui_x, ui_y, master_ui, state)
ui.open()

/obj/machinery/mineral/mint/ui_data()
var/list/data = list()
data["inserted_materials"] = list()
data["chosen_material"] = null

var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)

for(var/datum/material/inserted_material in materials.materials)
var/amount = materials.get_material_amount(inserted_material)

if(!amount)
continue

data["inserted_materials"] += list(list(
"material" = inserted_material.name,
"amount" = amount,
"amount" = amount
))

if(chosen == inserted_material)
data["chosen_material"] = inserted_material.name

Expand All @@ -108,25 +104,18 @@
return data;

/obj/machinery/mineral/mint/ui_act(action, params, datum/tgui/ui)
. = ..()
if(.)
return
if(action == "startpress")
if (!processing)
produced_coins = 0
processing = TRUE
begin_processing()
return TRUE
if (action == "stoppress")
processing = FALSE
end_processing()
return TRUE
if (action == "changematerial")
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
for(var/datum/material/mat in materials.materials)
if (params["material_name"] == mat.name)
chosen = mat
return TRUE
switch(action)
if ("startpress")
if (!processing)
produced_coins = 0
processing = TRUE
if ("stoppress")
processing = FALSE
if ("changematerial")
var/datum/component/material_container/materials = GetComponent(/datum/component/material_container)
for(var/datum/material/mat in materials.materials)
if (params["material_name"] == mat.name)
chosen = mat

/obj/machinery/mineral/mint/proc/create_coins()
var/turf/T = get_step(src,output_dir)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/alien/alien.dm
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

status_flags = CANUNCONSCIOUS|CANPUSH

var/heat_protection = 0.5
heat_protection = 0.5
var/leaping = 0
gib_type = /obj/effect/decal/cleanable/blood/gibs/xeno
unique_name = 1
Expand Down
Loading

0 comments on commit f97f264

Please sign in to comment.