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
+11 -52
View File
@@ -299,14 +299,11 @@ datum/mind
istype(current,/mob/living/carbon/human) )
text = "Uplink: <a href='?src=\ref[src];common=uplink'>give</a>"
var/obj/item/device/uplink/suplink = find_syndicate_uplink()
var/obj/item/device/uplink/iuplink = find_integrated_uplink()
var/obj/item/device/uplink/hidden/suplink = find_syndicate_uplink()
var/crystals
if (suplink)
crystals = suplink.uses
else if (iuplink)
crystals = iuplink.uses
if (suplink || iuplink)
if (suplink)
text += "|<a href='?src=\ref[src];common=takeuplink'>take</a>"
if (usr.client.holder.level >= 3)
text += ", <a href='?src=\ref[src];common=crystals'>[crystals]</a> crystals"
@@ -847,19 +844,14 @@ datum/mind
memory = null//Remove any memory they may have had.
if("crystals")
if (usr.client.holder.level >= 3)
var/obj/item/device/uplink/suplink = find_syndicate_uplink()
var/obj/item/device/uplink/iuplink = find_integrated_uplink()
var/obj/item/device/uplink/hidden/suplink = find_syndicate_uplink()
var/crystals
if (suplink)
crystals = suplink.uses
else if (iuplink)
crystals = iuplink.uses
crystals = input("Amount of telecrystals for [key]","Syndicate uplink", crystals) as null|num
if (!isnull(crystals))
if (suplink)
suplink.uses = crystals
else if(iuplink)
iuplink.uses = crystals
if("uplink")
if (!ticker.mode.equip_traitor(current, !(src in ticker.mode.traitors)))
usr << "\red Equipping a syndicate failed!"
@@ -905,50 +897,17 @@ datum/mind
*/
proc/find_syndicate_uplink()
var/obj/item/device/uplink/radio/uplink = null
var/list/L = current.get_contents()
for (var/obj/item/device/radio/radio in L)
uplink = radio.traitorradio
if (uplink)
return uplink
uplink = locate() in L
return uplink
for (var/obj/item/I in L)
if (I.hidden_uplink)
return I.hidden_uplink
return null
proc/find_integrated_uplink()
//world << "DEBUG: find_integrated_uplink()"
var/obj/item/device/uplink/uplink = null
var/list/L = current.get_contents()
for (var/obj/item/device/pda/pda in L)
uplink = pda.uplink
if (uplink)
return uplink
return uplink
proc/take_uplink()
var/obj/item/device/uplink/hidden/H = find_syndicate_uplink()
if(H)
del(H)
proc/take_uplink() //assuming only one uplink because I am tired of all this uplink shit --rastaf0
var/list/L = current.get_contents()
var/obj/item/device/uplink/radio/suplink = null
var/obj/item/device/uplink/pda/iuplink = null
for (var/obj/item/device/radio/radio in L)
suplink = radio.traitorradio
if (suplink)
break
if (!suplink)
suplink = locate() in L
for (var/obj/item/device/pda/pda in L)
iuplink = pda.uplink
if (iuplink)
break
if (!iuplink)
iuplink = locate() in L
if (iuplink)
iuplink.shutdown_uplink()
del(iuplink)
else if (suplink)
suplink.shutdown_uplink()
del(suplink)
return
proc/make_AI_Malf()
if(!(src in ticker.mode.malf_ai))