Part two of the objective system. Also fixed up AIs on the shuttle, bug #747, and interacting with windows.

This commit is contained in:
SkyMarshal
2012-03-25 00:33:38 -07:00
parent 09546b7fe0
commit a5a7df1c20
10 changed files with 176 additions and 123 deletions

View File

@@ -12,7 +12,8 @@
if(!istype(target, /obj/machinery/light))
return
var/obj/machinery/light/L = target
if(L.stat > 1) //Burned or broke
L.stat = 0
if(L.status > 1) //Burned or broke
L.status = 0
L.update()
user.visible_message("[user] repairs \the [target] on the spot with their [src]!","You repair the lightbulb!")
return

View File

@@ -367,8 +367,7 @@ datum/mind
new_objective.owner = src
if ("steal")
var/steal_type = pick(GetObjectives(assigned_role,src))
new_objective = new steal_type
new_objective = pick(GenerateTheft(assigned_role,src))
new_objective.owner = src
if("download","capture","absorb")

View File

@@ -782,9 +782,6 @@ var/using_new_click_proc = 0 //TODO ERRORAGE (This is temporary, while the DblCl
ok = (check_1 || check_2)
if(check_1 || check_2)
ok = 1
// ------- YOU CAN REACH THE ITEM THROUGH AT LEAST ONE OF THE TWO DIRECTIONS. GOOD. -------
/*
@@ -914,7 +911,7 @@ var/using_new_click_proc = 0 //TODO ERRORAGE (This is temporary, while the DblCl
return
proc/CanReachThrough(turf/srcturf, turf/targetturf, atom/target)
/proc/CanReachThrough(turf/srcturf, turf/targetturf, atom/target)
var/obj/item/weapon/dummy/D = new /obj/item/weapon/dummy( srcturf )
if(targetturf.density && targetturf != get_turf(target))
@@ -929,7 +926,7 @@ proc/CanReachThrough(turf/srcturf, turf/targetturf, atom/target)
//Next, check objects to block entry that are on the border
for(var/obj/border_obstacle in targetturf)
if((border_obstacle.flags & ON_BORDER) && (src != border_obstacle))
if((border_obstacle.flags & ON_BORDER) && (target != border_obstacle))
if(!border_obstacle.CanPass(D, srcturf, 1, 0))
del D
return 0

View File

@@ -241,10 +241,9 @@ In either case, it's a good idea to spawn the ninja with a semi-random set of ob
hostile_targets -= current_mind//Remove them from the list.
if(2)//Steal
var/datum/objective/steal/ninja_objective = new
var/target_item = pick(ninja_objective.possible_items_special)
ninja_objective.set_target(target_item)
ninja_mind.objectives += ninja_objective
var/list/datum/objective/theft = GenerateTheft(ninja_mind.assigned_role,ninja_mind)
var/datum/objective/steal/steal_objective = pick(theft)
ninja_mind.objectives += steal_objective
objective_list -= 2
if(3)//Protect. Keeping people alive can be pretty difficult.

View File

@@ -101,7 +101,8 @@
if(46 to 90)
var/datum/objective/steal/steal_objective = new pick(GetObjectives(changeling.assigned_role,changeling))
var/list/datum/objective/theft = GenerateTheft(changeling.assigned_role,changeling)
var/datum/objective/steal/steal_objective = pick(theft)
steal_objective.owner = changeling
changeling.objectives += steal_objective
@@ -117,7 +118,8 @@
kill_objective.find_target()
changeling.objectives += kill_objective
var/datum/objective/steal/steal_objective = new pick(GetObjectives(changeling.assigned_role,changeling))
var/list/datum/objective/theft = GenerateTheft(changeling.assigned_role,changeling)
var/datum/objective/steal/steal_objective = pick(theft)
steal_objective.owner = changeling
changeling.objectives += steal_objective

View File

@@ -39,7 +39,7 @@
/proc/SelectObjectives(var/job,var/datum/mind/traitor,var/hijack = 0)
var/list/datum/objective/chosenobjectives = list()
var/list/datum/objective/theftobjectives = GetObjectives(job,traitor) //Separated all the objective types so they can be picked independantly of each other.
var/list/datum/objective/theftobjectives = GenerateTheft(job,traitor) //Separated all the objective types so they can be picked independantly of each other.
var/list/datum/objective/killobjectives = GenerateAssassinate(job,traitor)
var/list/datum/objective/frameobjectives = GenerateFrame(job,traitor)
var/list/datum/objective/protectobjectives = GenerateProtection(job,traitor)
@@ -56,31 +56,57 @@
totalweight += objective.weight
theftobjectives -= objective
else switch(selectobj)
if(1 to 50) //Theft Objectives (50% chance)
if(1 to 55) //Theft Objectives (55% chance)
var/datum/objective/objective = pick(theftobjectives)
for(1 to 10)
if(objective.weight + totalweight <= 110)
break
objective = pick(theftobjectives)
chosenobjectives += objective
totalweight += objective.weight
theftobjectives -= objective
if(51 to 87) //Assassination Objectives (37% chance)
if(56 to 92) //Assassination Objectives (37% chance)
var/datum/objective/assassinate/objective = pick(killobjectives)
for(1 to 10)
if(objective.weight + totalweight <= 110)
break
objective = pick(killobjectives)
for(var/datum/objective/protection/conflicttest in chosenobjectives) //Check to make sure we aren't telling them to Assassinate somebody they need to Protect.
if(conflicttest.target == objective.target)
conflict = 1
break
for(var/datum/objective/frame/conflicttest in chosenobjectives) //Check to make sure we aren't telling them to Protect somebody they need to Assassinate.
if(conflicttest.target == objective.target)
conflict = 1
break
if(!conflict)
chosenobjectives += objective
totalweight += objective.weight
killobjectives -= objective
conflict = 0
if(88 to 90) //Framing Objectives (3% chance)
if(93 to 95) //Framing Objectives (3% chance)
var/datum/objective/objective = pick(frameobjectives)
for(1 to 10)
if(objective.weight + totalweight <= 110)
break
objective = pick(frameobjectives)
chosenobjectives += objective
totalweight += objective.weight
frameobjectives -= objective
if(91 to 100) //Protection Objectives (5% chance)
if(96 to 100) //Protection Objectives (5% chance)
var/datum/objective/protection/objective = pick(protectobjectives)
for(1 to 10)
if(objective.weight + totalweight <= 110)
break
objective = pick(protectobjectives)
for(var/datum/objective/assassinate/conflicttest in chosenobjectives) //Check to make sure we aren't telling them to Protect somebody they need to Assassinate.
if(conflicttest.target == objective.target)
conflict = 1
break
for(var/datum/objective/frame/conflicttest in chosenobjectives) //Check to make sure we aren't telling them to Protect somebody they need to Assassinate.
if(conflicttest.target == objective.target)
conflict = 1
break
if(!conflict)
chosenobjectives += objective
totalweight += objective.weight
@@ -105,6 +131,7 @@
datum
objective
var/datum/mind/owner
var/datum/mind/target
var/explanation_text = "text not set"
var/job
// var/points = INFINITY //If this isn't set to something else, the objective is bugged and should be ignored
@@ -116,16 +143,18 @@ datum
job=joba
weight = get_points(job)
proc
check_completion()
proc/check_completion()
return 1
get_points(var/job)
proc/get_points(var/job)
return INFINITY
proc/find_target_by_role(role, role_type=0)//Option sets either to check assigned role or special role. Default to assigned.
for(var/datum/mind/possible_target in ticker.minds)
if((possible_target != owner) && ishuman(possible_target.current) && ((role_type ? possible_target.special_role : possible_target.assigned_role) == role) )
target = possible_target
break
frame
var/datum/mind/target
New(var/text,var/joba,var/datum/mind/targeta)
target = targeta
job = joba
@@ -150,7 +179,7 @@ datum
get_points()
if(target)
switch(GetRank(owner.assigned_role))
switch(GetRank(job))
if(4)
return 30
if(3)
@@ -166,7 +195,6 @@ datum
protection
var/datum/mind/target
New(var/text,var/joba,var/datum/mind/targeta)
target = targeta
job = joba
@@ -192,9 +220,16 @@ datum
get_points()
return 30
find_target_by_role(role, role_type=0)
..(role, role_type)
if(target && target.current)
explanation_text = "Protect [target.current.real_name], the [target.role_alt_title ? target.role_alt_title : (!role_type ? target.assigned_role : target.special_role)]."
else
explanation_text = "Free Objective"
return target
assassinate
var/datum/mind/target
New(var/text,var/joba,var/datum/mind/targeta)
target = targeta
@@ -212,7 +247,7 @@ datum
return 1
get_points()
if(target)
switch(GetRank(owner.assigned_role))
switch(GetRank(job))
if(4)
return 30
if(3)
@@ -226,7 +261,7 @@ datum
else
return 0
proc/find_target_by_role(var/role)
find_target_by_role(var/role)
for(var/datum/mind/possible_target in ticker.minds)
if((possible_target != owner) && istype(possible_target.current, /mob/living/carbon/human) && (possible_target.assigned_role == role))
target = possible_target
@@ -259,7 +294,6 @@ datum
capture
var/datum/mind/target
var/separation_time = 0
var/almost_complete = 0
@@ -278,7 +312,7 @@ datum
else if(config.require_heads_alive) return 0
return 1
proc/find_target_by_role(var/role)
find_target_by_role(var/role)
for(var/datum/mind/possible_target in ticker.minds)
if((possible_target != owner) && istype(possible_target.current, /mob/living/carbon/human) && (possible_target.assigned_role == role))
target = possible_target
@@ -367,7 +401,7 @@ datum
survive
explanation_text = "Stay alive until the end."
explanation_text = "Stay alive."
check_completion()
if(!owner.current || owner.current.stat == 2)
@@ -414,9 +448,9 @@ datum
weight = 20
get_points(var/job)
if(job in science_positions)
return 10
if(job in science_positions || job in command_positions)
return 20
return 40
/*Removing this as an objective. Not necessary to have two theft objectives in the same room.
@@ -456,7 +490,7 @@ datum
if(3)
return 30
if(4)
return 10
return 20
RCD
@@ -475,10 +509,10 @@ datum
if(3)
return 30
if(4)
return 10
return 20
burger
/*burger
steal_target = /obj/item/weapon/reagent_containers/food/snacks/human/burger
explanation_text = "Steal a burger made out of human organs, this will be presented as proof of NanoTrasen's chronic lack of standards."
weight = 60
@@ -486,20 +520,20 @@ datum
get_points(var/job)
switch(GetRank(job))
if(0)
return 75
return 80
if(1)
return 60
return 65
if(2)
return 50
return 55
if(3)
return 30
return 40
if(4)
return 10
return 25*/
jetpack
steal_target = /obj/item/weapon/tank/jetpack
explanation_text = "Steal a jetpack.."
explanation_text = "Steal a jetpack."
weight = 20
get_points(var/job)
@@ -513,12 +547,12 @@ datum
if(3)
return 30
if(4)
return 10
return 20
magboots
steal_target = /obj/item/clothing/shoes/magboots
explanation_text = "Steal a pair of NanoTrasen brand magboots. They're better than ours."
explanation_text = "Steal a pair of \"NanoTrasen\" brand magboots."
weight = 20
get_points(var/job)
@@ -532,12 +566,12 @@ datum
if(3)
return 30
if(4)
return 10
return 20
blueprints
steal_target = /obj/item/blueprints
explanation_text = "Steal the station's blueprints, for use by our \"demolition\" crews."
explanation_text = "Steal the station's blueprints."
weight = 20
get_points(var/job)
@@ -551,12 +585,12 @@ datum
if(3)
return 30
if(4)
return 10
return 20
voidsuit
steal_target = /obj/item/clothing/suit/space/nasavoid
explanation_text = "Steal a voidsuit. Supposedly, these suits are better functioning than any produced today."
explanation_text = "Steal a voidsuit."
weight = 20
get_points(var/job)
@@ -570,12 +604,12 @@ datum
if(3)
return 30
if(4)
return 10
return 20
nuke_disk
steal_target = /obj/item/weapon/disk/nuclear
explanation_text = "Steal the station's nuclear authentication disk. We need it for... things. *cough*"
explanation_text = "Steal the station's nuclear authentication disk."
weight = 20
get_points(var/job)
@@ -593,7 +627,7 @@ datum
nuke_gun
steal_target = /obj/item/weapon/gun/energy/gun/nuclear
explanation_text = "Steal a nuclear powered gun. We may be able to get the upper hand..."
explanation_text = "Steal a nuclear powered gun."
weight = 20
get_points(var/job)
@@ -601,17 +635,17 @@ datum
if(0)
return 90
if(1)
return 80
return 85
if(2)
return 70
return 80
if(3)
return 50
return 75
if(4)
return 40
return 75
diamond_drill
steal_target = /obj/item/weapon/pickaxe/diamonddrill
explanation_text = "Steal a diamond drill. All the better to drill through a hull with, eh?"
explanation_text = "Steal a diamond drill."
weight = 20
get_points(var/job)
@@ -619,17 +653,17 @@ datum
if(0)
return 90
if(1)
return 80
return 85
if(2)
return 70
if(3)
return 50
return 75
if(4)
return 40
return 75
boh
steal_target = /obj/item/weapon/storage/backpack/holding
explanation_text = "Steal a \"bag of holding.\" Apparently these things are extremely dangerous..."
explanation_text = "Steal a \"bag of holding.\""
weight = 20
get_points(var/job)
@@ -637,17 +671,17 @@ datum
if(0)
return 90
if(1)
return 80
return 85
if(2)
return 70
return 80
if(3)
return 50
return 75
if(4)
return 40
return 75
hyper_cell
steal_target = /obj/item/weapon/cell/hyper
explanation_text = "Steal a hyper capacity power cell. Our head researcher is drooling at the thought of it."
explanation_text = "Steal a hyper capacity power cell."
weight = 20
get_points(var/job)
@@ -655,67 +689,91 @@ datum
if(0)
return 90
if(1)
return 80
return 85
if(2)
return 70
return 80
if(3)
return 50
return 75
if(4)
return 40
return 75
lucy
steal_target = /obj/item/stack/sheet/diamond
explanation_text = "Steal 10 diamonds. It's not for an engagement ring, why do you ask?"
explanation_text = "Steal 10 diamonds."
weight = 20
get_points(var/job)
switch(GetRank(job))
if(0)
return 80
return 90
if(1)
return 70
return 85
if(2)
return 55
return 80
if(3)
return 40
return 75
if(4)
return 20
return 75
check_completion()
var/target_amount = 10
var/found_amount = 0.0//Always starts as zero.
for(var/obj/item/I in owner.current.get_contents())
if(!istype(I, steal_target)) continue//If it's not actually that item.
found_amount += I:amount
return found_amount>=target_amount
gold
steal_target = /obj/item/stack/sheet/gold
explanation_text = "Steal 50 gold bars. We need the cash."
explanation_text = "Steal 50 gold bars."
weight = 20
get_points(var/job)
switch(GetRank(job))
if(0)
return 80
return 90
if(1)
return 70
return 85
if(2)
return 55
return 80
if(3)
return 40
return 75
if(4)
return 20
return 70
check_completion()
var/target_amount = 50
var/found_amount = 0.0//Always starts as zero.
for(var/obj/item/I in owner.current.get_contents())
if(!istype(I, steal_target)) continue//If it's not actually that item.
found_amount += I:amount
return found_amount>=target_amount
uranium
steal_target = /obj/item/stack/sheet/uranium
explanation_text = "Steal 25 enriched uranium bars... no reason, we swear!"
explanation_text = "Steal 25 uranium bars."
weight = 20
get_points(var/job)
switch(GetRank(job))
if(0)
return 80
return 90
if(1)
return 70
return 85
if(2)
return 55
return 80
if(3)
return 40
return 75
if(4)
return 20
return 70
check_completion()
var/target_amount = 25
var/found_amount = 0.0//Always starts as zero.
for(var/obj/item/I in owner.current.get_contents())
if(!istype(I, steal_target)) continue//If it's not actually that item.
found_amount += I:amount
return found_amount>=target_amount
/*Needs some work before it can be put in the game to differentiate ship implanters from syndicate implanters.
@@ -753,7 +811,7 @@ datum
if(3)
return 30
if(4)
return 10
return 20
check_completion()
if(steal_target)
@@ -763,7 +821,7 @@ datum
return 0
AI
steal_target = /obj/structure/AIcore
explanation_text = "Steal a finished AI Construct (with brain)"
explanation_text = "Steal a finished AI, either by intellicard or stealing the whole construct."
weight = 50
get_points(var/job)
@@ -777,7 +835,7 @@ datum
if(3)
return 30
if(4)
return 10
return 20
check_completion()
if(steal_target)
@@ -797,7 +855,7 @@ datum
drugs
steal_target = /datum/reagent/space_drugs
explanation_text = "Steal some space drugs"
explanation_text = "Steal some space drugs."
weight = 40
get_points(var/job)
@@ -811,7 +869,7 @@ datum
if(3)
return 30
if(4)
return 10
return 20
check_completion()
if(steal_target)
@@ -823,7 +881,7 @@ datum
pacid
steal_target = /datum/reagent/pacid
explanation_text = "Steal some polytrinic acid"
explanation_text = "Steal some polytrinic acid."
weight = 40
get_points(var/job)
@@ -837,7 +895,7 @@ datum
if(3)
return 30
if(4)
return 10
return 20
check_completion()
if(steal_target)
@@ -849,8 +907,8 @@ datum
reagent
var/target_name
var/reagent_name
proc/find_target()
New(var/text,var/joba)
..()
var/list/items = list("Sulphuric acid", "Polytrinic acid", "Space Lube", "Unstable mutagen",\
"Leporazine", "Cryptobiolin", "Lexorin ",\
"Kelotane", "Dexalin", "Tricordrazine")
@@ -879,8 +937,6 @@ datum
explanation_text = "Steal a container filled with [target_name]."
return steal_target
get_points(var/job)
switch(GetRank(job))
if(0)
@@ -892,7 +948,7 @@ datum
if(3)
return 30
if(4)
return 10
return 20
check_completion()
if(steal_target)
@@ -928,7 +984,6 @@ datum
return 1
decapitate
var/datum/mind/target
proc/find_target()
..()
if(target && target.current)
@@ -938,7 +993,7 @@ datum
return target
proc/find_target_by_role(role, role_type=0)
find_target_by_role(role, role_type=0)
..(role, role_type)
if(target && target.current)
explanation_text = "[target.current.real_name], the [target.role_alt_title ? target.role_alt_title : (!role_type ? target.assigned_role : target.special_role)], has defied us for the last time. Make an example of him, and bring us his severed head."
@@ -1011,7 +1066,6 @@ datum
debrain//I want braaaainssss
var/datum/mind/target
proc/find_target()
..()
if(target && target.current)
@@ -1021,7 +1075,7 @@ datum
return target
proc/find_target_by_role(role, role_type=0)
find_target_by_role(role, role_type=0)
..(role, role_type)
if(target && target.current)
explanation_text = "Steal the brain of [target.current.real_name] the [target.role_alt_title ? target.role_alt_title : (!role_type ? target.assigned_role : target.special_role)]."
@@ -1043,7 +1097,6 @@ datum
return 0
mutiny
var/datum/mind/target
proc/find_target()
..()
if(target && target.current)
@@ -1053,7 +1106,7 @@ datum
return target
proc/find_target_by_role(role, role_type=0)
find_target_by_role(role, role_type=0)
..(role, role_type)
if(target && target.current)
explanation_text = "Assassinate [target.current.real_name], the [target.role_alt_title ? target.role_alt_title : (!role_type ? target.assigned_role : target.special_role)]."

View File

@@ -88,7 +88,9 @@
traitor.objectives += block_objective
else
traitor.objectives = SelectObjectives(traitor.assigned_role, traitor)
for(var/datum/objective/o in SelectObjectives((traitor.current:wear_id ? traitor.current:wear_id:assignment : traitor.assigned_role), traitor))
o.owner = traitor
traitor.objectives += o
return

View File

@@ -6,7 +6,7 @@
var/list/authorized = list( )
/* attackby(var/obj/item/weapon/card/W as obj, var/mob/user as mob)
attackby(var/obj/item/weapon/card/W as obj, var/mob/user as mob)
if(stat & (BROKEN|NOPOWER)) return
if ((!( istype(W, /obj/item/weapon/card) ) || !( ticker ) || emergency_shuttle.location != 1 || !( user ))) return
if (istype(W, /obj/item/weapon/card/id)||istype(W, /obj/item/device/pda))
@@ -14,23 +14,23 @@
var/obj/item/device/pda/pda = W
W = pda.id
if (!W:access) //no access
user << "The access level of [W:registered]\'s card is not high enough. "
user << "The access level of [W:registered_name]\'s card is not high enough. "
return
var/list/cardaccess = W:access
if(!istype(cardaccess, /list) || !cardaccess.len) //no access
user << "The access level of [W:registered]\'s card is not high enough. "
user << "The access level of [W:registered_name]\'s card is not high enough. "
return
if(!(access_heads in W:access)) //doesn't have this access
user << "The access level of [W:registered]\'s card is not high enough. "
user << "The access level of [W:registered_name]\'s card is not high enough. "
return 0
var/choice = alert(user, text("Would you like to (un)authorize a shortened launch time? [] authorization\s are still needed. Use abort to cancel all authorizations.", src.auth_need - src.authorized.len), "Shuttle Launch", "Authorize", "Repeal", "Abort")
switch(choice)
if("Authorize")
src.authorized -= W:registered
src.authorized += W:registered
src.authorized -= W:registered_name
src.authorized += W:registered_name
if (src.auth_need - src.authorized.len > 0)
message_admins("[key_name_admin(user)] has authorized early shuttle launch")
log_game("[user.ckey] has authorized early shuttle launch")
@@ -45,7 +45,7 @@
src.authorized = list( )
if("Repeal")
src.authorized -= W:registered
src.authorized -= W:registered_name
world << text("\blue <B>Alert: [] authorizations needed until shuttle is launched early</B>", src.auth_need - src.authorized.len)
if("Abort")
@@ -53,12 +53,12 @@
src.authorized.len = 0
src.authorized = list( )
else if (istype(W, /obj/item/weapon/card/emag))
/* else if (istype(W, /obj/item/weapon/card/emag))
var/choice = alert(user, "Would you like to launch the shuttle?","Shuttle control", "Launch", "Cancel")
switch(choice)
if("Launch")
world << "\blue <B>Alert: Shuttle launch time shortened to 10 seconds!</B>"
emergency_shuttle.settimeleft( 10 )
if("Cancel")
return
return*/
return

View File

@@ -106,7 +106,7 @@
src.see_in_dark = 0
src.see_invisible = 0
if (((!loc.master.power_equip) || istype(T, /turf/space)) && !istype(src.loc,/obj/item))
if (((!loc.master.power_equip) || istype(T, /turf/space)) && !istype(src.loc,/obj/item) && !istype(get_area(src), /area/shuttle))
if (src:aiRestorePowerRoutine==0)
src:aiRestorePowerRoutine = 1

View File

@@ -109,7 +109,7 @@
else // Any other
A.yo = -20
A.xo = 0
A.process()
A.fired()
attackby(obj/item/W, mob/user)