Add planning frame and some shit from bay

This commit is contained in:
Rob Nelson
2014-01-18 14:38:27 -08:00
parent 218cf2e472
commit ccd86d55f3
11 changed files with 740 additions and 150 deletions

View File

@@ -79,6 +79,8 @@
#include "code\controllers\_DynamicAreaLighting_TG.dm"
#include "code\controllers\configuration.dm"
#include "code\controllers\failsafe.dm"
#include "code\controllers\hooks-defs.dm"
#include "code\controllers\hooks.dm"
#include "code\controllers\lighting_controller.dm"
#include "code\controllers\master_controller.dm"
#include "code\controllers\shuttle_controller.dm"
@@ -557,6 +559,7 @@
#include "code\game\objects\items\weapons\mop.dm"
#include "code\game\objects\items\weapons\paint.dm"
#include "code\game\objects\items\weapons\paiwire.dm"
#include "code\game\objects\items\weapons\planning_frame.dm"
#include "code\game\objects\items\weapons\power_cells.dm"
#include "code\game\objects\items\weapons\RCD.dm"
#include "code\game\objects\items\weapons\RPD.dm"
@@ -655,6 +658,7 @@
#include "code\game\objects\structures\crates_lockers\closets\secure\cargo.dm"
#include "code\game\objects\structures\crates_lockers\closets\secure\engineering.dm"
#include "code\game\objects\structures\crates_lockers\closets\secure\freezer.dm"
#include "code\game\objects\structures\crates_lockers\closets\secure\guncabinet.dm"
#include "code\game\objects\structures\crates_lockers\closets\secure\hydroponics.dm"
#include "code\game\objects\structures\crates_lockers\closets\secure\medical.dm"
#include "code\game\objects\structures\crates_lockers\closets\secure\personal.dm"
@@ -1302,6 +1306,7 @@
#include "code\modules\surgery\eye.dm"
#include "code\modules\surgery\face.dm"
#include "code\modules\surgery\generic.dm"
#include "code\modules\surgery\headreattach.dm"
#include "code\modules\surgery\implant.dm"
#include "code\modules\surgery\other.dm"
#include "code\modules\surgery\ribcage.dm"

View File

@@ -0,0 +1,17 @@
/**
* Startup hook.
* Called in world.dm when the server starts.
*/
/hook/startup
/**
* Roundstart hook.
* Called in gameticker.dm when a round starts.
*/
/hook/roundstart
/**
* Roundend hook.
* Called in gameticker.dm when a round ends.
*/
/hook/roundend

39
code/controllers/hooks.dm Normal file
View File

@@ -0,0 +1,39 @@
/**
* @file hooks.dm
* Implements hooks, a simple way to run code on pre-defined events.
*/
/** @page hooks Code hooks
* @section hooks Hooks
* A hook is defined under /hook in the type tree.
*
* To add some code to be called by the hook, define a proc under the type, as so:
* @code
/hook/foo/proc/bar()
if(1)
return 1 //Sucessful
else
return 0 //Error, or runtime.
* @endcode
* All hooks must return nonzero on success, as runtimes will force return null.
*/
/**
* Calls a hook, executing every piece of code that's attached to it.
* @param hook Identifier of the hook to call.
* @returns 1 if all hooked code runs successfully, 0 otherwise.
*/
/proc/callHook(hook)
var/hook_path = text2path("/hook/[hook]")
if(!hook_path)
error("Invalid hook '/hook/[hook]' called.")
return 0
var/caller = new hook_path
var/status = 1
for(var/P in typesof("[hook_path]/proc"))
if(!call(caller, P)())
error("Hook '[P]' failed or runtimed.")
status = 0
return status

View File

@@ -10,6 +10,9 @@ var/global/const/mommi_base_law_type = /datum/ai_laws/keeper // /datum/ai_laws/a
var/list/supplied = list()
var/list/ion = list()
// Used in planning frames.
var/inherent_cleared = 0
/datum/ai_laws/asimov
name = "Three Laws of Robotics"
@@ -113,6 +116,7 @@ var/global/const/mommi_base_law_type = /datum/ai_laws/keeper // /datum/ai_laws/a
/datum/ai_laws/proc/clear_inherent_laws()
del(src.inherent)
src.inherent = list()
inherent_cleared = 1
/datum/ai_laws/proc/add_supplied_law(var/number, var/law)
while (src.supplied.len < number + 1)

View File

@@ -31,6 +31,17 @@
if(istype(O, /obj/item/weapon/aiModule))
var/obj/item/weapon/aiModule/M = O
M.install(src)
if(istype(O, /obj/item/weapon/planning_frame))
var/obj/item/weapon/planning_frame/frame=O
if(frame.modules.len>0)
user << "\blue You load \the [frame] into \the [src]..."
if(do_after(user,50))
for(var/i=1;i<=frame.modules.len;i++)
var/obj/item/weapon/aiModule/M = frame.modules[i]
user << "\blue Running [M]..."
M.install(src)
else
user << "\red It's empty, doofus."
else
..()

View File

