Merge remote-tracking branch 'upstream/dev-freeze' into dev

This commit is contained in:
PsiOmega
2015-05-26 08:35:32 +02:00
46 changed files with 395 additions and 3149 deletions
+60 -88
View File
@@ -18,93 +18,70 @@
user << "<b>ERROR ERROR ERROR</b>"
/obj/item/device/aicard/attack_self(mob/user)
if (!in_range(src, user))
return
user.set_machine(src)
var/dat = "<TT><B>Intelicard</B><BR>"
var/laws
for(var/mob/living/silicon/ai/A in src)
dat += "Stored AI: [A.name]<br>System integrity: [A.system_integrity()]%<br>"
ui_interact(user)
for (var/datum/ai_law/law in A.laws.all_laws())
laws += "[law.get_index()]: [law.law]<BR>"
/obj/item/device/aicard/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1, var/datum/topic_state/state = inventory_state)
var/data[0]
data["has_ai"] = carded_ai != null
if(carded_ai)
data["name"] = carded_ai.name
data["integrity"] = carded_ai.system_integrity()
data["radio"] = !carded_ai.aiRadio.disabledAi
data["wireless"] = !carded_ai.control_disabled
data["operational"] = carded_ai.stat != DEAD
data["flushing"] = flush
dat += "Laws:<br>[laws]<br>"
var/laws[0]
for(var/datum/ai_law/AL in carded_ai.laws.all_laws())
laws[++laws.len] = list("index" = AL.get_index(), "law" = sanitize(AL.law))
data["laws"] = laws
data["has_laws"] = laws.len
if (A.stat == 2)
dat += "<b>AI nonfunctional</b>"
else
if (!src.flush)
dat += {"<A href='byond://?src=\ref[src];choice=Wipe'>Wipe AI</A>"}
else
dat += "<b>Wipe in progress</b>"
dat += "<br>"
dat += {"<a href='byond://?src=\ref[src];choice=Wireless'>[A.control_disabled ? "Enable" : "Disable"] Wireless Activity</a>"}
dat += "<br>"
dat += {"<a href='byond://?src=\ref[src];choice=Radio'>[A.aiRadio.disabledAi ? "Enable" : "Disable"] Subspace Transceiver</a>"}
dat += "<br>"
dat += {"<a href='byond://?src=\ref[src];choice=Close'> Close</a>"}
user << browse(dat, "window=aicard")
onclose(user, "aicard")
return
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
if (!ui)
ui = new(user, src, ui_key, "aicard.tmpl", "[name]", 600, 400, state = state)
ui.set_initial_data(data)
ui.open()
ui.set_auto_update(1)
/obj/item/device/aicard/Topic(href, href_list)
/obj/item/device/aicard/Topic(href, href_list, nowindow, state)
if(..())
return 1
var/mob/U = usr
if (get_dist(get_turf(U),get_turf(src)) > 1 || U.machine != src)//If they are not in range of 1 or less or their machine is not the card (ie, clicked on something else).
U << browse(null, "window=aicard")
U.unset_machine()
return
if(!carded_ai)
return 1
add_fingerprint(U)
U.set_machine(src)
var/user = usr
if (href_list["wipe"])
var/confirm = alert("Are you sure you want to wipe this card's memory? This cannot be undone once started.", "Confirm Wipe", "Yes", "No")
if(confirm == "Yes" && (CanUseTopic(user, state) == STATUS_INTERACTIVE))
admin_attack_log(user, carded_ai, "Wiped using \the [src.name]", "Was wiped with \the [src.name]", "used \the [src.name] to wipe")
flush = 1
carded_ai.suiciding = 1
carded_ai << "Your core files are being wiped!"
while (carded_ai && carded_ai.stat != 2)
carded_ai.adjustOxyLoss(2)
carded_ai.updatehealth()
sleep(10)
flush = 0
if (href_list["radio"])
carded_ai.aiRadio.disabledAi = text2num(href_list["radio"])
carded_ai << "<span class='warning'>Your Subspace Transceiver has been [carded_ai.aiRadio.disabledAi ? "disabled" : "enabled"]!</span>"
user << "<span class='notice'>You [carded_ai.aiRadio.disabledAi ? "disable" : "enable"] the AI's Subspace Transceiver.</span>"
if (href_list["wireless"])
carded_ai.control_disabled = text2num(href_list["wireless"])
carded_ai << "<span class='warning'>Your wireless interface has been [carded_ai.control_disabled ? "disabled" : "enabled"]!</span>"
user << "<span class='notice'>You [carded_ai.control_disabled ? "disable" : "enable"] the AI's wireless interface.</span>"
update_icon()
switch(href_list["choice"])//Now we switch based on choice.
if ("Close")
U << browse(null, "window=aicard")
U.unset_machine()
return
if ("Radio")
for(var/mob/living/silicon/ai/A in src)
A.aiRadio.disabledAi = !A.aiRadio.disabledAi
A << "Your Subspace Transceiver has been: [A.aiRadio.disabledAi ? "disabled" : "enabled"]"
U << "You [A.aiRadio.disabledAi ? "Disable" : "Enable"] the AI's Subspace Transceiver"
if ("Wipe")
var/confirm = alert("Are you sure you want to wipe this card's memory? This cannot be undone once started.", "Confirm Wipe", "Yes", "No")
if(confirm == "Yes")
if(isnull(src)||!in_range(src, U)||U.machine!=src)
U << browse(null, "window=aicard")
U.unset_machine()
return
else
flush = 1
for(var/mob/living/silicon/ai/A in src)
A.suiciding = 1
A << "Your core files are being wiped!"
while (A.stat != 2)
A.adjustOxyLoss(2)
A.updatehealth()
sleep(10)
flush = 0
if ("Wireless")
for(var/mob/living/silicon/ai/A in src)
A.control_disabled = !A.control_disabled
A << "The intelicard's wireless port has been [A.control_disabled ? "disabled" : "enabled"]!"
update_icon()
attack_self(U)
return 1
/obj/item/device/aicard/update_icon()
var/mob/living/silicon/ai/occupant = locate() in src
overlays.Cut()
if(occupant)
if (occupant.control_disabled)
overlays -= image('icons/obj/pda.dmi', "aicard-on")
else
if(carded_ai)
if (!carded_ai.control_disabled)
overlays += image('icons/obj/pda.dmi', "aicard-on")
if(occupant.stat)
if(carded_ai.stat)
icon_state = "aicard-404"
else
icon_state = "aicard-full"
@@ -112,23 +89,23 @@
icon_state = "aicard"
/obj/item/device/aicard/proc/grab_ai(var/mob/living/silicon/ai/ai, var/mob/living/user)
if(!ai.client)
user << "\red <b>ERROR</b>: \black [name] data core is offline. Unable to download."
user << "<span class='danger'>ERROR:</span> [name] data core is offline. Unable to download."
return 0
if(locate(/mob/living/silicon/ai) in src)
user << "\red <b>Transfer failed</b>: \black Existing AI found on remote terminal. Remove existing AI to install a new one."
if(carded_ai)
user << "<span class='danger'>Transfer failed:</span> Existing AI found on remote terminal. Remove existing AI to install a new one."
return 0
if(ai.is_malf())
user << "\red <b>ERROR</b>: \black Remote transfer interface disabled."
user << "<span class='danger'>ERROR:</span> Remote transfer interface disabled."
return 0
if(istype(ai.loc, /turf/))
new /obj/structure/AIcore/deactivated(get_turf(ai))
src.name = "inteliCard - [ai.name]"
admin_attack_log(user, ai, "Carded with [src.name]", "Was carded with [src.name]", "used the [src.name] to card")
src.name = "[initial(name)] - [ai.name]"
ai.loc = src
ai.cancel_camera()
@@ -137,11 +114,6 @@
ai.aiRadio.disabledAi = 1
carded_ai = ai
ai.attack_log += text("\[[time_stamp()]\] <font color='orange'>Has been carded with [src.name] by [user.name] ([user.ckey])</font>")
user.attack_log += text("\[[time_stamp()]\] <font color='red'>Used the [src.name] to card [ai.name] ([ai.ckey])</font>")
msg_admin_attack("[user.name] ([user.ckey]) used the [src.name] to card [ai.name] ([ai.ckey]) (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[user.x];Y=[user.y];Z=[user.z]'>JMP</a>)")
if(ai.client)
ai << "You have been downloaded to a mobile storage device. Remote access lost."
if(user.client)
@@ -151,7 +123,7 @@
return 1
/obj/item/device/aicard/proc/clear()
name = "inteliCard"
name = initial(name)
carded_ai = null
update_icon()
+114
View File
@@ -0,0 +1,114 @@
/obj/item/weapon/beartrap
name = "mechanical trap"
throw_speed = 2
throw_range = 1
gender = PLURAL
icon = 'icons/obj/items.dmi'
icon_state = "beartrap0"
desc = "A mechanically activated leg trap. Low-tech, but reliable. Looks like it could really hurt if you set it off."
throwforce = 0
w_class = 3
origin_tech = "materials=1"
var/deployed = 0
/obj/item/weapon/beartrap/suicide_act(mob/user)
viewers(user) << "<span class='danger'>[user] is putting the [src.name] on \his head! It looks like \he's trying to commit suicide.</span>"
return (BRUTELOSS)
/obj/item/weapon/beartrap/proc/can_use(mob/user)
return (user.IsAdvancedToolUser() && !issilicon(user) && !user.stat && !user.restrained())
/obj/item/weapon/beartrap/attack_self(mob/user as mob)
..()
if(deployed && can_use(user))
user.visible_message(
"<span class='danger'>[user] starts to deploy \the [src].</span>",
"<span class='danger'>You begin deploying \the [src]!</span>",
"You hear the slow creaking of a spring."
)
if (do_after(user, 60))
user.visible_message(
"<span class='danger'>[user] has deployed \the [src].</span>",
"<span class='danger'>You have deployed \the [src]!</span>",
"You hear a latch click loudly."
)
deployed = 1
user.drop_from_inventory(src)
update_icon()
anchored = 1
/obj/item/weapon/beartrap/attack_hand(mob/user as mob)
if(buckled_mob && can_use(user))
user.visible_message(
"<span class='notice'>[user] begins freeing [buckled_mob] from \the [src].</span>",
"<span class='notice'>You carefully begin to free [buckled_mob] from \the [src].</span>",
)
if(do_after(user, 60))
user.visible_message("<span class='notice'>[buckled_mob] has been freed from \the [src] by [user].</span>")
unbuckle_mob()
anchored = 0
else if(deployed && can_use(user))
user.visible_message(
"<span class='danger'>[user] starts to disarm \the [src].</span>",
"<span class='notice'>You begin disarming \the [src]!</span>",
"You hear a latch click followed by the slow creaking of a spring."
)
if(do_after(user, 60))
user.visible_message(
"<span class='danger'>[user] has disarmed \the [src].</span>",
"<span class='notice'>You have disarmed \the [src]!</span>"
)
deployed = 0
anchored = 0
update_icon()
else
..()
/obj/item/weapon/beartrap/proc/attack_mob(mob/living/L)
var/target_zone
if(L.lying)
target_zone = ran_zone()
else
target_zone = pick("l_foot", "r_foot", "l_leg", "r_leg")
//armour
var/blocked = L.run_armor_check(target_zone, "melee")
if(blocked >= 2)
return
if(!L.apply_damage(30, BRUTE, target_zone, blocked, used_weapon=src))
return 0
//trap the victim in place
if(!blocked)
set_dir(L.dir)
buckle_mob(L)
L << "<span class='danger'>The steel jaws of \the [src] bite into you, trapping you in place!</span>"
/obj/item/weapon/beartrap/Crossed(AM as mob|obj)
if(isliving(AM))
var/mob/living/L = AM
if(L.m_intent == "run")
L.visible_message(
"<span class='danger'>[L] steps on \the [src].</span>",
"<span class='danger'>You step on \the [src]!</span>",
"<b>You hear a loud metallic snap!</b>"
)
attack_mob(L)
if(!buckled_mob)
anchored = 0
deployed = 0
update_icon()
..()
/obj/item/weapon/beartrap/update_icon()
..()
if(!deployed)
icon_state = "beartrap0"
else
icon_state = "beartrap1"
@@ -37,10 +37,7 @@
/obj/structure/closet/examine(mob/user)
if(get_dist(src, user) > 1)
return ..(user)
if(opened)
if(..(user, 1) && !opened)
var/content_size = 0
for(var/obj/item/I in src.contents)
if(!I.anchored)