diff --git a/baystation12.dme b/baystation12.dme index ff496e8aad5..acba0a7b7f9 100644 --- a/baystation12.dme +++ b/baystation12.dme @@ -219,6 +219,7 @@ #include "code\game\gamemodes\objective.dm" #include "code\game\gamemodes\scoreboard.dm" #include "code\game\gamemodes\setupgame.dm" +#include "code\game\gamemodes\steal_items.dm" #include "code\game\gamemodes\autotraitor\autotraitor.dm" #include "code\game\gamemodes\blob\blob.dm" #include "code\game\gamemodes\blob\blob_finish.dm" diff --git a/code/datums/mind.dm b/code/datums/mind.dm index 7f630c9bb26..57701a4ec08 100644 --- a/code/datums/mind.dm +++ b/code/datums/mind.dm @@ -52,7 +52,9 @@ datum/mind var/datum/faction/faction //associated faction var/datum/changeling/changeling //changeling holder - var/datum/vampire/vampire //vampire holder + + var/datum/vampire/vampire //vampire holder + var/rev_cooldown = 0 // the world.time since the mob has been brigged, or -1 if not at all diff --git a/code/game/gamemodes/events/space_ninja.dm b/code/game/gamemodes/events/space_ninja.dm index 7168274bd07..f6661c1f1c9 100644 --- a/code/game/gamemodes/events/space_ninja.dm +++ b/code/game/gamemodes/events/space_ninja.dm @@ -303,8 +303,7 @@ Malf AIs/silicons aren't added. Monkeys aren't added. Messes with objective comp if(2)//Steal var/datum/objective/steal/ninja_objective = new ninja_objective.owner = ninja_mind - var/target_item = pick(ninja_objective.possible_items_special) - ninja_objective.set_target(target_item) + ninja_objective.find_target(1) // Find a special target. ninja_mind.objectives += ninja_objective objective_list -= 2 diff --git a/code/game/gamemodes/nuclear/pinpointer.dm b/code/game/gamemodes/nuclear/pinpointer.dm index 24f2353b8ed..fc7cc1a648e 100644 --- a/code/game/gamemodes/nuclear/pinpointer.dm +++ b/code/game/gamemodes/nuclear/pinpointer.dm @@ -148,12 +148,18 @@ mode = 2 switch(alert("Search for item signature or DNA fragment?" , "Signature Mode Select" , "" , "Item" , "DNA")) if("Item") - var/datum/objective/steal/itemlist - itemlist = itemlist // To supress a 'variable defined but not used' error. - var/targetitem = input("Select item to search for.", "Item Mode Select","") as null|anything in itemlist.possible_items + var/list/item_names[0] + var/list/item_paths[0] + for(var/typepath in potential_theft_objectives) + var/obj/item/tmp_object=new typepath + var/n="[tmp_object]" + item_names+=n + item_paths[n]=typepath + del(tmp_object) + var/targetitem = input("Select item to search for.", "Item Mode Select","") as null|anything in potential_theft_objectives if(!targetitem) return - target=locate(itemlist.possible_items[targetitem]) + target=locate(item_paths[targetitem]) if(!target) usr << "Failed to locate [targetitem]!" return diff --git a/code/game/gamemodes/objective.dm b/code/game/gamemodes/objective.dm index 6aaf0dd6cd1..27164b5abc9 100644 --- a/code/game/gamemodes/objective.dm +++ b/code/game/gamemodes/objective.dm @@ -1,5 +1,11 @@ //This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:31 +var/list/potential_theft_objectives=typesof(/datum/theft_objective) \ + - /datum/theft_objective \ + - /datum/theft_objective/special \ + - /datum/theft_objective/number \ + - /datum/theft_objective/number/special + datum/objective var/datum/mind/owner = null //Who owns the objective. var/explanation_text = "Nothing" //What that person is supposed to do. @@ -478,131 +484,51 @@ datum/objective/nuclear datum/objective/steal - var/obj/item/steal_target - var/target_name + var/datum/theft_objective/steal_target - var/global/possible_items[] = list( - "the captain's antique laser gun" = /obj/item/weapon/gun/energy/laser/captain, - "a hand teleporter" = /obj/item/weapon/hand_tele, - "an RCD" = /obj/item/weapon/rcd, - "a jetpack" = /obj/item/weapon/tank/jetpack, - "a captain's jumpsuit" = /obj/item/clothing/under/rank/captain, - "a functional AI" = /obj/item/device/aicard, - "a pair of magboots" = /obj/item/clothing/shoes/magboots, - "the station blueprints" = /obj/item/blueprints, - "a nasa voidsuit" = /obj/item/clothing/suit/space/nasavoid, - "28 moles of plasma (full tank)" = /obj/item/weapon/tank, - "a sample of slime extract" = /obj/item/slime_extract, - "a piece of corgi meat" = /obj/item/weapon/reagent_containers/food/snacks/meat/corgi, - "a research director's jumpsuit" = /obj/item/clothing/under/rank/research_director, - "a chief engineer's jumpsuit" = /obj/item/clothing/under/rank/chief_engineer, - "a chief medical officer's jumpsuit" = /obj/item/clothing/under/rank/chief_medical_officer, - "a head of security's jumpsuit" = /obj/item/clothing/under/rank/head_of_security, - "a head of personnel's jumpsuit" = /obj/item/clothing/under/rank/head_of_personnel, - "the hypospray" = /obj/item/weapon/reagent_containers/hypospray, - "the captain's pinpointer" = /obj/item/weapon/pinpointer, - "an ablative armor vest" = /obj/item/clothing/suit/armor/laserproof, - "a laser pointer" = /obj/item/device/laser_pointer, - ) - - var/global/possible_items_special[] = list( - /*"nuclear authentication disk" = /obj/item/weapon/disk/nuclear,*///Broken with the change to nuke disk making it respawn on z level change. - "nuclear gun" = /obj/item/weapon/gun/energy/gun/nuclear, - "diamond drill" = /obj/item/weapon/pickaxe/diamonddrill, - "bag of holding" = /obj/item/weapon/storage/backpack/holding, - "hyper-capacity cell" = /obj/item/weapon/cell/hyper, - "10 diamonds" = /obj/item/stack/sheet/mineral/diamond, - "50 gold bars" = /obj/item/stack/sheet/mineral/gold, - "25 refined uranium bars" = /obj/item/stack/sheet/mineral/uranium, - ) - - - proc/set_target(item_name) - target_name = item_name - steal_target = possible_items[target_name] - if (!steal_target ) - steal_target = possible_items_special[target_name] - explanation_text = "Steal [target_name]." - return steal_target - - - find_target() - return set_target(pick(possible_items)) + find_target(var/special_only=0) + var/loop=50 + while(!steal_target && loop > 0) + loop-- + var/thefttype = pick(potential_theft_objectives) + var/datum/theft_objective/O = new thefttype + if(owner.assigned_role in O.protected_jobs) + continue + if(special_only) + if(!(O.flags & 1)) // THEFT_FLAG_SPECIAL + continue + else + if(O.flags & 1) // THEFT_FLAG_SPECIAL + continue + steal_target=O + explanation_text = "Steal [O]." + return + explanation_text = "Free Objective." proc/select_target() - var/list/possible_items_all = possible_items+possible_items_special+"custom" - var/new_target = input("Select target:", "Objective target", steal_target) as null|anything in possible_items_all + var/list/possible_items_all = potential_theft_objectives+"custom" + var/new_target = input("Select target:", "Objective target", null) as null|anything in possible_items_all if (!new_target) return if (new_target == "custom") - var/obj/item/custom_target = input("Select type:","Type") as null|anything in typesof(/obj/item) - if (!custom_target) return - var/tmp_obj = new custom_target + var/datum/theft_objective/O=new + O.typepath = input("Select type:","Type") as null|anything in typesof(/obj/item) + if (!O.typepath) return + var/tmp_obj = new O.typepath var/custom_name = tmp_obj:name del(tmp_obj) - custom_name = copytext(sanitize(input("Enter target name:", "Objective target", custom_name) as text|null),1,MAX_MESSAGE_LEN) - if (!custom_name) return - target_name = custom_name - steal_target = custom_target - explanation_text = "Steal [target_name]." + O.name = copytext(sanitize(input("Enter target name:", "Objective target", custom_name) as text|null),1,MAX_MESSAGE_LEN) + if (!O.name) return + steal_target = O + explanation_text = "Steal [O.name]." else - set_target(new_target) + steal_target = new new_target + explanation_text = "Steal [steal_target.name]." return steal_target check_completion() - if(!steal_target || !owner.current) return 0 - if(!isliving(owner.current)) return 0 - var/list/all_items = owner.current.get_contents() - switch (target_name) - if("28 moles of plasma (full tank)","10 diamonds","50 gold bars","25 refined uranium bars") - var/target_amount = text2num(target_name)//Non-numbers are ignored. - var/found_amount = 0.0//Always starts as zero. - - for(var/obj/item/I in all_items) //Check for plasma tanks - if(istype(I, steal_target)) - found_amount += (target_name=="28 moles of plasma (full tank)" ? (I:air_contents:toxins) : (I:amount)) - return found_amount>=target_amount - - if("50 coins (in bag)") - var/obj/item/weapon/moneybag/B = locate() in all_items - - if(B) - var/target = text2num(target_name) - var/found_amount = 0.0 - for(var/obj/item/weapon/coin/C in B) - found_amount++ - return found_amount>=target - - if("a functional AI") - for(var/obj/item/device/aicard/C in all_items) //Check for ai card - for(var/mob/living/silicon/ai/M in C) - if(istype(M, /mob/living/silicon/ai) && M.stat != 2) //See if any AI's are alive inside that card. - return 1 - - for(var/obj/item/clothing/suit/space/space_ninja/S in all_items) //Let an AI downloaded into a space ninja suit count - if(S.AI && S.AI.stat != 2) - return 1 - - for(var/mob/living/silicon/ai/ai in world) - if(istype(ai.loc, /turf)) - var/area/check_area = get_area(ai) - if(istype(check_area, /area/shuttle/escape/centcom)) - return 1 - if(istype(check_area, /area/shuttle/escape_pod1/centcom)) - return 1 - if(istype(check_area, /area/shuttle/escape_pod2/centcom)) - return 1 - if(istype(check_area, /area/shuttle/escape_pod3/centcom)) - return 1 - if(istype(check_area, /area/shuttle/escape_pod5/centcom)) - return 1 - else - - for(var/obj/I in all_items) //Check for items - if(istype(I, steal_target)) - return 1 - return 0 - + if(!steal_target) return 1 // Free Objective + return steal_target.check_completion(owner) datum/objective/download diff --git a/code/game/gamemodes/steal_items.dm b/code/game/gamemodes/steal_items.dm new file mode 100644 index 00000000000..72d59460da5 --- /dev/null +++ b/code/game/gamemodes/steal_items.dm @@ -0,0 +1,227 @@ +// Theft objectives. +// +// Separated into datums so we can prevent roles from getting certain objectives. + +#define THEFT_FLAG_SPECIAL 1 + +/datum/theft_objective + var/name="" + var/typepath=/atom + var/list/protected_jobs=list() + var/flags=0 + +/datum/theft_objective/proc/check_completion(var/datum/mind/owner) + if(!owner.current) + return 0 + if(!isliving(owner.current)) + return 0 + var/list/all_items = owner.current.get_contents() + for(var/obj/I in all_items) //Check for items + if(istype(I, typepath)) + //Stealing the cheap autoinjector doesn't count + if(istype(I, /obj/item/weapon/reagent_containers/hypospray/autoinjector)) + continue + return 1 + return 0 + + +/datum/theft_objective/antique_laser_gun + name = "the captain's antique laser gun" + typepath = /obj/item/weapon/gun/energy/laser/captain + protected_jobs = list("Captain") + +/datum/theft_objective/hand_tele + name = "a hand teleporter" + typepath = /obj/item/weapon/hand_tele + protected_jobs = list("Captain") + +/datum/theft_objective/rcd + name = "an RCD" + typepath = /obj/item/weapon/rcd + protected_jobs = list("Chief Engineer") + +/datum/theft_objective/rpd + name = "an RPD" + typepath = /obj/item/weapon/pipe_dispenser + protected_jobs = list("Chief Engineer") + +/datum/theft_objective/jetpack + name = "a jetpack" + typepath = /obj/item/weapon/tank/jetpack + +/datum/theft_objective/cap_jumpsuit + name = "the captain's jumpsuit" + typepath = /obj/item/clothing/under/rank/captain + protected_jobs = list("Captain") + +/datum/theft_objective/ai + name = "a functional AI" + typepath = /obj/item/device/aicard + +/datum/theft_objective/magboots + name = "a pair of magboots" + typepath = /obj/item/clothing/shoes/magboots + protected_jobs = list("Station Engineer", "Atmospheric Technician", "Chief Engineer") + +/datum/theft_objective/blueprints + name = "the station blueprints" + typepath = /obj/item/blueprints + protected_jobs = list("Chief Engineer") + +/datum/theft_objective/voidsuit + name = "a nasa voidsuit" + typepath = /obj/item/clothing/suit/space/nasavoid + protected_jobs = list("Research Director") + +/datum/theft_objective/slime_extract + name = "a sample of slime extract" + typepath = /obj/item/slime_extract + +/datum/theft_objective/corgi + name = "a piece of corgi meat" + typepath = /obj/item/weapon/reagent_containers/food/snacks/meat/corgi + +/datum/theft_objective/rd_jumpsuit + name = "the research director's jumpsuit" + typepath = /obj/item/clothing/under/rank/research_director + protected_jobs = list("Research Director") + +/datum/theft_objective/ce_jumpsuit + name = "the chief engineer's jumpsuit" + typepath = /obj/item/clothing/under/rank/chief_engineer + protected_jobs = list("Chief Engineer") + +/datum/theft_objective/cmo_jumpsuit + name = "the chief medical officer's jumpsuit" + typepath = /obj/item/clothing/under/rank/chief_medical_officer + protected_jobs = list("Chief Medical Officer") + +/datum/theft_objective/hos_jumpsuit + name = "the head of security's jumpsuit" + typepath = /obj/item/clothing/under/rank/head_of_security + protected_jobs = list("Head of Security") + +/datum/theft_objective/hop_jumpsuit + name = "the head of personnel's jumpsuit" + typepath = /obj/item/clothing/under/rank/head_of_personnel + protected_jobs = list("Head of Personnel") + +/datum/theft_objective/hypospray + name = "a hypospray" + typepath = /obj/item/weapon/reagent_containers/hypospray + protected_jobs = list("Chief Medical Officer") + +/datum/theft_objective + name = "the captain's pinpointer" + typepath = /obj/item/weapon/pinpointer + protected_jobs = list("Captain") + +/datum/theft_objective + name = "an ablative armor vest" + typepath = /obj/item/clothing/suit/armor/laserproof + +/datum/theft_objective/number + var/min=0 + var/max=0 + var/step=1 + + var/required_amount=0 + +/datum/theft_objective/number/New() + if(min==max) + required_amount=min + else + var/lower=min/step + var/upper=min/step + required_amount=rand(lower,upper)*step + name = "[required_amount] [name]" + +/datum/theft_objective/number/check_completion(var/datum/mind/owner) + if(!owner.current) + return 0 + if(!isliving(owner.current)) + return 0 + var/list/all_items = owner.current.get_contents() + var/found_amount=0.0 + for(var/obj/item/I in all_items) + if(istype(I, typepath)) + found_amount += getAmountStolen(I) + return found_amount >= required_amount + +/datum/theft_objective/number/proc/getAmountStolen(var/obj/item/I) + return I:amount + +/datum/theft_objective/number/plasma_gas + name = "moles of plasma (full tank)" + typepath = /obj/item/weapon/tank + min=28 + max=28 + +/datum/theft_objective/number/plasma_gas/getAmountStolen(var/obj/item/I) + return I:air_contents:toxins + +/datum/theft_objective/number/coins + name = "credits of coins (in bag)" + min=1000 + max=5000 + step=500 + +/datum/theft_objective/number/coins/check_completion(var/datum/mind/owner) + if(!owner.current) + return 0 + if(!isliving(owner.current)) + return 0 + var/list/all_items = owner.current.get_contents() + var/found_amount=0.0 + for(var/obj/item/weapon/moneybag/B in all_items) + if(B) + for(var/obj/item/weapon/coin/C in B) + found_amount += C.credits + return found_amount >= required_amount + + +//////////////////////////////// +// SPECIAL OBJECTIVES +//////////////////////////////// +/datum/theft_objective/special + flags = THEFT_FLAG_SPECIAL + +/datum/theft_objective/special/nuke_gun + name = "nuclear gun" + typepath = /obj/item/weapon/gun/energy/gun/nuclear + +/datum/theft_objective/special/diamond_drill + name = "diamond drill" + typepath = /obj/item/weapon/pickaxe/diamonddrill + +/datum/theft_objective/special/boh + name = "bag of holding" + typepath = /obj/item/weapon/storage/backpack/holding + +/datum/theft_objective/special/hyper_cell + name = "hyper-capacity cell" + typepath = /obj/item/weapon/cell/hyper + +/datum/theft_objective/number/special + flags = THEFT_FLAG_SPECIAL + +/datum/theft_objective/number/special/diamonds + name = "diamonds" + typepath = /obj/item/stack/sheet/mineral/diamond + min=5 + max=10 + step=5 + +/datum/theft_objective/number/special/gold + name = "gold bars" + typepath = /obj/item/stack/sheet/mineral/gold + min=10 + max=50 + step=10 + +/datum/theft_objective/number/special/uranium + name = "refined uranium bars" + typepath = /obj/item/stack/sheet/mineral/uranium + min=10 + max=30 + step=5 \ No newline at end of file diff --git a/code/modules/admin/verbs/onlyone.dm b/code/modules/admin/verbs/onlyone.dm index fe97f8758c8..a58c43bf0ba 100644 --- a/code/modules/admin/verbs/onlyone.dm +++ b/code/modules/admin/verbs/onlyone.dm @@ -10,10 +10,12 @@ ticker.mode.traitors += H.mind H.mind.special_role = "traitor" + /* This never worked. var/datum/objective/steal/steal_objective = new steal_objective.owner = H.mind steal_objective.set_target("nuclear authentication disk") H.mind.objectives += steal_objective + */ var/datum/objective/hijack/hijack_objective = new hijack_objective.owner = H.mind @@ -64,4 +66,4 @@ M.apply_damage(10, HALLOSS) if(prob(5)) M.Weaken(3) - visible_message("\red [M] HAS BEEN ELIMINATED!!", 3) \ No newline at end of file + visible_message("\red [M] HAS BEEN ELIMINATED!!", 3) diff --git a/code/modules/mining/money_bag.dm b/code/modules/mining/money_bag.dm index bb1db7a86d3..44383b0412d 100644 --- a/code/modules/mining/money_bag.dm +++ b/code/modules/mining/money_bag.dm @@ -54,6 +54,27 @@ dat += text("Bananium coins: [amt_clown] Remove one
") if (amt_adamantine) dat += text("Adamantine coins: [amt_adamantine] Remove one
") +/* + var/credits=0 + var/list/ore=list() + for(var/oredata in typesof(/datum/material) - /datum/material) + var/datum/material/ore_datum = new oredata + ore[ore_datum.id]=ore_datum + + for (var/obj/item/weapon/coin/C in contents) + if (istype(C,/obj/item/weapon/coin)) + var/datum/material/ore_info=ore[C.material] + ore_info.stored++ + ore[C.material]=ore_info + credits += C.credits + + var/dat = "The contents of the moneybag reveal...Total haul: $[credits]" +*/ user << browse("[dat]", "window=moneybag") /obj/item/weapon/moneybag/attackby(obj/item/weapon/W as obj, mob/user as mob) diff --git a/code/modules/mining/ores_coins.dm b/code/modules/mining/ores_coins.dm index d15a0d16091..22024b54aad 100644 --- a/code/modules/mining/ores_coins.dm +++ b/code/modules/mining/ores_coins.dm @@ -81,6 +81,8 @@ throwforce = 0.0 w_class = 1.0 var/string_attached + var/material="iron" // Ore ID, used with coinbags. + var/credits = 0 // How many credits is this coin worth? /obj/item/weapon/coin/New() pixel_x = rand(0,16)-8 @@ -89,30 +91,37 @@ /obj/item/weapon/coin/gold name = "Gold coin" icon_state = "coin_gold" + credits = 10 /obj/item/weapon/coin/silver name = "Silver coin" icon_state = "coin_silver" + credits = 5 /obj/item/weapon/coin/diamond name = "Diamond coin" icon_state = "coin_diamond" + credits = 25 /obj/item/weapon/coin/iron name = "Iron coin" icon_state = "coin_iron" + credits = 1 /obj/item/weapon/coin/plasma name = "Solid plasma coin" icon_state = "coin_plasma" + credits = 5 /obj/item/weapon/coin/uranium name = "Uranium coin" icon_state = "coin_uranium" + credits = 25 /obj/item/weapon/coin/clown name = "Bananaium coin" icon_state = "coin_clown" + credits = 1000 /obj/item/weapon/coin/adamantine name = "Adamantine coin"