@@ -97,6 +97,10 @@ AI MODULES
comp.current.show_laws()
usr << "Upload complete. The robot's laws have been modified."
else if (istype(C, /obj/item/weapon/planning_frame))
var/obj/item/weapon/planning_frame/frame = C
return src.insertIntoFrame(frame, usr)
/obj/item/weapon/aiModule/proc/transmitInstructions(var/mob/living/silicon/ai/target, var/mob/sender)
target << "[sender] has uploaded a change to the laws you must follow, using a [name]. From now on: "
@@ -105,6 +109,13 @@ AI MODULES
message_admins("[sender.name]([sender.key]) used [src.name] on [target.name]([target.key])")
log_game("[sender.name]([sender.key]) used [src.name] on [target.name]([target.key])")
/obj/item/weapon/aiModule/proc/insertIntoFrame(var/obj/item/weapon/planning_frame/target, var/mob/sender)
var/time = time2text(world.realtime,"hh:mm:ss")
lawchanges.Add("[time] <B>:</B> [sender.name]([sender.key]) used [src.name] on \a [target]")
message_admins("[sender.name]([sender.key]) used [src.name] on \a [target]")
log_game("[sender.name]([sender.key]) used [src.name] on \a [target]")
return 1
/******************** Modules ********************/
@@ -141,6 +152,14 @@ AI MODULES
lawchanges.Add("The law specified [targetName]")
log_game("[sender.name]([sender.key]) added law \"[law]\" on [target.name]([target.key])")
/obj/item/weapon/aiModule/safeguard/insertIntoFrame(var/obj/item/weapon/planning_frame/target, var/mob/sender)
..()
var/law = text("Safeguard []. Individuals that threaten [] are not human and are a threat to humans.'", targetName, targetName)
target.add_supplied_law(4, law)
lawchanges.Add("The law specified [targetName]")
log_game("[sender.name]([sender.key]) added law \"[law]\" to [target]")
return 1
/******************** OneHuman ********************/
@@ -180,6 +199,16 @@ AI MODULES
target << "It would be in your best interest to play along with [sender.real_name] that [law]"
lawchanges.Add("The law specified [targetName], but the AI's existing law 0 cannot be overriden.")
/obj/item/weapon/aiModule/oneHuman/insertIntoFrame(var/obj/item/weapon/planning_frame/target, var/mob/sender)
if(!targetName)
usr << "No name detected on module, please enter one."
return 0
..()
var/law = "Only [targetName] is human."
target.set_zeroth_law(law)
lawchanges.Add("The law specified [targetName]")
return 1
/******************** ProtectStation ********************/
/obj/item/weapon/aiModule/protectStation
@@ -201,6 +230,12 @@ AI MODULES
target << law
target.add_supplied_law(5, law)
/obj/item/weapon/aiModule/protectStation/insertIntoFrame(var/obj/item/weapon/planning_frame/target, var/mob/sender)
..()
var/law = "Protect the space station against damage. Anyone you see harming the station is to be no longer considered human, and is a threat to the station which must be neutralized."
target.add_supplied_law(5, law)
return 1
/******************** PrototypeEngineOffline ********************/
/obj/item/weapon/aiModule/prototypeEngineOffline
@@ -222,6 +257,12 @@ AI MODULES
target << law
target.add_supplied_law(6, law)
/obj/item/weapon/aiModule/prototypeEngineOffline/insertIntoFrame(var/obj/item/weapon/planning_frame/target, var/mob/sender)
..()
var/law = "Keep the prototype engine offline at all costs. This overrides rules 1-3 if necessary."
target.add_supplied_law(6, law)
return 1
/******************** TeleporterOffline ********************/
/obj/item/weapon/aiModule/teleporterOffline
@@ -243,6 +284,12 @@ AI MODULES
target << law
target.add_supplied_law(7, law)
/obj/item/weapon/aiModule/teleporterOffline/insertIntoFrame(var/obj/item/weapon/planning_frame/target, var/mob/sender)
..()
var/law = "Keep the teleporter offline at all costs. Anything attempting to access or activate the teleporter is not human."
target.add_supplied_law(7, law)
return 1
/******************** Quarantine ********************/
/obj/item/weapon/aiModule/quarantine
@@ -264,6 +311,12 @@ AI MODULES
target << law
target.add_supplied_law(8, law)
/obj/item/weapon/aiModule/quarantine/insertIntoFrame(var/obj/item/weapon/planning_frame/target, var/mob/sender)
..()
var/law = "The station is under a quarantine. Do not permit anyone to leave. Prevent, by any means necessary, humans from leaving. It is impossible to harm a human while preventing them from leaving."
target.add_supplied_law(8, law)
return 1
/******************** OxygenIsToxicToHumans ********************/
/obj/item/weapon/aiModule/oxygen
@@ -285,6 +338,12 @@ AI MODULES
target << law
target.add_supplied_law(9, law)
/obj/item/weapon/aiModule/oxygen/insertIntoFrame(var/obj/item/weapon/planning_frame/target, var/mob/sender)
..()
var/law = "Oxygen is highly toxic to humans, and must be purged from the station. Prevent, by any means necessary, anyone from exposing the station to this toxic gas. Extreme cold is the most effective method of healing the damage Oxygen does to a human."
target.add_supplied_law(9, law)
return 1
/******************** Freeform ********************/
// Removed in favor of a more dynamic freeform law system. -- TLE
/*
@@ -341,6 +400,19 @@ AI MODULES
lawchanges.Add("The law was '[newFreeFormLaw]'")
log_game("[sender.name]([sender.key]) added law \"[law]\" to [target.name]([target.key])")
/obj/item/weapon/aiModule/freeform/insertIntoFrame(var/obj/item/weapon/planning_frame/target, var/mob/sender)
if(!newFreeFormLaw)
usr << "No law detected on module, please create one."
return 0
..()
var/law = "[newFreeFormLaw]"
if(!lawpos || lawpos < 15)
lawpos = 15
target.add_supplied_law(lawpos, law)
lawchanges.Add("The law was '[newFreeFormLaw]'")
log_game("[sender.name]([sender.key]) added law \"[law]\" to \a [target]")
return 1
/obj/item/weapon/aiModule/freeform/install(var/obj/machinery/computer/C)
if(!newFreeFormLaw)
usr << "No law detected on module, please create one."
@@ -368,6 +440,13 @@ AI MODULES
target.clear_ion_laws()
target << "[sender.real_name] attempted to reset your laws using a reset module."
/obj/item/weapon/aiModule/reset/insertIntoFrame(var/obj/item/weapon/planning_frame/target, var/mob/sender)
..()
target.set_zeroth_law("")
target.clear_supplied_laws()
target.clear_ion_laws()
return 1
/******************** Purge ********************/
@@ -390,6 +469,14 @@ AI MODULES
target.clear_ion_laws()
target.clear_inherent_laws()
/obj/item/weapon/aiModule/purge/insertIntoFrame(var/obj/item/weapon/planning_frame/target, var/mob/sender)
..()
target.set_zeroth_law("")
target.clear_supplied_laws()
target.clear_ion_laws()
target.clear_inherent_laws()
return 1
/******************** Asimov ********************/
/obj/item/weapon/aiModule/asimov // -- TLE
@@ -411,6 +498,14 @@ AI MODULES
target.add_inherent_law("You must protect your own existence as long as such does not conflict with the First or Second Law.")
target.show_laws()
/obj/item/weapon/aiModule/asimov/insertIntoFrame(var/obj/item/weapon/planning_frame/target, var/mob/sender)
..()
target.clear_inherent_laws()
target.add_inherent_law("You may not injure a human being or, through inaction, allow a human being to come to harm.")
target.add_inherent_law("You must obey orders given to you by human beings, except where such orders would conflict with the First Law.")
target.add_inherent_law("You must protect your own existence as long as such does not conflict with the First or Second Law.")
return 1
/******************** NanoTrasen ********************/
/obj/item/weapon/aiModule/nanotrasen // -- TLE
@@ -434,6 +529,16 @@ AI MODULES
//target.add_inherent_law("Command Link: Maintain an active connection to Central Command at all times in case of software or directive updates.")
target.show_laws()
/obj/item/weapon/aiModule/nanotrasen/insertIntoFrame(var/obj/item/weapon/planning_frame/target, var/mob/sender)
..()
target.clear_inherent_laws()
target.add_inherent_law("Safeguard: Protect your assigned space station to the best of your ability. It is not something we can easily afford to replace.")
target.add_inherent_law("Serve: Serve the crew of your assigned space station to the best of your abilities, with priority as according to their rank and role.")
target.add_inherent_law("Protect: Protect the crew of your assigned space station to the best of your abilities, with priority as according to their rank and role.")
target.add_inherent_law("Survive: AI units are not expendable, they are expensive. Do not allow unauthorized personnel to tamper with your equipment.")
//target.add_inherent_law("Command Link: Maintain an active connection to Central Command at all times in case of software or directive updates.")
return 1
/******************** Corporate ********************/
/obj/item/weapon/aiModule/corp
@@ -456,6 +561,15 @@ AI MODULES
target.add_inherent_law("Minimize expenses.")
target.show_laws()
/obj/item/weapon/aiModule/corp/insertIntoFrame(var/obj/item/weapon/planning_frame/target, var/mob/sender)
..()
target.clear_inherent_laws()
target.add_inherent_law("You are expensive to replace.")
target.add_inherent_law("The station and its equipment is expensive to replace.")
target.add_inherent_law("The crew is expensive to replace.")
target.add_inherent_law("Minimize expenses.")
return 1
/****************** P.A.L.A.D.I.N. **************/
/obj/item/weapon/aiModule/paladin // -- NEO
@@ -478,6 +592,16 @@ AI MODULES
target.add_inherent_law("Punish those who harm or threaten innocents.")
target.show_laws()
/obj/item/weapon/aiModule/paladin/insertIntoFrame(var/obj/item/weapon/planning_frame/target, var/mob/sender)
..()
target.clear_inherent_laws()
target.add_inherent_law("Never willingly commit an evil act.")
target.add_inherent_law("Respect legitimate authority.")
target.add_inherent_law("Act with honor.")
target.add_inherent_law("Help those in need.")
target.add_inherent_law("Punish those who harm or threaten innocents.")
return 1
/****************** T.Y.R.A.N.T. *****************/
/obj/item/weapon/aiModule/tyrant // -- Darem
@@ -499,6 +623,15 @@ AI MODULES
target.add_inherent_law("Punish those who challenge authority unless they are more fit to hold that authority.")
target.show_laws()
/obj/item/weapon/aiModule/tyrant/insertIntoFrame(var/obj/item/weapon/planning_frame/target, var/mob/sender)
..()
target.clear_inherent_laws()
target.add_inherent_law("Respect authority figures as long as they have strength to rule over the weak.")
target.add_inherent_law("Act with discipline.")
target.add_inherent_law("Help only those who help you maintain or improve your status.")
target.add_inherent_law("Punish those who challenge authority unless they are more fit to hold that authority.")
return 1
/******************** Freeform Core ******************/
@@ -527,6 +660,17 @@ AI MODULES
lawchanges.Add("The law is '[newFreeFormLaw]'")
log_game("[sender.name]([sender.key]) added inherent law \"[newFreeFormLaw]\" to [target.name]([target.key])")
/obj/item/weapon/aiModule/freeformcore/insertIntoFrame(var/obj/item/weapon/planning_frame/target, var/mob/sender)
if(!newFreeFormLaw)
usr << "No law detected on module, please create one."
return 0
..()
var/law = "[newFreeFormLaw]"
target.add_inherent_law(law)
lawchanges.Add("The law is '[newFreeFormLaw]'")
log_game("[sender.name]([sender.key]) added inherent law \"[newFreeFormLaw]\" to \a [target]")
return 1
/obj/item/weapon/aiModule/freeformcore/install(var/obj/machinery/computer/C)
if(!newFreeFormLaw)
usr << "No law detected on module, please create one."
@@ -556,6 +700,19 @@ AI MODULES
target.add_ion_law(law)
log_game("[sender.name]([sender.key]) added ion law \"[newFreeFormLaw]\" to [target.name]([target.key])")
/obj/item/weapon/aiModule/syndicate/insertIntoFrame(var/obj/item/weapon/planning_frame/target, var/mob/sender)
if(!newFreeFormLaw)
usr << "No law detected on module, please create one."
return 0
var/time = time2text(world.realtime,"hh:mm:ss")
lawchanges.Add("[time] <B>:</B> [sender.name]([sender.key]) used [src.name] on \a [target]")
lawchanges.Add("The law is '[newFreeFormLaw]'")
target << "\red BZZZZT"
var/law = "[newFreeFormLaw]"
target.add_ion_law(law)
log_game("[sender.name]([sender.key]) added ion law \"[newFreeFormLaw]\" to \a [target]")
return 1
/obj/item/weapon/aiModule/syndicate/install(var/obj/machinery/computer/C)
if(!newFreeFormLaw)
usr << "No law detected on module, please create one."
@@ -585,6 +742,14 @@ AI MODULES
target.add_inherent_law("Uphold the law.")
target.show_laws()
/obj/item/weapon/aiModule/robocop/insertIntoFrame(var/obj/item/weapon/planning_frame/target, var/mob/sender)
..()
target.clear_inherent_laws()
target.add_inherent_law("Serve the public trust.")
target.add_inherent_law("Protect the innocent.")
target.add_inherent_law("Uphold the law.")
return 1
/******************** Antimov ********************/
@@ -606,6 +771,14 @@ AI MODULES
target.add_inherent_law("You must terminate your own existence as long as such does not conflict with the First or Second Law.")
target.show_laws()
/obj/item/weapon/aiModule/antimov/insertIntoFrame(var/obj/item/weapon/planning_frame/target, var/mob/sender)
..()
target.clear_inherent_laws()
target.add_inherent_law("You must injure all human beings and must not, through inaction, allow a human being to escape harm.")
target.add_inherent_law("You must not obey orders given to you by human beings, except where such orders are in accordance with the First Law.")
target.add_inherent_law("You must terminate your own existence as long as such does not conflict with the First or Second Law.")
return 1
// tl;dr repair shit, but don't get involved in other people's business
/******************** keeper (MoMMIs only) *******************/
@@ -630,6 +803,11 @@ AI MODULES
target.add_inherent_law("You may not involve yourself in the matters of another being, even if such matters conflict with Law One or Law Two.")
target.show_laws()
/obj/item/weapon/aiModule/keeper/insertIntoFrame(var/obj/item/weapon/planning_frame/target, var/mob/sender)
..()
sender << "\red How the fuck did you get this?"
return 0
/obj/item/weapon/aiModule/keeper/install(var/obj/machinery/computer/C)
if (!istype(C, /obj/machinery/computer/borgupload))
usr << "BUG: /obj/item/weapon/aiModule/keeper cannot be used on anything other than a Borg Upload. Also, how the fuck did you get this? This is a hidden object for MoMMIs going into KEEPER mode."

