Fixed issue 645.

I changed how uplinks worked. Instead of there being a duplicate item which would switch out when it activates, there's an item called "obj/item/device/uplink/hidden". It is a hidden uplink which you can place in any obj/item. In "hidden" is where it will generate menus, check for triggers to show the menu and etc.. No need to switch out with duplicate items or add the menu onto the PDA's notes.

How to create a new uplink item in 3 easy steps!

1. All obj/item 's have a hidden_uplink var. By default it's null. Give the item one with "new(src)", it must be in it's contents. Feel free to add/remove "uses".

2. Code in the triggers. Use check_trigger for this, I recommend closing the item's menu with "usr << browse(null, "window=windowname") if it returns true. The var/value is the value that will be compared with the var/target. If they are equal it will activate the menu.

3. If you want the menu to stay until the users locks his uplink, add an active_uplink_check(mob/user as mob) in your interact/attack_hand proc. Then check if it's true, if true return. This will stop the normal menu appearing and will instead show the uplink menu.

I've given the recharge station's verbs a category so they don't create their own tab.
I've added a mob/proc called put_in_any_hand_if_possible. Name speaks for itself. Returns true if successful, false otherwise.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4450 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
giacomand@gmail.com
2012-08-16 21:57:27 +00:00
parent 18dee01396
commit be76c3afcc
10 changed files with 410 additions and 694 deletions
+22 -34
View File
@@ -102,6 +102,13 @@
if(istype(W))
equip_to_slot_if_possible(W, slot)
/mob/proc/put_in_any_hand_if_possible(obj/item/W as obj, del_on_fail = 0, disable_warning = 1, redraw_mob = 1)
if(equip_to_slot_if_possible(W, slot_l_hand, del_on_fail, disable_warning, redraw_mob))
return 1
else if(equip_to_slot_if_possible(W, slot_r_hand, del_on_fail, disable_warning, redraw_mob))
return 1
return 0
//This is a SAFE proc. Use this instead of equip_to_splot()!
//set del_on_fail to have it delete W if it fails to equip
//set disable_warning to disable the 'you are unable to equip that' warning.
@@ -406,7 +413,7 @@ var/list/slot_equipment_priority = list( \
for (var/obj/item/weapon/disk/nuclear/D in world)
var/name = "Nuclear Disk"
if (name in names)
if (names.Find(name))
namecounts[name]++
name = "[name] ([namecounts[name]])"
else
@@ -416,7 +423,7 @@ var/list/slot_equipment_priority = list( \
for (var/obj/machinery/singularity/S in world)
var/name = "Singularity"
if (name in names)
if (names.Find(name))
namecounts[name]++
name = "[name] ([namecounts[name]])"
else
@@ -426,7 +433,7 @@ var/list/slot_equipment_priority = list( \
for (var/obj/machinery/bot/B in world)
var/name = "BOT: [B.name]"
if (name in names)
if (names.Find(name))
namecounts[name]++
name = "[name] ([namecounts[name]])"
else
@@ -436,7 +443,7 @@ var/list/slot_equipment_priority = list( \
/*
for (var/mob/living/silicon/decoy/D in world)
var/name = "[D.name]"
if (name in names)
if (names.Find(name))
namecounts[name]++
name = "[name] ([namecounts[name]])"
else
@@ -451,54 +458,35 @@ var/list/slot_equipment_priority = list( \
for(var/mob/M in sortAtom(mob_list))
var/name = M.name
if (name in names)
if (names.Find(name))
namecounts[name]++
name = "[name] ([namecounts[name]])"
else
names.Add(name)
namecounts[name] = 1
creatures[name] = M
//THIS IS THE MOBS PART: LOOK IN HELPERS.DM
client.perspective = EYE_PERSPECTIVE
var/eye_name = null
if (is_admin)
eye_name = input("Please, select a player!", "Admin Observe", null, null) as null|anything in creatures
else
eye_name = input("Please, select a player!", "Observe", null, null) as null|anything in creatures
var/ok = "[is_admin ? "Admin Observe" : "Observe"]"
eye_name = input("Please, select a player!", ok, null, null) as null|anything in creatures
if (!eye_name)
return
var/mob/eye = creatures[eye_name]
if (is_admin)
if (eye)
reset_view(eye)
var/mob/mob_eye = creatures[eye_name]
if(client && mob_eye)
client.eye = mob_eye
if (is_admin)
client.adminobs = 1
if(eye == client.mob)
if(mob_eye == client.mob || client.eye == client.mob)
client.adminobs = 0
else
reset_view(null)
client.adminobs = 0
else
if(ticker)
// world << "there's a ticker"
if(ticker.mode.name == "AI malfunction")
// world << "ticker says its malf"
var/datum/game_mode/malfunction/malf = ticker.mode
for (var/datum/mind/B in malf.malf_ai)
// world << "comparing [B.current] to [eye]"
if (B.current == eye)
for (var/mob/living/silicon/decoy/D in world)
if (eye)
eye = D
if (client)
if (eye)
client.eye = eye
else
client.eye = client.mob
/mob/verb/cancel_camera()
set name = "Cancel Camera View"