Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIRROR] Fix Windoor Emagging #297

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion code/game/machinery/doors/_door.dm
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,10 @@
else if(src.health < src.maxhealth * 3/4)
to_chat(user, "\The [src] shows signs of damage!")

var/mob/living/carbon/human/H = user
if (emagged && istype(H) && H.skill_check(SKILL_COMPUTER, SKILL_ADEPT))
to_chat(user, SPAN_WARNING("\The [src]'s control panel looks fried."))

/obj/machinery/door/set_broken(new_state, cause)
. = ..()
if(. && new_state && (cause & MACHINE_BROKEN_GENERIC))
Expand Down Expand Up @@ -553,4 +557,4 @@
/decl/public_access/public_method/close_door
name = "close door"
desc = "Closes the door if possible."
call_proc = /obj/machinery/door/proc/close
call_proc = /obj/machinery/door/proc/close
50 changes: 33 additions & 17 deletions code/game/machinery/doors/windowdoor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
health = 150
visible = 0.0
use_power = POWER_USE_OFF
stat_immune = NOSCREEN | NOINPUT | NOPOWER
uncreated_component_parts = null
atom_flags = ATOM_FLAG_NO_TEMP_CHANGE | ATOM_FLAG_CHECKS_BORDER
opacity = 0
Expand Down Expand Up @@ -57,19 +58,19 @@
if(istype(bot))
if(density && src.check_access(bot.botcard))
open()
sleep(50)
close()
addtimer(CALLBACK(src, .proc/close), 50, TIMER_UNIQUE | TIMER_OVERRIDE)
return
var/mob/M = AM // we've returned by here if M is not a mob
if (src.operating)
return
if (src.density && (!issmall(M) || ishuman(M) || issilicon(M)) && src.allowed(AM))
open()
var/open_timer
if(src.check_access(null))
sleep(50)
open_timer = 50
else //secure doors close faster
sleep(20)
close()
open_timer = 20
addtimer(CALLBACK(src, .proc/close), open_timer, TIMER_UNIQUE | TIMER_OVERRIDE)
return

/obj/machinery/door/window/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
Expand Down Expand Up @@ -98,16 +99,18 @@
icon_state = "[src.base_state]open"
flick("[src.base_state]opening", src)
playsound(src.loc, 'sound/machines/windowdoor.ogg', 100, 1)
sleep(10)
addtimer(CALLBACK(src, .proc/open_final), 10, TIMER_UNIQUE | TIMER_OVERRIDE)

return 1

/obj/machinery/door/window/proc/open_final()
explosion_resistance = 0
set_density(0)
set_density(FALSE)
update_icon()
update_nearby_tiles()

if(operating == 1) //emag again
src.operating = 0
return 1
operating = 0

/obj/machinery/door/window/close()
if (src.operating)
Expand All @@ -120,10 +123,12 @@
explosion_resistance = initial(explosion_resistance)
update_nearby_tiles()

sleep(10)
src.operating = 0
addtimer(CALLBACK(src, .proc/close_final), 10, TIMER_UNIQUE | TIMER_OVERRIDE)
return 1

/obj/machinery/door/window/proc/close_final()
operating = 0

/obj/machinery/door/window/take_damage(var/damage)
src.health = max(0, src.health - damage)
if (src.health <= 0)
Expand All @@ -141,12 +146,20 @@
return ..()

/obj/machinery/door/window/emag_act(var/remaining_charges, var/mob/user)
if (density && operable())
operating = -1
flick("[src.base_state]spark", src)
sleep(6)
open()
return 1
if (emagged)
to_chat(user, SPAN_WARNING("\The [src] has already been locked open."))
return FALSE
if (!operable())
to_chat(user, SPAN_WARNING("\The [src] is not functioning and doesn't respond to your attempts to short the circuitry."))
return FALSE

operating = -1
emagged = TRUE
to_chat(user, SPAN_NOTICE("You short out \the [src]'s internal circuitry, locking it open!"))
if (density)
flick("[base_state]spark", src)
addtimer(CALLBACK(src, .proc/open), 6, TIMER_UNIQUE | TIMER_OVERRIDE)
return TRUE

/obj/machinery/door/emp_act(severity)
if(prob(20/severity))
Expand All @@ -170,6 +183,9 @@
if (src.density)
open()
else
if (emagged)
to_chat(user, SPAN_WARNING("\The [src] seems to be stuck and refuses to close!"))
return
close()

else if (src.density)
Expand Down
39 changes: 39 additions & 0 deletions html/changelogs/sierrakomodo-emag-windoors.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
################################
# Example Changelog File
#
# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb.
#
# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
# When it is, any changes listed below will disappear.
#
# Valid Prefixes:
# bugfix
# wip (For works in progress)
# tweak
# soundadd
# sounddel
# rscadd (general adding of nice things)
# rscdel (general deleting of nice things)
# imageadd
# imagedel
# maptweak
# spellcheck (typo fixes)
# experiment
# admin
#################################

# Your name.
author: SierraKomodo

# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
delete-after: True

# Any changes you've made. See valid prefix list above.
# INDENT WITH TWO SPACES. NOT TABS. SPACES.
# SCREW THIS UP AND IT WON'T WORK.
# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries.
# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog.
changes:
- bugfix: "Windoors are now properly emag-able."
- tweak: "Emagged windoors will now provide feedback that they are broken when you try to close them."
- tweak: "You can now tell if a door's control board has been fried by examining the door with an IT skill of trained or higher."