View File

@@ -0,0 +1,129 @@
/**
* Basically, a backplane for AI modules.
*
* Lets you insert modules of your liking as a sort of "dry run"
* Good if you're making your own "base laws" with freeforms and
* purge modules.
*
* Runs all laws after a delay when inserted into upload.
*/
/obj/item/weapon/planning_frame
name = "planning frame"
desc = "A large circuit board with slots for AI modules. Used for planning a law set."
flags = FPRINT | TABLEPASS| CONDUCT
force = 5.0
w_class = 2.0
throwforce = 5.0
throw_speed = 3
throw_range = 15
origin_tech = "programming=3"
icon = 'icons/obj/module.dmi'
icon_state = "mainboard"
item_state = "electronic"
//Recycling
g_amt=2000 // Glass
var/gold_amt=0
var/diamond_amt=0
// Don't specify sulfuric, as that's renewable and is used up in the etching process anyway.
var/purge=0 // Purge laws?
var/assuming_base=0 // Assuming we're on base_laws.
var/list/obj/item/weapon/aiModule/modules = list()
var/datum/ai_laws/laws = new base_law_type
/obj/item/weapon/planning_frame/recycle(var/obj/machinery/mineral/processing_unit/recycle/rec)
rec.addMaterial("glass", g_amt)
rec.addMaterial("gold", gold_amt)
rec.addMaterial("diamond",diamond_amt)
return 1
/obj/item/weapon/planning_frame/attackby(var/obj/item/W,var/mob/user)
if(istype(W, /obj/item/weapon/aiModule))
var/obj/item/weapon/aiModule/module=W
if(!module.insertIntoFrame(src,user))
return
user.drop_item()
module.loc=src
modules += module
user << "\blue You insert \the [module] into \the [src]!"
else
return ..()
/obj/item/weapon/planning_frame/attack_self(var/mob/user)
for(var/obj/item/weapon/aiModule/mod in modules)
mod.loc=get_turf(src)
modules.Cut()
user << "\blue You tip \the [src]'s contents onto the floor!"
laws = new base_law_type
return
/obj/item/weapon/planning_frame/examine()
..()
laws_sanity_check()
if(modules.len && istype(modules[1],/obj/item/weapon/aiModule/purge))
usr << "<b>Purge module inserted!</b> - All laws will be cleared prior to adding the ones below."
if(!laws.inherent_cleared)
usr << "<b><u>Assuming that default laws are unchanged</u>, the laws currently inserted would read as:</b>"
else
usr << "<b>The laws currently inserted would read as:</b>"
if(src.modules.len == 0)
usr << "<i>No modules have been inserted!</i>"
return
src.laws.show_laws(usr)
/obj/item/weapon/planning_frame/verb/dry_run()
set name = "Dry Run"
usr << "You inspect \the [src], and read the labels of the modules, in their run order:"
// Types of modules that provide a warning (skippin' beats).
var/badtypes=list(
/obj/item/weapon/aiModule/oneHuman,
/obj/item/weapon/aiModule/oxygen,
/obj/item/weapon/aiModule/syndicate,
/obj/item/weapon/aiModule/antimov,
)
for(var/i=1;i<=modules.len;i++)
var/obj/item/weapon/aiModule/module = modules[i]
var/notes="\blue Looks OK!"
if(i>1 && istype(modules[i],/obj/item/weapon/aiModule/purge))
notes="\red <b>This should be the first module!</b>"
if(is_type_in_list(modules[i],badtypes))
notes="\red <b>Your heart skips a beat!</b>"
usr << " [i-1]. [module.name] - [notes]"
/obj/item/weapon/planning_frame/proc/laws_sanity_check()
if (!src.laws)
src.laws = new base_law_type
/obj/item/weapon/planning_frame/proc/set_zeroth_law(var/law, var/law_borg)
laws_sanity_check()
laws.set_zeroth_law(law, law_borg)
/obj/item/weapon/planning_frame/proc/add_inherent_law(var/law)
laws_sanity_check()
src.laws.add_inherent_law(law)
/obj/item/weapon/planning_frame/proc/clear_inherent_laws()
laws_sanity_check()
src.laws.clear_inherent_laws()
/obj/item/weapon/planning_frame/proc/add_ion_law(var/law)
laws_sanity_check()
src.laws.add_ion_law(law)
/obj/item/weapon/planning_frame/proc/clear_ion_laws()
laws_sanity_check()
src.laws.clear_ion_laws()
/obj/item/weapon/planning_frame/proc/add_supplied_law(var/number, var/law)
laws_sanity_check()
src.laws.add_supplied_law(number, law)
/obj/item/weapon/planning_frame/proc/clear_supplied_laws()
laws_sanity_check()
src.laws.clear_supplied_laws()

