Fix a lot of wire interactions

This commit is contained in:
Bjorn Neergaard
2016-01-25 12:03:03 -06:00
parent 014e83fec6
commit c78e1ec2ac
4 changed files with 23 additions and 43 deletions
+1 -1
View File
@@ -11,7 +11,7 @@
/datum/wires/apc/interactable(mob/user)
var/obj/machinery/power/apc/A = holder
if(A.wiresexposed)
if(A.panel_open && !A.opened)
return TRUE
/datum/wires/apc/get_status()
+6 -7
View File
@@ -165,13 +165,12 @@
return 1
return 0
/obj/machinery/airalarm/interact(mob/user)
if(user.has_unlimited_silicon_privilege && src.aidisabled)
user << "AI control for this Air Alarm interface has been disabled."
return
if(!shorted)
ui_interact(user)
/obj/machinery/airalarm/ui_status(mob/user)
if(user.has_unlimited_silicon_privilege && aidisabled)
user << "AI control has been disabled."
else if(!shorted)
return ..()
return UI_CLOSE
/obj/machinery/airalarm/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, \
datum/tgui/master_ui = null, datum/ui_state/state = default_state)
+4 -14
View File
@@ -101,15 +101,15 @@
if(exchange_parts(user, O))
return
if (panel_open)
if(panel_open)
if(istype(O, /obj/item/weapon/crowbar))
materials.retrieve_all()
default_deconstruction_crowbar(O)
return 1
else
attack_hand(user)
else if(is_wire_tool(O))
wires.interact(user)
return 1
if (stat)
if(stat)
return 1
var/material_amount = materials.get_item_material_amount(O)
@@ -140,16 +140,6 @@
busy = 0
src.updateUsrDialog()
/obj/machinery/autolathe/attack_paw(mob/user)
return attack_hand(user)
/obj/machinery/autolathe/attack_hand(mob/user)
if(panel_open && !isAI(user))
return wires.interact(user)
if(..(user, 0))
return
interact(user)
/obj/machinery/autolathe/Topic(href, href_list)
if(..())
return
+12 -21
View File
@@ -72,7 +72,6 @@
var/lastused_environ = 0
var/lastused_total = 0
var/main_status = 0
var/wiresexposed = 0
powernet = 0 // set so that APCs aren't found as powernet nodes //Hackish, Horrible, was like this before I changed it :(
var/malfhack = 0 //New var for my changes to AI malf. --NeoFite
var/mob/living/silicon/ai/malfai = null //See above --NeoFite
@@ -302,7 +301,7 @@
update_state |= UPSTATE_OPENED2
else if(emagged || malfai)
update_state |= UPSTATE_BLUESCREEN
else if(wiresexposed)
else if(panel_open)
update_state |= UPSTATE_WIREEXP
if(update_state <= 1)
update_state |= UPSTATE_ALLGOOD
@@ -439,8 +438,8 @@
else if(emagged)
user << "<span class='warning'>The interface is broken!</span>"
else
wiresexposed = !wiresexposed
user << "The wires have been [wiresexposed ? "exposed" : "unexposed"]"
panel_open = !panel_open
user << "The wires have been [panel_open ? "exposed" : "unexposed"]"
update_icon()
else if (istype(W, /obj/item/weapon/card/id)||istype(W, /obj/item/device/pda)) // trying to unlock the interface with an ID card
@@ -448,7 +447,7 @@
user << "<span class='warning'>The interface is broken!</span>"
else if(opened)
user << "<span class='warning'>You must close the cover to swipe an ID card!</span>"
else if(wiresexposed)
else if(panel_open)
user << "<span class='warning'>You must close the panel!</span>"
else if(stat & (BROKEN|MAINT))
user << "<span class='warning'>Nothing happens!</span>"
@@ -546,10 +545,9 @@
opened = 1
update_icon()
else
if(!opened && wiresexposed && is_wire_tool(W))
return attack_hand(user)
..()
if( ((stat & BROKEN) || malfhack) && !opened && W.force >= 5 && W.w_class >= 3 && prob(20) )
if(panel_open && !opened && is_wire_tool(W))
wires.interact(user)
if(((stat & BROKEN) || malfhack) && !opened && W.force >= 5 && W.w_class >= 3 && prob(20))
opened = 2
user.visible_message("<span class='warning'>[user.name] has knocked down the APC cover with the [W.name].</span>", \
"<span class='danger'>You knock down the APC cover with your [W.name]!</span>", \
@@ -560,7 +558,7 @@
if(!emagged && !malfhack)
if(opened)
user << "<span class='warning'>You must close the cover to swipe an ID card!</span>"
else if(wiresexposed)
else if(panel_open)
user << "<span class='warning'>You must close the panel first!</span>"
else if(stat & (BROKEN|MAINT))
user << "<span class='warning'>Nothing happens!</span>"
@@ -599,12 +597,12 @@
user.visible_message("<span class='danger'>[user.name] slashes at the [src.name]!</span>", "<span class='notice'>You slash at the [src.name]!</span>")
playsound(src.loc, 'sound/weapons/slash.ogg', 100, 1)
if(beenhit >= pick(3, 4) && wiresexposed != 1)
wiresexposed = 1
if(beenhit >= pick(3, 4) && panel_open != 1)
panel_open = 1
update_icon()
visible_message("<span class='danger'>The [src.name]'s cover flies open, exposing the wires!</span>")
else if(wiresexposed == 1 && !wires.is_all_cut())
else if(panel_open == 1 && !wires.is_all_cut())
wires.cut_all()
update_icon()
visible_message("<span class='danger'>The [src.name]'s wires are shredded!</span>")
@@ -612,13 +610,6 @@
beenhit += 1
return
/obj/machinery/power/apc/interact(mob/user)
if(wiresexposed && !istype(user, /mob/living/silicon/ai))
wires.interact(user)
else
ui_interact(user)
/obj/machinery/power/apc/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, \
datum/tgui/master_ui = null, datum/ui_state/state = default_state)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
@@ -723,7 +714,7 @@
) \
)
if(!loud)
user << "<span class='danger'>\The [src] has AI control disabled!</span>"
user << "<span class='danger'>\The [src] has eee disabled!</span>"
return FALSE
return TRUE