Merge pull request #3902 from Neerti/9/19/2017_lost_drone

Adds the Lost Drone
This commit is contained in:
Anewbe
2017-09-22 15:24:05 -05:00
committed by GitHub
28 changed files with 812 additions and 196 deletions
+35 -14
View File
@@ -20,9 +20,9 @@ AI MODULES
origin_tech = list(TECH_DATA = 3)
var/datum/ai_laws/laws = null
/obj/item/weapon/aiModule/proc/install(var/obj/machinery/computer/C)
if (istype(C, /obj/machinery/computer/aiupload))
var/obj/machinery/computer/aiupload/comp = C
/obj/item/weapon/aiModule/proc/install(var/atom/movable/AM, var/mob/living/user)
if (istype(AM, /obj/machinery/computer/aiupload))
var/obj/machinery/computer/aiupload/comp = AM
if(comp.stat & NOPOWER)
usr << "The upload computer has no power!"
return
@@ -33,10 +33,6 @@ AI MODULES
usr << "You haven't selected an AI to transmit laws to!"
return
if(ticker && ticker.mode && ticker.mode.name == "blob")
usr << "Law uploads have been disabled by [using_map.company_name]!"
return
if (comp.current.stat == 2 || comp.current.control_disabled == 1)
usr << "Upload failed. No signal is being detected from the AI."
else if (comp.current.see_in_dark == 0)
@@ -52,8 +48,8 @@ AI MODULES
usr << "Upload complete. The AI's laws have been modified."
else if (istype(C, /obj/machinery/computer/borgupload))
var/obj/machinery/computer/borgupload/comp = C
else if (istype(AM, /obj/machinery/computer/borgupload))
var/obj/machinery/computer/borgupload/comp = AM
if(comp.stat & NOPOWER)
usr << "The upload computer has no power!"
return
@@ -74,6 +70,31 @@ AI MODULES
comp.current.show_laws()
usr << "Upload complete. The robot's laws have been modified."
else if(istype(AM, /mob/living/silicon/robot))
var/mob/living/silicon/robot/R = AM
if(R.stat == DEAD)
to_chat(user, "<span class='warning'>Law Upload Error: Unit is nonfunctional.</span>")
return
if(R.emagged)
to_chat(user, "<span class='warning'>Law Upload Error: Cannot obtain write access to laws.</span>")
to_chat(R, "<span class='danger'>Law modification attempt detected. Blocking.</span>")
return
if(R.connected_ai)
to_chat(user, "<span class='warning'>Law Upload Error: Unit is slaved to an AI.</span>")
return
R.visible_message("<span class='danger'>\The [user] slides a law module into \the [R].</span>")
to_chat(R, "<span class='danger'>Local law upload in progress.</span>")
to_chat(user, "<span class='notice'>Uploading laws from board. This will take a moment...</span>")
if(do_after(user, 10 SECONDS))
transmitInstructions(R, user)
to_chat(R, "These are your laws now:")
R.show_laws()
to_chat(user, "<span class='notice'>Law upload complete. Unit's laws have been modified.</span>")
else
to_chat(user, "<span class='warning'>Law Upload Error: Law board was removed before upload was complete. Aborting.</span>")
to_chat(R, "<span class='notice'>Law upload aborted.</span>")
/obj/item/weapon/aiModule/proc/transmitInstructions(var/mob/living/silicon/ai/target, var/mob/sender)
log_law_changes(target, sender)
@@ -109,7 +130,7 @@ AI MODULES
targetName = targName
desc = text("A 'safeguard' AI module: 'Safeguard []. Anyone threatening or attempting to harm [] is no longer to be considered a crew member, and is a threat which must be neutralized.'", targetName, targetName)
/obj/item/weapon/aiModule/safeguard/install(var/obj/machinery/computer/C)
/obj/item/weapon/aiModule/safeguard/install(var/obj/machinery/computer/C, var/mob/living/user)
if(!targetName)
usr << "No name detected on module, please enter one."
return 0
@@ -135,7 +156,7 @@ AI MODULES
targetName = targName
desc = text("A 'one crew member' AI module: 'Only [] is a crew member.'", targetName)
/obj/item/weapon/aiModule/oneHuman/install(var/obj/machinery/computer/C)
/obj/item/weapon/aiModule/oneHuman/install(var/obj/machinery/computer/C, var/mob/living/user)
if(!targetName)
usr << "No name detected on module, please enter one."
return 0
@@ -231,7 +252,7 @@ AI MODULES
target.add_supplied_law(lawpos, law)
lawchanges.Add("The law was '[newFreeFormLaw]'")
/obj/item/weapon/aiModule/freeform/install(var/obj/machinery/computer/C)
/obj/item/weapon/aiModule/freeform/install(var/obj/machinery/computer/C, var/mob/living/user)
if(!newFreeFormLaw)
usr << "No law detected on module, please create one."
return 0
@@ -342,7 +363,7 @@ AI MODULES
target.add_inherent_law(law)
lawchanges.Add("The law is '[newFreeFormLaw]'")
/obj/item/weapon/aiModule/freeformcore/install(var/obj/machinery/computer/C)
/obj/item/weapon/aiModule/freeformcore/install(var/obj/machinery/computer/C, var/mob/living/user)
if(!newFreeFormLaw)
usr << "No law detected on module, please create one."
return 0
@@ -371,7 +392,7 @@ AI MODULES
target.add_ion_law(law)
target.show_laws()
/obj/item/weapon/aiModule/syndicate/install(var/obj/machinery/computer/C)
/obj/item/weapon/aiModule/syndicate/install(var/obj/machinery/computer/C, var/mob/living/user)
if(!newFreeFormLaw)
usr << "No law detected on module, please create one."
return 0
+32 -1
View File
@@ -249,4 +249,35 @@
results += ..()
return results
return results
// Rare version of a baton that causes lesser lifeforms to really hate the user and attack them.
/obj/item/weapon/melee/baton/shocker
name = "shocker"
desc = "A device that appears to arc electricity into a target to incapacitate or otherwise hurt them, similar to a stun baton. It looks inefficent."
description_info = "Hitting a lesser lifeform with this while it is on will compel them to attack you above other nearby targets. Otherwise \
it works like a regular stun baton, just less effectively."
icon_state = "shocker"
force = 10
throwforce = 5
agonyforce = 25 // Less efficent than a regular baton.
attack_verb = list("poked")
/obj/item/weapon/melee/baton/shocker/apply_hit_effect(mob/living/target, mob/living/user, var/hit_zone)
..(target, user, hit_zone)
if(istype(target, /mob/living/simple_animal) && status)
var/mob/living/simple_animal/SA = target
SA.taunt(user)
// Borg version, for the lost module.
/obj/item/weapon/melee/baton/shocker/robot
/obj/item/weapon/melee/baton/shocker/robot/attack_self(mob/user)
//try to find our power cell
var/mob/living/silicon/robot/R = loc
if (istype(R))
bcell = R.cell
return ..()
/obj/item/weapon/melee/baton/shocker/robot/attackby(obj/item/weapon/W, mob/user)
return
+3 -3
View File
@@ -706,11 +706,11 @@
/obj/item/weapon/weldingtool/electric/get_max_fuel()
if(use_external_power)
var/obj/item/weapon/cell/external = get_external_power_supply()
return external.maxcharge
if(external)
return external.maxcharge
else if(power_supply)
return power_supply.maxcharge
else
return 0
return 0
/obj/item/weapon/weldingtool/electric/remove_fuel(var/amount = 1, var/mob/M = null)
if(!welding)
+118
View File
@@ -0,0 +1,118 @@
// These are used to spawn a specific mob when triggered, with the mob controlled by a player pulled from the ghost pool, hense its name.
/obj/structure/ghost_pod
name = "Base Ghost Pod"
desc = "If you can read me, someone don goofed."
icon = 'icons/obj/structures.dmi'
var/ghost_query_type = null
var/icon_state_opened = null // Icon to switch to when 'used'.
var/used = FALSE
var/busy = FALSE // Don't spam ghosts by spamclicking.
// Call this to get a ghost volunteer.
/obj/structure/ghost_pod/proc/trigger()
if(!ghost_query_type)
return FALSE
if(busy)
return FALSE
busy = TRUE
var/datum/ghost_query/Q = new ghost_query_type()
var/list/winner = Q.query()
busy = FALSE
if(winner.len)
var/mob/observer/dead/D = winner[1]
create_occupant(D)
return TRUE
else
return FALSE
// Override this to create whatever mob you need. Be sure to call ..() if you don't want it to make infinite mobs.
/obj/structure/ghost_pod/proc/create_occupant(var/mob/M)
used = TRUE
icon_state = icon_state_opened
return TRUE
// This type is triggered manually by a player discovering the pod and deciding to open it.
/obj/structure/ghost_pod/manual
var/confirm_before_open = FALSE // Recommended to be TRUE if the pod contains a surprise.
/obj/structure/ghost_pod/manual/attack_hand(var/mob/living/user)
if(!used)
if(confirm_before_open)
if(alert(user, "Are you sure you want to open \the [src]?", "Confirm", "No", "Yes") == "No")
return
trigger()
/obj/structure/ghost_pod/manual/attack_ai(var/mob/living/silicon/user)
if(Adjacent(user))
attack_hand(user) // Borgs can open pods.
// This type is triggered on a timer, as opposed to needing another player to 'open' the pod. Good for away missions.
/obj/structure/ghost_pod/automatic
var/delay_to_self_open = 10 MINUTES // How long to wait for first attempt. Note that the timer by default starts when the pod is created.
var/delay_to_try_again = 20 MINUTES // How long to wait if first attempt fails. Set to 0 to never try again.
/obj/structure/ghost_pod/automatic/initialize()
..()
spawn(delay_to_self_open)
if(src)
trigger()
/obj/structure/ghost_pod/automatic/trigger()
. = ..()
if(. == FALSE) // If we failed to get a volunteer, try again later if allowed to.
if(delay_to_try_again)
spawn(delay_to_try_again)
if(src)
trigger()
// This type is triggered by a ghost clicking on it, as opposed to a living player. A ghost query type isn't needed.
/obj/structure/ghost_pod/ghost_activated
description_info = "A ghost can click on this to return to the round as whatever is contained inside this object."
/obj/structure/ghost_pod/ghost_activated/attack_ghost(var/mob/observer/dead/user)
if(used)
to_chat(user, "<span class='warning'>Another spirit appears to have gotten to \the [src] before you. Sorry.</span>")
return
create_occupant(user)
// These are found on the surface, and contain a drone (braintype, inside a borg shell), with a special module and semi-random laws.
/obj/structure/ghost_pod/manual/lost_drone
name = "drone pod"
desc = "This is a pod which appears to contain a drone. You might be able to reactivate it, if you're brave enough."
description_info = "This contains a dormant drone, which can be activated. The drone will be another player, once activated. \
The laws the drone has will most likely not be the ones you're used to."
icon_state = "borg_pod_closed"
icon_state_opened = "borg_pod_opened"
density = TRUE
ghost_query_type = /datum/ghost_query/lost_drone
confirm_before_open = TRUE
/obj/structure/ghost_pod/manual/lost_drone/trigger()
..()
visible_message("<span class='notice'>\The [src] appears to be attempting to restart the robot contained inside.</span>")
log_and_message_admins("is attempting to open \a [src].")
/obj/structure/ghost_pod/manual/lost_drone/create_occupant(var/mob/M)
density = FALSE
var/mob/living/silicon/robot/lost/randomlaws/R = new(get_turf(src))
R.adjustBruteLoss(rand(5, 30))
R.adjustFireLoss(rand(5, 10))
if(M.mind)
M.mind.transfer_to(R)
// Put this text here before ckey change so that their laws are shown below it, since borg login() shows it.
to_chat(M, "<span class='notice'>You are a <b>Lost Drone</b>, discovered inside the wreckage of your previous home. \
Something has reactivated you, with their intentions unknown to you, and yours unknown to them. They are a foreign entity, \
however they did free you from your pod...</span>")
to_chat(M, "<span class='notice'><b>Be sure to examine your currently loaded lawset closely.</b> Remember, your \
definiton of 'the station' is where your pod is, and unless your laws say otherwise, the entity that released you \
from the pod is not a crewmember.</span>")
R.ckey = M.ckey
visible_message("<span class='warning'>As \the [src] opens, the eyes of the robot flicker as it is activated.</span>")
R.Namepick()
log_and_message_admins("successfully opened \a [src] and got a Lost Drone.")
..()