diff --git a/code/datums/wires/airlock.dm b/code/datums/wires/airlock.dm
index f0622c6d516..88e7ba1c65e 100644
--- a/code/datums/wires/airlock.dm
+++ b/code/datums/wires/airlock.dm
@@ -3,6 +3,7 @@
/datum/wires/airlock
holder_type = /obj/machinery/door/airlock
wire_count = 12
+ window_y = 540
var/const/AIRLOCK_WIRE_IDSCAN = 1
var/const/AIRLOCK_WIRE_MAIN_POWER1 = 2
@@ -19,6 +20,10 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048
/datum/wires/airlock/CanUse(var/mob/living/L)
var/obj/machinery/door/airlock/A = holder
+ if(!istype(L, /mob/living/silicon))
+ if(A.isElectrified())
+ if(A.shock(L, 100))
+ return 0
if(A.p_open)
return 1
return 0
@@ -36,6 +41,7 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048
/datum/wires/airlock/UpdateCut(var/index, var/mended)
+
var/obj/machinery/door/airlock/A = holder
switch(index)
if(AIRLOCK_WIRE_MAIN_POWER1, AIRLOCK_WIRE_MAIN_POWER2)
@@ -44,19 +50,16 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048
//Cutting either one disables the main door power, but unless backup power is also cut, the backup power re-powers the door in 10 seconds. While unpowered, the door may be crowbarred open, but bolts-raising will not work. Cutting these wires may electocute the user.
A.loseMainPower()
A.shock(usr, 50)
- A.updateUsrDialog()
else
if((!IsIndexCut(AIRLOCK_WIRE_MAIN_POWER1)) && (!IsIndexCut(AIRLOCK_WIRE_MAIN_POWER2)))
A.regainMainPower()
A.shock(usr, 50)
- A.updateUsrDialog()
if(AIRLOCK_WIRE_BACKUP_POWER1, AIRLOCK_WIRE_BACKUP_POWER2)
if(mended)
if((!IsIndexCut(AIRLOCK_WIRE_BACKUP_POWER1)) && (!IsIndexCut(AIRLOCK_WIRE_BACKUP_POWER2)))
A.regainBackupPower()
A.shock(usr, 50)
- A.updateUsrDialog()
if(AIRLOCK_WIRE_DOOR_BOLTS)
@@ -65,7 +68,6 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048
if(A.locked!=1)
A.locked = 1
A.update_icon()
- A.updateUsrDialog()
if(AIRLOCK_WIRE_BACKUP_POWER1, AIRLOCK_WIRE_BACKUP_POWER2)
@@ -73,7 +75,6 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048
//Cutting either one disables the backup door power (allowing it to be crowbarred open, but disabling bolts-raising), but may electocute the user.
A.loseBackupPower()
A.shock(usr, 50)
- A.updateUsrDialog()
if(AIRLOCK_WIRE_AI_CONTROL)
@@ -90,8 +91,6 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048
else if(A.aiControlDisabled == 2)
A.aiControlDisabled = -1
- A.updateUsrDialog()
-
if(AIRLOCK_WIRE_ELECTRIFY)
if(!mended)
@@ -99,29 +98,28 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048
if(A.secondsElectrified != -1)
A.shockedby += text("\[[time_stamp()]\][usr](ckey:[usr.ckey])")
usr.attack_log += text("\[[time_stamp()]\] Electrified the [A.name] at [A.x] [A.y] [A.z]")
- A.secondsElectrified = -1
+ A.secondsElectrified = -1
else
if(A.secondsElectrified == -1)
A.secondsElectrified = 0
+ return // Don't update the dialog.
if (AIRLOCK_WIRE_SAFETY)
A.safe = mended
- A.updateUsrDialog()
if(AIRLOCK_WIRE_SPEED)
A.autoclose = mended
if(mended)
if(!A.density)
A.close()
- A.updateUsrDialog()
if(AIRLOCK_WIRE_LIGHT)
A.lights = mended
A.update_icon()
- A.updateUsrDialog()
/datum/wires/airlock/UpdatePulsed(var/index)
+
var/obj/machinery/door/airlock/A = holder
switch(index)
if(AIRLOCK_WIRE_IDSCAN)
@@ -138,13 +136,11 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048
A.locked = 1
for(var/mob/M in range(1, A))
M << "You hear a click from the bottom of the door."
- A.updateUsrDialog()
else
if(A.arePowerSystemsOn()) //only can raise bolts if power's on
A.locked = 0
for(var/mob/M in range(1, A))
M << "You hear a click from the bottom of the door."
- A.updateUsrDialog()
A.update_icon()
if(AIRLOCK_WIRE_BACKUP_POWER1 || AIRLOCK_WIRE_BACKUP_POWER2)
@@ -155,13 +151,14 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048
A.aiControlDisabled = 1
else if(A.aiControlDisabled == -1)
A.aiControlDisabled = 2
- A.updateDialog()
+
spawn(10)
- if(A.aiControlDisabled == 1)
- A.aiControlDisabled = 0
- else if(A.aiControlDisabled == 2)
- A.aiControlDisabled = -1
- A.updateDialog()
+ if(A)
+ if(A.aiControlDisabled == 1)
+ A.aiControlDisabled = 0
+ else if(A.aiControlDisabled == 2)
+ A.aiControlDisabled = -1
+
if(AIRLOCK_WIRE_ELECTRIFY)
//one wire for electrifying the door. Sending a pulse through this electrifies the door for 30 seconds.
if(A.secondsElectrified==0)
@@ -169,13 +166,14 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048
usr.attack_log += text("\[[time_stamp()]\] Electrified the [A.name] at [A.x] [A.y] [A.z]")
A.secondsElectrified = 30
spawn(10)
- //TODO: Move this into process() and make pulsing reset secondsElectrified to 30
- while (A.secondsElectrified>0)
- A.secondsElectrified-=1
- if(A.secondsElectrified<0)
- A.secondsElectrified = 0
-// A.updateUsrDialog() //Commented this line out to keep the airlock from clusterfucking you with electricity. --NeoFite
- sleep(10)
+ if(A)
+ //TODO: Move this into process() and make pulsing reset secondsElectrified to 30
+ while (A.secondsElectrified>0)
+ A.secondsElectrified-=1
+ if(A.secondsElectrified<0)
+ A.secondsElectrified = 0
+ sleep(10)
+ return
if(AIRLOCK_WIRE_OPEN_DOOR)
//tries to open the door without ID
//will succeed only if the ID wire is cut or the door requires no access
@@ -186,12 +184,9 @@ var/const/AIRLOCK_WIRE_LIGHT = 2048
A.safe = !A.safe
if(!A.density)
A.close()
- A.updateUsrDialog()
if(AIRLOCK_WIRE_SPEED)
A.normalspeed = !A.normalspeed
- A.updateUsrDialog()
if(AIRLOCK_WIRE_LIGHT)
- A.lights = !A.lights
- A.updateUsrDialog()
\ No newline at end of file
+ A.lights = !A.lights
\ No newline at end of file
diff --git a/code/datums/wires/apc.dm b/code/datums/wires/apc.dm
index 454dbb2066f..b0b29b30001 100644
--- a/code/datums/wires/apc.dm
+++ b/code/datums/wires/apc.dm
@@ -4,8 +4,8 @@
var/const/APC_WIRE_IDSCAN = 1
var/const/APC_WIRE_MAIN_POWER1 = 2
-var/const/APC_WIRE_MAIN_POWER2 = 3
-var/const/APC_WIRE_AI_CONTROL = 4
+var/const/APC_WIRE_MAIN_POWER2 = 4
+var/const/APC_WIRE_AI_CONTROL = 8
/datum/wires/apc/GetInteractWindow()
//var/obj/machinery/power/apc/A = holder
@@ -26,7 +26,7 @@ var/const/APC_WIRE_AI_CONTROL = 4
if(APC_WIRE_IDSCAN)
A.locked = 0
- A.updateDialog()
+
spawn(300)
A.locked = 1
A.updateDialog()
@@ -34,20 +34,22 @@ var/const/APC_WIRE_AI_CONTROL = 4
if (APC_WIRE_MAIN_POWER1, APC_WIRE_MAIN_POWER2)
if(A.shorted == 0)
A.shorted = 1
- A.updateDialog()
+
spawn(1200)
if(A.shorted == 1)
A.shorted = 0
- A.updateDialog()
+ A.updateDialog()
if (APC_WIRE_AI_CONTROL)
if (A.aidisabled == 0)
A.aidisabled = 1
- A.updateDialog()
+
spawn(10)
if (A.aidisabled == 1)
A.aidisabled = 0
- A.updateDialog()
+ A.updateDialog()
+
+ A.updateDialog()
/datum/wires/apc/UpdateCut(var/index, var/mended)
var/obj/machinery/power/apc/A = holder
@@ -58,11 +60,10 @@ var/const/APC_WIRE_AI_CONTROL = 4
if(!mended)
A.shock(usr, 50)
A.shorted = 1
- A.updateDialog()
+
else if(!IsIndexCut(APC_WIRE_MAIN_POWER1) && !IsIndexCut(APC_WIRE_MAIN_POWER2))
A.shorted = 0
A.shock(usr, 50)
- A.updateDialog()
if(APC_WIRE_AI_CONTROL)
@@ -71,4 +72,5 @@ var/const/APC_WIRE_AI_CONTROL = 4
A.aidisabled = 1
else
if (A.aidisabled == 1)
- A.aidisabled = 0
\ No newline at end of file
+ A.aidisabled = 0
+ A.updateDialog()
\ No newline at end of file
diff --git a/code/datums/wires/wires.dm b/code/datums/wires/wires.dm
index 8ca8541803a..cce892e8705 100644
--- a/code/datums/wires/wires.dm
+++ b/code/datums/wires/wires.dm
@@ -23,8 +23,8 @@ var/list/wireColours = list("red", "blue", "green", "black", "orange", "brown",
var/table_options = " align='center'"
var/row_options1 = " width='90px'"
var/row_options2 = " width='200px'"
- var/window_x = 200
- var/window_y = 500
+ var/window_x = 350
+ var/window_y = 450
/datum/wires/New(var/atom/holder)
..()
@@ -64,12 +64,15 @@ var/list/wireColours = list("red", "blue", "green", "black", "orange", "brown",
src.wires[colour] = index
//wires = shuffle(wires)
+
/datum/wires/proc/Interact(var/mob/living/user)
var/html = null
- if(holder && CanUse())
+ if(holder && CanUse(user))
html = GetInteractWindow()
- user << browse(html, "window=wires")
+ if(html)
+ user.set_machine(holder)
+ user << browse(html, "window=wires;size=[window_x]x[window_y]")
onclose(user, "wires")
/datum/wires/proc/GetInteractWindow(var/get_title = 1, var/allow_close = 1)
@@ -137,6 +140,7 @@ var/list/wireColours = list("red", "blue", "green", "black", "orange", "brown",
if(href_list["close"])
usr << browse(null, "window=wires")
+ usr.unset_machine(holder)
//
// Overridable Procs
diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm
index 7ef01cc7eb1..a0a730b0e93 100644
--- a/code/game/machinery/doors/airlock.dm
+++ b/code/game/machinery/doors/airlock.dm
@@ -421,8 +421,8 @@ About the new airlock wires panel:
s.start() //sparks always.
if(electrocute_mob(user, get_area(src), src))
hasShocked = 1
- sleep(10)
- hasShocked = 0
+ spawn(10)
+ hasShocked = 0
return 1
else
return 0
@@ -631,7 +631,7 @@ About the new airlock wires panel:
return src.attack_hand(user)
/obj/machinery/door/airlock/attack_hand(mob/user as mob)
- if(!istype(usr, /mob/living/silicon))
+ if(!istype(user, /mob/living/silicon))
if(src.isElectrified())
if(src.shock(user, 100))
return
diff --git a/code/game/objects/effects/aliens.dm b/code/game/objects/effects/aliens.dm
index 523e0ff72eb..c35e262b64a 100644
--- a/code/game/objects/effects/aliens.dm
+++ b/code/game/objects/effects/aliens.dm
@@ -376,6 +376,7 @@ Alien plants should do something if theres a lot of poison
var/status = GROWING //can be GROWING, GROWN or BURST; all mutually exclusive
New()
+ new /obj/item/clothing/mask/facehugger(src)
if(aliens_allowed)
..()
spawn(rand(MIN_GROWTH_TIME,MAX_GROWTH_TIME))
@@ -410,25 +411,26 @@ Alien plants should do something if theres a lot of poison
proc/Grow()
icon_state = "egg"
status = GROWN
- new /obj/item/clothing/mask/facehugger(src)
return
proc/Burst(var/kill = 1) //drops and kills the hugger if any is remaining
if(status == GROWN || status == GROWING)
- var/obj/item/clothing/mask/facehugger/child = GetFacehugger()
+
icon_state = "egg_hatched"
flick("egg_opening", src)
status = BURSTING
spawn(15)
status = BURST
- loc.contents += child//need to write the code for giving it to the alien later
- if(kill && istype(child))
- child.Die()
- else
- for(var/mob/M in range(1,src))
- if(CanHug(M))
- child.Attach(M)
- break
+ var/obj/item/clothing/mask/facehugger/child = GetFacehugger()
+ if(child)
+ child.loc = get_turf(src)
+ if(kill && istype(child))
+ child.Die()
+ else
+ for(var/mob/M in range(1,src))
+ if(CanHug(M))
+ child.Attach(M)
+ break
/obj/effect/alien/egg/bullet_act(var/obj/item/projectile/Proj)
@@ -439,8 +441,7 @@ Alien plants should do something if theres a lot of poison
/obj/effect/alien/egg/attackby(var/obj/item/weapon/W, var/mob/user)
- if(health <= 0)
- return
+
if(W.attack_verb.len)
src.visible_message("\red \The [src] has been [pick(W.attack_verb)] with \the [W][(user ? " by [user]." : ".")]")
else
@@ -460,7 +461,10 @@ Alien plants should do something if theres a lot of poison
/obj/effect/alien/egg/proc/healthcheck()
if(health <= 0)
- Burst()
+ if(status != BURST && status != BURSTING)
+ Burst()
+ else if(status == BURST && prob(50))
+ del(src) // Remove the egg after it has been hit after bursting.
/obj/effect/alien/egg/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume)
if(exposed_temperature > 500)