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

Adds Watchtowers #7754

Open
wants to merge 39 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
0e01aec
a
Git-Nivrak Dec 6, 2024
6762e42
b
Git-Nivrak Dec 6, 2024
ab32443
c
Git-Nivrak Dec 6, 2024
3ad6920
d
Git-Nivrak Dec 6, 2024
b8cdc4e
tabs
Git-Nivrak Dec 6, 2024
31d2850
call parent
Git-Nivrak Dec 6, 2024
d533593
Update watchtower.dm
Git-Nivrak Dec 6, 2024
afa79ec
a
Git-Nivrak Dec 6, 2024
8c9754a
fixes
Git-Nivrak Dec 6, 2024
e66f671
polish
Git-Nivrak Dec 6, 2024
4c5d444
can't build under roof
Git-Nivrak Dec 6, 2024
0702a87
Update girders.dm
Git-Nivrak Dec 6, 2024
cfa5cb4
macros xd
Git-Nivrak Dec 6, 2024
8bbf870
Update girders.dm
Git-Nivrak Dec 7, 2024
f1b6800
replaces shitty blockers with tent blockers
Git-Nivrak Dec 7, 2024
e1caa54
removes space
Git-Nivrak Dec 7, 2024
8ad293d
remove unnecessary qdels
Git-Nivrak Dec 7, 2024
a7bc346
Update watchtower.dm
Git-Nivrak Dec 8, 2024
7cc81f9
rerun checks
Git-Nivrak Dec 8, 2024
86cf740
code review
Git-Nivrak Dec 9, 2024
bc3b88f
review2
Git-Nivrak Dec 9, 2024
bf0ed79
some fixes
Git-Nivrak Dec 10, 2024
848bb50
and a few more
Git-Nivrak Dec 10, 2024
f9b80bd
fixes binocs and linter
Git-Nivrak Dec 10, 2024
8140500
remember to unregister signals
Git-Nivrak Dec 10, 2024
5883639
fixes binoculars
Git-Nivrak Dec 10, 2024
c49bf02
linter moment
Git-Nivrak Dec 10, 2024
127fe8c
fixes layering issues
Git-Nivrak Dec 10, 2024
770a00f
More changes and fixes
Git-Nivrak Dec 10, 2024
37c3542
fixes dirlock for harry
Git-Nivrak Dec 11, 2024
14a79ee
fixes a bug with drag pulling
Git-Nivrak Dec 14, 2024
7c00cc4
Update girders.dm
Git-Nivrak Dec 17, 2024
c67a68d
Apply suggestions from code review
Git-Nivrak Dec 17, 2024
6147957
Update watchtower.dm
Git-Nivrak Dec 18, 2024
3598bc0
review
Git-Nivrak Dec 28, 2024
1c2c49d
fixes
Git-Nivrak Dec 28, 2024
9a5921d
cherry on top
Git-Nivrak Dec 28, 2024
b030df6
sprite fixes
Git-Nivrak Jan 24, 2025
2ca0706
Merge branch 'master' into watchtower
Git-Nivrak Jan 24, 2025
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
3 changes: 3 additions & 0 deletions code/__DEFINES/traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -509,3 +509,6 @@ GLOBAL_LIST(trait_name_map)
#define HACKED_TRAIT "hacked"
/// traits from chloroform usage
#define CHLOROFORM_TRAIT "chloroform"

// from watchtower.dm
#define TRAIT_ON_WATCHTOWER "on_watchtower"
42 changes: 42 additions & 0 deletions code/datums/elements/bullet_trait/direct_only.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// This trait makes the projectile only hit targets directly clicked

/datum/element/bullet_trait_direct_only
// General bullet trait vars
element_flags = ELEMENT_DETACH|ELEMENT_BESPOKE
id_arg_index = 2

/datum/element/bullet_trait_direct_only/Attach(datum/target)
. = ..()
if(!istype(target, /obj/projectile))
return ELEMENT_INCOMPATIBLE

RegisterSignal(target, COMSIG_BULLET_CHECK_MOB_SKIPPING, PROC_REF(check_distance))

/datum/element/bullet_trait_direct_only/Detach(datum/target)
UnregisterSignal(target, COMSIG_BULLET_CHECK_MOB_SKIPPING)

return ..()

/datum/element/bullet_trait_direct_only/proc/check_distance(obj/projectile/P, mob/living/carbon/human/projectile_target)
SIGNAL_HANDLER

if(P.original != projectile_target)
Git-Nivrak marked this conversation as resolved.
Show resolved Hide resolved
return COMPONENT_SKIP_MOB

/datum/element/bullet_trait_direct_only/watchtower
Git-Nivrak marked this conversation as resolved.
Show resolved Hide resolved

/datum/element/bullet_trait_direct_only/watchtower/check_distance(obj/projectile/P, mob/living/carbon/human/projectile_target)
if(!HAS_TRAIT(P.firer, TRAIT_ON_WATCHTOWER))
if(!istype(P.firer, /mob))
return
var/mob/firer = P.firer
var/obj/item/weapon/gun/gun = firer.get_inactive_hand()
if(istype(gun))
gun.remove_bullet_traits(list("watchtower_arc"))