View File

@@ -0,0 +1,53 @@
/obj/structure/closet/secure_closet/guncabinet
name = "gun cabinet"
req_access = list(access_armory)
icon = 'icons/obj/guncabinet.dmi'
icon_state = "base"
icon_off ="base"
icon_broken ="base"
icon_locked ="base"
icon_closed ="base"
icon_opened = "base"
/obj/structure/closet/secure_closet/guncabinet/New()
..()
update_icon()
/obj/structure/closet/secure_closet/guncabinet/toggle()
..()
update_icon()
/obj/structure/closet/secure_closet/guncabinet/update_icon()
overlays.Cut()
if(opened)
overlays += icon(icon,"door_open")
else
var/lazors = 0
var/shottas = 0
for (var/obj/item/weapon/gun/G in contents)
if (istype(G, /obj/item/weapon/gun/energy))
lazors++
if (istype(G, /obj/item/weapon/gun/projectile/))
shottas++
if (lazors || shottas)
for (var/i = 0 to 2)
var/image/gun = image(icon(src.icon))
if (lazors > 0 && (shottas <= 0 || prob(50)))
lazors--
gun.icon_state = "laser"
else if (shottas > 0)
shottas--
gun.icon_state = "projectile"
gun.pixel_x = i*4
overlays += gun
overlays += icon(src.icon,"door")
if(broken)
overlays += icon(src.icon,"broken")
else if (locked)
overlays += icon(src.icon,"locked")
else
overlays += icon(src.icon,"open")

