Merge pull request #56 from Aurorastation/development

Development
This commit is contained in:
SoundScopes
2015-12-08 02:35:36 +00:00
11 changed files with 628 additions and 11 deletions
+20
View File
@@ -1345,3 +1345,23 @@ var/list/all_supply_groups = list("Operations","Security","Hospitality","Enginee
containername = "Pill Bottle Kit"
access = access_medical
group = "Medical / Science"
/datum/supply_packs/doorbracers_engineering
name = "Engineering Doorbracer Crate"
contains = list(/obj/item/device/doorbrace/engineering,
/obj/item/device/doorbrace/engineering,
/obj/item/device/doorbrace/engineering)
cost = 30
containertype = /obj/structure/closet/crate
containername = "engineering doorbracers"
group = "Engineering"
/datum/supply_packs/doorbracers_security
name = "Security Doorbracer Crate"
contains = list(/obj/item/device/doorbrace/security,
/obj/item/device/doorbrace/security,
/obj/item/device/doorbrace/security)
cost = 30
containertype = /obj/structure/closet/crate
containername = "security doorbracers"
group = "Security"
+17 -2
View File
@@ -51,6 +51,7 @@
var/door_sound='sound/machines/airlock.ogg'
var/door_sound_distance=30
autoclose = 1
var/obj/item/device/doorbrace/bracer = null
/obj/machinery/door/airlock/command
name = "Airlock"
@@ -717,6 +718,15 @@ About the new airlock wires panel:
set_frequency(ST.change_freq(frequency))
return
if (istype(C, /obj/item/device/doorbrace))
if (bracer)
user << "<span class='notice'>There is already a [bracer] on [src]!</span>"
return
var/obj/item/device/doorbrace/newbracer = C
newbracer.attachto(src, user)
return
src.add_fingerprint(user)
if((istype(C, /obj/item/weapon/weldingtool) && !( src.operating > 0 ) && src.density))
var/obj/item/weapon/weldingtool/W = C
@@ -824,7 +834,10 @@ About the new airlock wires panel:
playsound(src.loc, door_sound, door_sound_distance, 1)
/obj/machinery/door/airlock/open(var/forced=0)
if( operating || welded || locked )
if( operating || welded || locked)
return 0
if (bracer)
visible_message("<span class='notice'>[src]'s actuators whirr, but the door does not open.</span>")
return 0
if(!forced)
if( !arePowerSystemsOn() || isWireCut(AIRLOCK_WIRE_OPEN_DOOR) )
@@ -915,7 +928,9 @@ About the new airlock wires panel:
break
/obj/machinery/door/airlock/proc/prison_open()
if (bracer)
return
src.unlock()
src.open()
src.lock()
return
return
@@ -0,0 +1,289 @@
#define STATUS_INACTIVE 0
#define STATUS_ACTIVE 1
#define STATUS_BROKEN 2
#define LAYER_ATTACHED 3.2
#define LAYER_NORMAL 3
/obj/item/device/doorbrace
name = "magnetic door lock"
desc = "A large, ID locked device used for completely locking down airlocks."
icon = 'icons/obj/door_braces/centcom.dmi'
icon_state = "inactive"
w_class = 3
req_access = list(103)
health = 90
var/department = "CENTCOM"
var/status = 0
var/constructionstate = 0
var/obj/machinery/door/airlock/target = null
/obj/item/device/doorbrace/security
icon = 'icons/obj/door_braces/security.dmi'
department = "Security"
req_access = list(1)
/obj/item/device/doorbrace/engineering
icon = 'icons/obj/door_braces/engineering.dmi'
department = "Engineering"
req_access = null
req_one_access = list(11, 24)
/obj/item/device/doorbrace/examine()
..()
if (status == STATUS_BROKEN)
usr << "<span class='danger'>It looks broken!</span>"
else
usr << "\blue This device has [department] department markings on it."
/obj/item/device/doorbrace/attack_hand(var/mob/user)
if (status == STATUS_ACTIVE)
ui_interact(user)
else
..()
/obj/item/device/doorbrace/bullet_act(var/obj/item/projectile/Proj)
takedamage(Proj.damage)
..()
/obj/item/device/doorbrace/attackby(var/obj/item/I, var/mob/user)
if (status == STATUS_BROKEN)
user << "<span class='danger'>[src] is broken beyond repair!</span>"
return
if (istype(I, /obj/item/weapon) && user.a_intent == "hurt")
if (I.force >= 8)
user.visible_message("<span class='danger'>[user] bashes [src] with [I]!</span>", "<span class='danger'>You strike [src] with [I], damaging it!</span>")
takedamage(I.force)
return
else
user.visible_message("<span class='notice'>[user] hits [src] with [I] to no visible effect.</span>", "<span class='notice'>You hit [src] with [I], but it appears to have no effect.</span>")
return
switch (constructionstate)
if (0)
if (istype(I, /obj/item/weapon/card/emag))
var/obj/item/weapon/card/emag/emagcard = I
emagcard.uses--
visible_message("<span class='danger'>[src] sparks and falls off the door!</span>", "<span class='danger'>You emag [src], frying its circuitry[status == STATUS_ACTIVE ? " and making it drop onto the floor" : ""]!</span>")
setstatus(STATUS_BROKEN)
return
if (status == STATUS_ACTIVE && istype(I, /obj/item/weapon/card/id))
if (check_access(I) && !constructionstate)
user << "<span class='notice'>You swipe your [I] through [src], making it drop onto the floor with a thud.</span>"
setstatus(STATUS_INACTIVE)
return
else if (constructionstate)
user << "<span class='danger'>You cannot swipe your [I] through [src] with it partially dismantled!</span>"
return
else
user << "<span class='danger'>A red light flashes on [src] as you swipe your [I] through it.</span>"
flick("deny",src)
return
if (istype(I, /obj/item/weapon/screwdriver))
user << "<span class='notice'>You unfasten and remove the plastic cover from [src], revealing a thick metal shell.</span>"
playsound(loc, 'sound/items/Screwdriver.ogg', 50, 1)
setconstructionstate(1)
return
if (1)
if (istype(I, /obj/item/weapon/screwdriver))
user << "<span class='notice'>You put the metal cover of back onto [src], and screw it tight.</span>"
playsound(loc, 'sound/items/Screwdriver.ogg', 50, 1)
setconstructionstate(0)
return
if (istype(I, /obj/item/weapon/weldingtool))
var/obj/item/weapon/weldingtool/WT = I
if (WT.remove_fuel(1, user))
user.visible_message("<span class='notice'>[user] starts welding through the metal shell of [src].</span>", "<span class='notice'>You start welding through the metal covering of [src]</span>")
playsound(loc, 'sound/items/Welder.ogg', 50, 1)
if (do_after(user, 25))
user << "<span class='notice'>You are able to weld through the metal shell of [src].</span>"
setconstructionstate(2)
return
if (2)
if (istype(I, /obj/item/weapon/crowbar))
user << "<span class='notice'>You pry off the metal covering from [src].</span>"
playsound(loc, 'sound/items/Crowbar.ogg', 50, 1)
setconstructionstate(3)
return
if (3)
if (istype(I, /obj/item/weapon/wirecutters))
user << "<span class='notice'>You cut the wires connecting the [src]'s magnets to their powersupply, [target ? "making the device fall off [target] and rendering it unusable." : "rendering the device unusable."]</span>"
playsound(loc, 'sound/items/Wirecutter.ogg', 50, 1)
setconstructionstate(4)
return
/obj/item/device/doorbrace/proc/attachto(var/obj/machinery/door/airlock/newtarget, var/mob/user as mob)
if (status == STATUS_BROKEN)
user << "<span class='danger'>[src] is damaged beyond repair! It cannot be used!</span>"
return
if (!newtarget.density || newtarget.operating)
user << "<span class='danger'>[newtarget] must be closed before you can attach [src] to it!</span>"
return
if (newtarget.p_open)
user << "<span class='danger'>You must close [newtarget]'s maintenance panel before attaching [src] to it!</span>"
return
user.visible_message("<span class='notice'>[user] starts mounting [src] onto [newtarget].</span>", "<span class='notice'>You begin mounting [src] onto [newtarget].</span>")
if (do_after(user, 35, 1))
if (status == STATUS_BROKEN)
user << "<span class='danger'>[src] is damaged beyond repair! It cannot be used!</span>"
return
if (!newtarget.density)
user << "<span class='danger'>[newtarget] must be closed before you can attach [src] to it!</span>"
return
if (newtarget.p_open)
user << "<span class='danger'>You must close [newtarget]'s maintenance panel before attaching [src] to it!</span>"
return
user.visible_message("<span class='notice'>[user] attached [src] onto [newtarget] and flicks it on. The magnetic lock now seals [newtarget].</span>", "<span class='notice'>You attached [src] onto [newtarget] and switched on the magnetic lock.</span>")
user.drop_item()
setstatus(STATUS_ACTIVE, newtarget)
return
/obj/item/device/doorbrace/proc/setstatus(var/newstatus, var/obj/machinery/door/airlock/newtarget as obj)
switch (newstatus)
if (STATUS_INACTIVE)
if (status != STATUS_ACTIVE)
return
if (!target)
return
detach()
icon_state = "inactive"
status = newstatus
if (STATUS_ACTIVE)
if (status != STATUS_INACTIVE)
return
if (!newtarget)
return
attach(newtarget)
icon_state = "active"
status = newstatus
if (STATUS_BROKEN)
spark()
if (target)
var/playflick = 1
if (constructionstate)
playflick = 0
detach(playflick)
icon_state = "broken"
status = newstatus
/obj/item/device/doorbrace/proc/setconstructionstate(var/newstate)
constructionstate = newstate
if (newstate == 0)
if (status == STATUS_ACTIVE)
icon_state = "active"
else
icon_state = "inactive"
else if (newstate == 2)
flick("deconstruct_2_anim", src)
else if (newstate == 4)
setstatus(STATUS_BROKEN)
else
icon_state = "deconstruct_[constructionstate]"
/obj/item/device/doorbrace/proc/detach(var/playflick = 1)
if (target)
if (playflick)
spawn(-15) flick("release", src)
adjustsprite(null)
layer = LAYER_NORMAL
target.bracer = null
anchored = 0
/obj/item/device/doorbrace/proc/attach(var/obj/machinery/door/airlock/newtarget as obj)
adjustsprite(newtarget)
layer = LAYER_ATTACHED
flick("deploy", src)
newtarget.bracer = src
target = newtarget
anchored = 1
/obj/item/device/doorbrace/proc/adjustsprite(var/obj/target as obj)
if (target)
switch (get_dir(src, target))
if (NORTH)
pixel_x = 0
pixel_y = 32
if (NORTHEAST)
pixel_x = 32
pixel_y = 32
if (EAST)
pixel_x = 32
pixel_y = 0
if (SOUTHEAST)
pixel_x = 32
pixel_y = -32
if (SOUTH)
pixel_x = 0
pixel_y = -32
if (SOUTHWEST)
pixel_x = -32
pixel_y = -32
if (WEST)
pixel_x = -32
pixel_y = 0
if (NORTHWEST)
pixel_x = -32
pixel_y = 32
else
pixel_x = 0
pixel_y = 0
/obj/item/device/doorbrace/proc/takedamage(var/damage)
health -= damage
if (damage >= 40 && prob(50))
health = 0
if (health <= 0)
visible_message("<span class='danger'>[src] sparks[target ? " and falls off of \the [target]!" : "!"] It is now completely unusable!</span>")
setstatus(STATUS_BROKEN)
return
if (prob(50))
spark()
/obj/item/device/doorbrace/proc/spark()
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
if (target)
s.set_up(5, 1, target)
else
s.set_up(5, 1, src)
s.start()
spawn(5)
del(s)
#undef STATUS_INACTIVE
#undef STATUS_ACTIVE
#undef STATUS_BROKEN
#undef LAYER_ATTACHED
#undef LAYER_NORMAL
+266
View File
@@ -0,0 +1,266 @@
/*
* Contains the secret santa structures and procs.
* Requires database modification to work.
*/
#define CUTOFF_DATE 19
#define STATUS_CLOSED 0
#define STATUS_SIGNUP 1
#define STATUS_GIFTS 2
/obj/structure/santa_signup_box
name = "Secret Santa Sign-up Box"
desc = "Sign up to participate in NSS Aurora secret santa extravaganza here!"
anchored = 1
density = 1
icon = 'icons/obj/secret_santa.dmi'
icon_state = "sign_up_box"
var/daysLeft
var/signupStatus
/obj/structure/santa_signup_box/New()
..()
daysLeft = CUTOFF_DATE - text2num(time2text(world.realtime, "DD"))
if (time2text(world.realtime, "MM") != "12")
signupStatus = STATUS_CLOSED
return
if (daysLeft > 0)
signupStatus = STATUS_SIGNUP
else
signupStatus = STATUS_GIFTS
/obj/structure/santa_signup_box/examine()
..()
switch (signupStatus)
if (STATUS_SIGNUP)
usr << "\blue Sign-ups to participate are still being accepted for the next [daysLeft] days!"
if (STATUS_GIFTS)
usr << "\blue Currently accepting gift submissions from assigned santas!"
else
usr << "\red Christmas is over! Go home, scrub!"
/obj/structure/santa_signup_box/attack_hand(mob/user)
add_fingerprint(user)
ui_interact(user)
/obj/structure/santa_signup_box/ui_interact(mob/user)
if (user.stat)
return
if (!ishuman(user))
user << "\red You must be human to use this machine!"
return
var/mob/living/carbon/human/M = user
if (!M.client || M.client.player_age < 14)
user << "\red You haven't been around for long enough to participate! Sorry, but this is kind of an anti-spam measure..."
return
var/explanation = "<br><br><center><b>Explanation:</b></center><br>"
explanation += "<center>Everyone has until the 18th of December to sign up to participate. On the 19th of December, everyone who's signed up will be assigned a mark. You can return to this box on that day, or afterwards, to check up who you were assigned!<br>After that, until the 26th of December, you can submit a gift idea to this box. The gifts will be delivered by a NanoTrasen approved Santa Claus after the 24th!</center><br><br>"
explanation += "<center><b>OOC remarks:</b> Be creative, any item that is ingame is a go! Also, feel free to seek out your mark and try to figure out what would suit them best! The gifted items will spawn on the marked characters until mid-to-late-January.<br><b>No weapons or godmodded items<b> -- the only rule.<br>If you were assigned a mark you don't know anything about, and cannot reasonably interact with due to timezone constraints, please contact Skull132 ASAP!</center>"
var/dat
establish_db_connection()
if (dbcon.IsConnected())
switch (signupStatus)
if (STATUS_CLOSED)
dat += "<br><br><br><center><b><font color='red'>Christmas is over! Go home, scrub!</font></b></center>"
if (STATUS_SIGNUP)
if (isSignedUp(M))
dat += "<center><b>You are currently signed up to participate in the NSS Aurora secret santa extravaganza!</b></center><br><br>"
dat += "<center>You have [daysLeft] days left to change your mind, should you want to!</center><br>"
dat += "<center><font color='red'><a href='?src=\ref[src];choice=withdraw;user=\ref[user]'>Withdraw Participation</a></font></center>"
else
dat += "<center><b>You are currently not signed up to participate in the NSS Aurora secret santa extravaganza!</b></center><br><br>"
dat += "<center>You have [daysLeft] days left to sign up!</center><br>"
dat += "<center><font color='green'><a href='?src=\ref[src];choice=signup;user=\ref[user]'>Sign up to participate!</a></font></center>"
dat += explanation
if (STATUS_GIFTS)
if (isSignedUp(M))
if (hasMark(M))
var/list/markInfo = getMarkInfo(hasMark(M))
dat += "<center>Your mark is: <b>[hasMark(M)]</b>!</center><br>"
dat += "<center>Figure out what they may like for Christmas, and submit the idea for NanoTrasen approval!</center><br>"
dat += "<center>Your mark is a [markInfo["character_gender"]] [markInfo["character_species"]] working aboard the NSS Aurora as a [markInfo["character_job"]]. They like [markInfo["character_like"]].</center><br><br>"
if (markInfo["assigned_gift"])
dat += "<center>You are giving them a [markInfo["assigned_gift"]]. <a href='?src=\ref[src];choice=reviseGift;user=\ref[user]'>Revise</a></center>"
else
dat += "<center><a href='?src=\ref[src];choice=submitGift;user=\ref[user]'>Submit Gift Idea</a></center>"
else
dat += "<center>You have no mark! This is <font color='red'><b>bad</b></font>! Contact an admin, pronto!</center>"
dat += explanation
else
dat += "<br><br><br><center>You didn't sign up in time! Sorry!</center><br>"
dat += "<center>Better luck next time!</center>"
else
dat += "<center>No database connection! System unable to operate!</center>"
M << browse(dat, "window=secret_santa")
return
/obj/structure/santa_signup_box/Topic(href, href_list)
..()
var/mob/living/carbon/user = locate(href_list["user"])
switch (href_list["choice"])
if ("withdraw")
withdrawSignUp(user)
if ("signup")
signUp(user)
if ("reviseGift")
alterGift(user)
if ("submitGift")
assignGift(user)
ui_interact(user)
return
/obj/structure/santa_signup_box/proc/signUp(var/mob/living/carbon/human/user)
if (!user.client || user.stat || !user.real_name)
user << "\red No. Die."
return
establish_db_connection()
if (!dbcon.IsConnected())
user << "\red No database connection! Bad!"
return
var/queryText
var/DBQuery/lookupQuery = dbcon.NewQuery("SELECT * FROM ss13_santa WHERE character_name = '[user.real_name]'")
lookupQuery.Execute()
if (lookupQuery.NextRow())
if (alert(user, "Your data already exists here. Do you just want to be added to the roster again?", "Choices, choices...", "Yes", "No") == "Yes")
queryText = "UPDATE ss13_santa SET participation_status = '1' WHERE character_name = '[user.real_name]'"
else
return
else
var/list/storeArray = list("character_name", "character_gender", "character_species", "character_job", "character_like")
storeArray["character_name"] = user.real_name
storeArray["character_gender"] = user.gender
storeArray["character_species"] = user.species.name
storeArray["character_job"] = input(user, "Please type in your character's normal job", "Character Job") as text
storeArray["character_like"] = input(user, "Please specific 1 of your character's likes", "Character Like") as message
storeArray["character_job"] = sanitizeSQL(storeArray["character_job"])
storeArray["character_like"] = sanitizeSQL(storeArray["character_like"])
queryText = "INSERT INTO ss13_santa (character_name, character_gender, character_species, character_job, character_like) VALUES ('[storeArray["character_name"]]', '[storeArray["character_gender"]]', '[storeArray["character_species"]]', '[storeArray["character_job"]]', '[storeArray["character_like"]]')"
var/DBQuery/query = dbcon.NewQuery(queryText)
if (!query.Execute())
user << "\red Something went wrong! Give this error to the coders: [query.ErrorMsg()]."
else
user << "\blue You are now signed up for the NSS Aurora secret santa extravaganza! Return here after the 18th of December to find out who your mark is!"
return
/obj/structure/santa_signup_box/proc/isSignedUp(var/mob/living/carbon/human/user)
establish_db_connection()
if (!dbcon.IsConnected())
return 0
var/isSignedUp = 0
var/DBQuery/query = dbcon.NewQuery("SELECT participation_status FROM ss13_santa WHERE character_name = '[user.real_name]'")
query.Execute()
if (query.NextRow())
isSignedUp = text2num(query.item[1])
return isSignedUp
/obj/structure/santa_signup_box/proc/withdrawSignUp(var/mob/living/carbon/human/user)
establish_db_connection()
if (!dbcon.IsConnected())
return
var/DBQuery/query = dbcon.NewQuery("UPDATE ss13_santa SET participation_status = '0' WHERE character_name = '[user.real_name]'")
query.Execute()
return
/obj/structure/santa_signup_box/proc/hasMark(var/mob/living/carbon/human/user)
establish_db_connection()
if (!dbcon.IsConnected())
return 0
var/DBQuery/query = dbcon.NewQuery("SELECT mark_name FROM ss13_santa WHERE character_name = '[user.real_name]'")
query.Execute()
if (query.NextRow())
return query.item[1]
return 0
/obj/structure/santa_signup_box/proc/getMarkInfo(var/markName)
if (!markName)
return 0
establish_db_connection()
if (!dbcon.IsConnected())
return 0
var/list/returnArray = list("character_name", "character_gender", "character_species", "character_job", "character_like")
var/DBQuery/query = dbcon.NewQuery("SELECT character_gender, character_species, character_job, character_like, assigned_gift WHERE character_name = '[markName]'")
query.Execute()
if (query.NextRow())
returnArray["character_gender"] = query.item[1]
returnArray["character_species"] = query.item[2]
returnArray["character_job"] = query.item[3]
returnArray["character_like"] = query.item[4]
returnArray["assigned_gift"] = query.item[5]
return returnArray
return 0
/obj/structure/santa_signup_box/proc/assignGift(var/mob/living/carbon/user)
establish_db_connection()
if (!dbcon.IsConnected())
return
var/gift = input(user, "What would you like to gift your mark?", "Pick a Gift!") as text
gift = sanitizeSQL(gift)
var/DBQuery/query = dbcon.NewQuery("INSERT INTO ss13_santa (gift_assigned) VALUES ('[gift]') WHERE character_name = '[hasMark(user)]'")
query.Execute()
/obj/structure/santa_signup_box/proc/alterGift(var/mob/living/carbon/user)
establish_db_connection()
if (!dbcon.IsConnected())
return
var/gift = input(user, "What would you like to gift your mark?", "Pick a Gift!") as text
gift = sanitizeSQL(gift)
var/DBQuery/query = dbcon.NewQuery("UPDATE ss13_santa SET gift_assigned = '[gift]' WHERE character_name = '[hasMark(user)]'")
query.Execute()
#undef CUTOFF_DATE
#undef STATUS_CLOSED
#undef STATUS_SIGNUP
#undef STATUS_GIFTS