Git-Nivrak marked this conversation as resolved.
Show resolved Hide resolved
gun = firer.get_active_hand()
if(istype(gun))
gun.remove_bullet_traits(list("watchtower_arc"))
return

return ..()
34 changes: 34 additions & 0 deletions code/game/objects/structures/girders.dm
Git-Nivrak marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,33 @@
if(STATE_REINFORCED_WALL)
return do_reinforced_wall(W, user)
if(STATE_DISPLACED)
if(HAS_TRAIT(W, TRAIT_TOOL_BLOWTORCH))
var/area/area = get_area(src)
if(CEILING_IS_PROTECTED(area.ceiling, CEILING_GLASS))
to_chat(user, SPAN_WARNING("Watchtowers can only be built in the open."))
return

var/list/turf/turfs = CORNER_BLOCK(get_turf(src), 2, 2)
var/list/obj/structure/girder/girders = list()

for(var/turf/current_turf in turfs)
var/found_girder = FALSE
for(var/obj/structure/girder/girder in current_turf)
if(girder.state == STATE_DISPLACED)
found_girder = TRUE
girders += girder
if(!found_girder)
return


if(!do_after(user,30, INTERRUPT_ALL|BEHAVIOR_IMMOBILE, BUSY_ICON_BUILD))
Git-Nivrak marked this conversation as resolved.
Show resolved Hide resolved
return

new /obj/structure/watchtower(loc)

for(var/list/obj/structure/girder as anything in girders)
qdel(girder)

if(HAS_TRAIT(W, TRAIT_TOOL_CROWBAR))
var/turf/open/floor = loc
if(!floor.allow_construction)
Expand Down Expand Up @@ -393,6 +420,13 @@
anchored = FALSE
state = STATE_DISPLACED

/obj/structure/girder/broken
health = 0
icon_state = "girder_damaged"
anchored = FALSE
density = FALSE
state = STATE_STANDARD

/obj/structure/girder/reinforced
icon_state = "reinforced"
health = 500
Expand Down
11 changes: 6 additions & 5 deletions code/modules/movement/movement.dm
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,19 @@
return NO_BLOCKED_MOVEMENT

/atom/movable/Move(NewLoc, direct)
// If Move is not valid, exit
if (SEND_SIGNAL(src, COMSIG_MOVABLE_PRE_MOVE, NewLoc) & COMPONENT_CANCEL_MOVE)
return FALSE

var/atom/oldloc = loc
var/old_dir = dir

. = ..()
if (flags_atom & DIRLOCK)
setDir(old_dir)
else if(old_dir != direct)
setDir(direct)

// If Move is not valid, exit
if (SEND_SIGNAL(src, COMSIG_MOVABLE_PRE_MOVE, NewLoc) & COMPONENT_CANCEL_MOVE)
return FALSE

. = ..()
l_move_time = world.time
if ((oldloc != loc && oldloc && oldloc.z == z))
last_move_dir = get_dir(oldloc, loc)
Expand Down
45 changes: 45 additions & 0 deletions code/modules/watchtower/blockers.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/// Invisible Blocker Walls, they link up with the watchtower and collapse with it
/obj/structure/blocker/watchtower
name = "Watchtower Blocker"
icon = 'icons/obj/structures/barricades.dmi'
icon_state = "folding_0" // for map editing only
flags_atom = ON_BORDER
invisibility = INVISIBILITY_MAXIMUM
density = TRUE
opacity = FALSE // Unfortunately this doesn't behave as we'd want with ON_BORDER so we can't make tent opaque
throwpass = TRUE // Needs this so xenos can attack through the blocker and hit the tents or people inside
/// The watchtower this blocker relates to, will be destroyed along with it
var/obj/structure/watchtower/linked_watchtower

/obj/structure/blocker/watchtower/Initialize(mapload, ...)
. = ..()
icon_state = null
linked_watchtower = locate(/obj/structure/watchtower) in loc
if(!linked_watchtower)
return INITIALIZE_HINT_QDEL
RegisterSignal(linked_watchtower, COMSIG_PARENT_QDELETING, PROC_REF(collapse))

/obj/structure/blocker/watchtower/Destroy(force)
. = ..()
linked_watchtower = null

/obj/structure/blocker/watchtower/proc/collapse()
SIGNAL_HANDLER
qdel(src)

/obj/structure/blocker/watchtower/initialize_pass_flags(datum/pass_flags_container/PF)
..()
if (PF)
PF.flags_can_pass_all = NONE
PF.flags_can_pass_front = NONE
PF.flags_can_pass_behind = NONE

/obj/structure/blocker/watchtower/get_projectile_hit_boolean(obj/projectile/P)
. = ..()
return FALSE // Always fly through the watchtower

//Blocks all direction, basically an invisible wall
/obj/structure/blocker/watchtower/full_tile
flags_atom = NO_FLAGS
icon = 'icons/landmarks.dmi'
icon_state = "invisible_wall"
Loading
Loading