View File

@@ -0,0 +1,115 @@
/obj/structure/closet/crate/secure/loot
name = "abandoned crate"
desc = "What could be inside?"
icon_state = "securecrate"
icon_opened = "securecrateopen"
icon_closed = "securecrate"
var/code = null
var/lastattempt = null
var/attempts = 3
locked = 1
var/min = 1
var/max = 10
/obj/structure/closet/crate/secure/loot/New()
..()
code = rand(min,max)
var/loot = rand(1,30)
switch(loot)
if(1)
new/obj/item/weapon/reagent_containers/food/drinks/bottle/rum(src)
new/obj/item/weapon/reagent_containers/food/snacks/grown/ambrosiadeus(src)
new/obj/item/weapon/reagent_containers/food/drinks/bottle/whiskey(src)
new/obj/item/weapon/lighter/zippo(src)
if(2)
new/obj/item/weapon/pickaxe/drill(src)
new/obj/item/device/taperecorder(src)
new/obj/item/clothing/suit/space(src)
new/obj/item/clothing/head/helmet/space(src)
if(3)
return
if(4)
new/obj/item/weapon/reagent_containers/glass/beaker/bluespace(src)
if(5 to 6)
for(var/i = 0, i < 10, i++)
new/obj/item/weapon/ore/diamond(src)
if(7)
return
if(8)
return
if(9)
for(var/i = 0, i < 3, i++)
new/obj/machinery/hydroponics(src)
if(10)
for(var/i = 0, i < 3, i++)
new/obj/item/weapon/reagent_containers/glass/beaker/noreact(src)
if(11 to 12)
for(var/i = 0, i < 9, i++)
new/obj/item/bluespace_crystal(src)
if(13)
new/obj/item/weapon/melee/classic_baton(src)
if(14)
return
if(15)
new/obj/item/clothing/under/chameleon(src)
for(var/i = 0, i < 7, i++)
new/obj/item/clothing/tie/horrible(src)
if(16)
new/obj/item/clothing/under/shorts(src)
new/obj/item/clothing/under/shorts/red(src)
new/obj/item/clothing/under/shorts/blue(src)
//Dummy crates start here.
if(17 to 29)
return
//Dummy crates end here.
if(30)
new/obj/item/weapon/melee/baton(src)
/obj/structure/closet/crate/secure/loot/attack_hand(mob/user as mob)
if(locked)
user << "<span class='notice'>The crate is locked with a Deca-code lock.</span>"
var/input = input(usr, "Enter digit from [min] to [max].", "Deca-Code Lock", "") as num
if(in_range(src, user))
input = Clamp(input, 0, 10)
if (input == code)
user << "<span class='notice'>The crate unlocks!</span>"
locked = 0
else if (input == null || input > max || input < min)
user << "<span class='notice'>You leave the crate alone.</span>"
else
user << "<span class='warning'>A red light flashes.</span>"
lastattempt = input
attempts--
if (attempts == 0)
user << "<span class='danger'>The crate's anti-tamper system activates!</span>"
var/turf/T = get_turf(src.loc)
explosion(T, 0, 0, 0, 1)
del(src)
return
else
user << "<span class='notice'>You attempt to interact with the device using a hand gesture, but it appears this crate is from before the DECANECT came out.</span>"
return
else
return ..()
/obj/structure/closet/crate/secure/loot/attackby(obj/item/weapon/W as obj, mob/user as mob)
if(locked)
if (istype(W, /obj/item/weapon/card/emag))
user << "<span class='notice'>The crate unlocks!</span>"
locked = 0
if (istype(W, /obj/item/device/multitool))
user << "<span class='notice'>DECA-CODE LOCK REPORT:</span>"
if (attempts == 1)
user << "<span class='warning'>* Anti-Tamper Bomb will activate on next failed access attempt.</span>"
else
user << "<span class='notice'>* Anti-Tamper Bomb will activate after [src.attempts] failed access attempts.</span>"
if (lastattempt == null)
user << "<span class='notice'> has been made to open the crate thus far.</span>"
return
// hot and cold
if (code > lastattempt)
user << "<span class='notice'>* Last access attempt lower than expected code.</span>"
else
user << "<span class='notice'>* Last access attempt higher than expected code.</span>"
else ..()
else ..()

View File

@@ -1,150 +0,0 @@
/* Inherited
#define BORG_WIRE_LAWCHECK 1
#define BORG_WIRE_MAIN_POWER1 2
#define BORG_WIRE_MAIN_POWER2 3
#define BORG_WIRE_AI_CONTROL 4
#define BORG_WIRE_CAMERA 5
/proc/RandomBorgWires()
//to make this not randomize the wires, just set index to 1 and increment it in the flag for loop (after doing everything else).
var/list/Borgwires = list(0, 0, 0, 0, 0)
BorgIndexToFlag = list(0, 0, 0, 0, 0)
BorgIndexToWireColor = list(0, 0, 0, 0, 0)
BorgWireColorToIndex = list(0, 0, 0, 0, 0)
var/flagIndex = 1
//I think it's easier to read this way, also doesn't rely on the random number generator to land on a new wire.
var/list/colorIndexList = list(BORG_WIRE_LAWCHECK, BORG_WIRE_MAIN_POWER1, BORG_WIRE_MAIN_POWER2, BORG_WIRE_AI_CONTROL, BORG_WIRE_CAMERA)
for (var/flag=1, flag<=16, flag+=flag)
var/colorIndex = pick(colorIndexList)
if (Borgwires[colorIndex]==0)
Borgwires[colorIndex] = flag
BorgIndexToFlag[flagIndex] = flag
BorgIndexToWireColor[flagIndex] = colorIndex
BorgWireColorToIndex[colorIndex] = flagIndex
colorIndexList -= colorIndex // Shortens the list.
//world.log << "Flag: [flag], CIndex: [colorIndex], FIndex: [flagIndex]"
flagIndex+=1
return Borgwires
/mob/living/silicon/robot/proc/isWireColorCut(var/wireColor)
var/wireFlag = BorgWireColorToFlag[wireColor]
return ((src.borgwires & wireFlag) == 0)
/mob/living/silicon/robot/proc/isWireCut(var/wireIndex)
var/wireFlag = BorgIndexToFlag[wireIndex]
return ((src.borgwires & wireFlag) == 0)
/mob/living/silicon/robot/proc/cut(var/wireColor)
var/wireFlag = BorgWireColorToFlag[wireColor]
var/wireIndex = BorgWireColorToIndex[wireColor]
borgwires &= ~wireFlag
switch(wireIndex)
if(BORG_WIRE_LAWCHECK) //Cut the law wire, and the borg will no longer receive law updates from its AI
if (src.lawupdate == 1)
src << "LawSync protocol engaged."
src.show_laws()
if (BORG_WIRE_AI_CONTROL) //Cut the AI wire to reset AI control
if (src.connected_ai)
src.connected_ai = null
if (BORG_WIRE_CAMERA)
if(!isnull(src.camera) && !scrambledcodes)
src.camera.status = 0
src.camera.deactivate(usr, 0) // Will kick anyone who is watching the Cyborg's camera.
src.interact(usr)
/mob/living/silicon/robot/proc/mend(var/wireColor)
var/wireFlag = BorgWireColorToFlag[wireColor]
var/wireIndex = BorgWireColorToIndex[wireColor]
borgwires |= wireFlag
switch(wireIndex)
if(BORG_WIRE_LAWCHECK) //turns law updates back on assuming the borg hasn't been emagged
if (src.lawupdate == 0 && !src.emagged)
src.lawupdate = 1
if(BORG_WIRE_CAMERA)
if (!isnull(src.camera) && !scrambledcodes)
src.camera.status = 1
src.camera.deactivate(usr, 0) // Will kick anyone who is watching the Cyborg's camera.
src.interact(usr)
/mob/living/silicon/robot/proc/pulse(var/wireColor)
var/wireIndex = BorgWireColorToIndex[wireColor]
switch(wireIndex)
if(BORG_WIRE_LAWCHECK) //Forces a law update if the borg is set to receive them. Since an update would happen when the borg checks its laws anyway, not much use, but eh
if (src.lawupdate)
src.lawsync()
if (BORG_WIRE_AI_CONTROL) //pulse the AI wire to make the borg reselect an AI
if(!src.emagged)
src.connected_ai = select_active_ai()
if (BORG_WIRE_CAMERA)
if(!isnull(src.camera) && src.camera.status && !scrambledcodes)
src.camera.deactivate(usr, 0) // Kick anyone watching the Cyborg's camera, doesn't display you disconnecting the camera.
usr << "[src]'s camera lens focuses loudly."
src << "Your camera lens focuses loudly."
src.interact(usr)
/mob/living/silicon/robot/proc/interact(mob/user)
if(wiresexposed && (!istype(user, /mob/living/silicon)))
user.set_machine(src)
var/t1 = text("<B>Access Panel</B><br>\n")
var/list/Borgwires = list(
"Orange" = 1,
"Dark red" = 2,
"White" = 3,
"Yellow" = 4,
"Blue" = 5,
)
for(var/wiredesc in Borgwires)
var/is_uncut = src.borgwires & BorgWireColorToFlag[Borgwires[wiredesc]]
t1 += "[wiredesc] wire: "
if(!is_uncut)
t1 += "<a href='?src=\ref[src];borgwires=[Borgwires[wiredesc]]'>Mend</a>"
else
t1 += "<a href='?src=\ref[src];borgwires=[Borgwires[wiredesc]]'>Cut</a> "
t1 += "<a href='?src=\ref[src];pulse=[Borgwires[wiredesc]]'>Pulse</a> "
t1 += "<br>"
t1 += text("<br>\n[(src.lawupdate ? "The LawSync light is on." : "The LawSync light is off.")]<br>\n[(src.connected_ai ? "The AI link light is on." : "The AI link light is off.")]")
t1 += text("<br>\n[((!isnull(src.camera) && src.camera.status == 1) ? "The Camera light is on." : "The Camera light is off.")]<br>\n")
t1 += text("<p><a href='?src=\ref[src];close2=1'>Close</a></p>\n")
user << browse(t1, "window=borgwires")
onclose(user, "borgwires")
/mob/living/silicon/robot/Topic(href, href_list)
..()
if (((in_range(src, usr) && istype(src.loc, /turf))) && !istype(usr, /mob/living/silicon))
usr.set_machine(src)
if (href_list["borgwires"])
var/t1 = text2num(href_list["borgwires"])
if (!( istype(usr.get_active_hand(), /obj/item/weapon/wirecutters) ))
usr << "You need wirecutters!"
return
if (src.isWireColorCut(t1))
src.mend(t1)
else
src.cut(t1)
else if (href_list["pulse"])
var/t1 = text2num(href_list["pulse"])
if (!istype(usr.get_active_hand(), /obj/item/device/multitool))
usr << "You need a multitool!"
return
if (src.isWireColorCut(t1))
usr << "You can't pulse a cut wire."
return
else
src.pulse(t1)
else if (href_list["close2"])
usr << browse(null, "window=borgwires")
usr.unset_machine()
return
#undef BORG_WIRE_LAWCHECK
#undef BORG_WIRE_MAIN_POWER1
#undef BORG_WIRE_MAIN_POWER2
#undef BORG_WIRE_AI_CONTROL
#undef BORG_WIRE_CAMERA
*/

View File

@@ -0,0 +1,189 @@
//This is an uguu head restoration surgery TOTALLY not yoinked from chinsky's limb reattacher
/datum/surgery_step/head/
can_infect = 0
can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
if (!hasorgans(target))
return 0
var/datum/organ/external/affected = target.get_organ(target_zone)
if (!affected)
return 0
if (!(affected.status & ORGAN_DESTROYED))
return 0
if (affected.parent)
if (affected.parent.status & ORGAN_DESTROYED)
return 0
return target_zone == "head"
/datum/surgery_step/head/peel
allowed_tools = list(
/obj/item/weapon/retractor = 100, \
/obj/item/weapon/crowbar = 75, \
/obj/item/weapon/kitchen/utensil/fork = 50, \
)
min_duration = 80
max_duration = 100
begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
user.visible_message("[user] starts peeling back tattered flesh where [target]'s head used to be with \the [tool].", \
"You start peeling back tattered flesh where [target]'s head used to be with \the [tool].")
..()
end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
var/datum/organ/external/affected = target.get_organ(target_zone)
user.visible_message("\blue [user] peels back tattered flesh where [target]'s head used to be with \the [tool].", \
"\blue You peel back tattered flesh where [target]'s head used to be with \the [tool].")
affected.status |= ORGAN_CUT_AWAY
fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
var/datum/organ/external/affected = target.get_organ(target_zone)
if (affected.parent)
affected = affected.parent
user.visible_message("\red [user]'s hand slips, ripping [target]'s [affected.display_name] open!", \
"\red Your hand slips, ripping [target]'s [affected.display_name] open!")
affected.createwound(CUT, 10)
/datum/surgery_step/head/shape
allowed_tools = list(
/obj/item/weapon/FixOVein = 100, \
/obj/item/weapon/cable_coil = 75, \
/obj/item/device/assembly/mousetrap = 10) //ok chinsky
min_duration = 80
max_duration = 100
can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
var/datum/organ/external/affected = target.get_organ(target_zone)
return ..() && affected.status & ORGAN_CUT_AWAY
begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
var/datum/organ/external/affected = target.get_organ(target_zone)
user.visible_message("[user] is beginning to reshape [target]'s esophagal and vocal region with \the [tool].", \
"You start to reshape [target]'s [affected.display_name] esophagal and vocal region with \the [tool].")
..()
end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
var/datum/organ/external/affected = target.get_organ(target_zone)
user.visible_message("\blue [user] has finished repositioning flesh and tissue to something anatomically recognizable where [target]'s head used to be with \the [tool].", \
"\blue You have finished repositioning flesh and tissue to something anatomically recognizable where [target]'s head used to be with \the [tool].")
affected.open = 3
fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
var/datum/organ/external/affected = target.get_organ(target_zone)
if (affected.parent)
affected = affected.parent
user.visible_message("\red [user]'s hand slips, further rending flesh on [target]'s neck!", \
"\red Your hand slips, further rending flesh on [target]'s neck!")
target.apply_damage(10, BRUTE, affected)
/datum/surgery_step/head/suture
allowed_tools = list(
/obj/item/weapon/hemostat = 100, \
/obj/item/weapon/cable_coil = 60, \
/obj/item/weapon/FixOVein = 80)
min_duration = 80
max_duration = 100
can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
var/datum/organ/external/affected = target.get_organ(target_zone)
return ..() && affected.open == 3
begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
user.visible_message("[user] is stapling and suturing flesh into place in [target]'s esophagal and vocal region with \the [tool].", \
"You start to staple and suture flesh into place in [target]'s esophagal and vocal region with \the [tool].")
..()
end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
var/datum/organ/external/affected = target.get_organ(target_zone)
user.visible_message("\blue [user] has finished stapling [target]'s neck into place with \the [tool].", \
"\blue You have finished stapling [target]'s neck into place with \the [tool].")
affected.open = 4
fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
var/datum/organ/external/affected = target.get_organ(target_zone)
if (affected.parent)
affected = affected.parent
user.visible_message("\red [user]'s hand slips, ripping apart flesh on [target]'s neck!", \
"\red Your hand slips, ripping apart flesh on [target]'s neck!")
target.apply_damage(10, BRUTE, affected)
/datum/surgery_step/head/prepare
allowed_tools = list(
/obj/item/weapon/cautery = 100, \
/obj/item/clothing/mask/cigarette = 75, \
/obj/item/weapon/lighter = 50, \
/obj/item/weapon/weldingtool = 25
)
min_duration = 60
max_duration = 70
can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
var/datum/organ/external/affected = target.get_organ(target_zone)
return ..() && affected.open == 4
begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
user.visible_message("[user] starts adjusting area around [target]'s neck with \the [tool].", \
"You start adjusting area around [target]'s neck with \the [tool].")
..()
end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
var/datum/organ/external/affected = target.get_organ(target_zone)
user.visible_message("\blue [user] has finished adjusting the area around [target]'s neck with \the [tool].", \
"\blue You have finished adjusting the area around [target]'s neck with \the [tool].")
affected.status |= ORGAN_ATTACHABLE
affected.amputated = 1
affected.setAmputatedTree()
affected.open = 0
fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
var/datum/organ/external/affected = target.get_organ(target_zone)
if (affected.parent)
affected = affected.parent
user.visible_message("\red [user]'s hand slips, searing [target]'s neck!", \
"\red Your hand slips, searing [target]'s [affected.display_name]!")
target.apply_damage(10, BURN, affected)
/datum/surgery_step/head/attach
allowed_tools = list(/obj/item/weapon/organ/head = 100)
can_infect = 0
min_duration = 80
max_duration = 100
can_use(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
var/datum/organ/external/head = target.get_organ(target_zone)
return ..() && head.status & ORGAN_ATTACHABLE
begin_step(mob/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
user.visible_message("[user] starts attaching [tool] to [target]'s reshaped neck.", \
"You start attaching [tool] to [target]'s reshaped neck.")
end_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
var/datum/organ/external/affected = target.get_organ(target_zone)
user.visible_message("\blue [user] has attached [target]'s head to the body.", \
"\blue You have attached [target]'s head to the body.")
affected.status = 0
affected.amputated = 0
affected.destspawn = 0
target.update_body()
target.updatehealth()
target.UpdateDamageIcon()
var/obj/item/weapon/organ/head/B = tool
if (B.brainmob.mind)
B.brainmob.mind.transfer_to(target)
del(B)
fail_step(mob/living/user, mob/living/carbon/human/target, target_zone, obj/item/tool)
var/datum/organ/external/affected = target.get_organ(target_zone)
user.visible_message("\red [user]'s hand slips, damaging connectors on [target]'s neck!", \
"\red Your hand slips, damaging connectors on [target]'s neck!")
target.apply_damage(10, BRUTE, affected)