-
Notifications
You must be signed in to change notification settings - Fork 270
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
151 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
/datum/supply_pack/engineering/shield_sat | ||
special = FALSE | ||
access_view = ACCESS_ENGINEERING | ||
contains = list(/obj/item/meteor_shield_capsule = 5) | ||
|
||
/datum/supply_pack/engineering/shield_sat_control | ||
special = FALSE | ||
access_view = ACCESS_ENGINEERING |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
monkestation/code/modules/meteor_shield/meteor_shield_capsule.dm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/obj/item/meteor_shield_capsule | ||
name = "meteor shield satellite capsule" | ||
desc = "A bluespace capsule which a single unit of meteor shield satellite is compressed within. If you activate this capsule, a meteor shield satellite will pop out. You still need to install these." | ||
icon_state = "capsule" | ||
icon = 'icons/obj/mining.dmi' | ||
w_class = WEIGHT_CLASS_TINY | ||
|
||
/obj/item/meteor_shield_capsule/Initialize(mapload) | ||
. = ..() | ||
AddComponent(/datum/component/deployable, 5 SECONDS, /obj/machinery/satellite/meteor_shield, delete_on_use = TRUE) |
40 changes: 40 additions & 0 deletions
40
monkestation/code/modules/meteor_shield/meteor_shield_coverage.dm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#define TRAIT_METEOR_SHIELD_FIELD_MONITORED "meteor_shield_field_monitored" | ||
|
||
GLOBAL_LIST_EMPTY(meteor_shielded_turfs) | ||
|
||
/// Stupid element to handle tracking which turfs are in a meteor sat's range, | ||
/// without messing up in situations like with overlapping ranges. | ||
/datum/element/meteor_shield_coverage | ||
// Detach whenever destroyed, so we can ensure there's no hanging references to the turf in GLOB.meteor_shielded_turfs | ||
element_flags = ELEMENT_DETACH_ON_HOST_DESTROY | ||
/// Signals to attach to all turfs. | ||
var/static/list/attach_signals = list( | ||
SIGNAL_ADDTRAIT(TRAIT_COVERED_BY_METEOR_SHIELD), | ||
SIGNAL_REMOVETRAIT(TRAIT_COVERED_BY_METEOR_SHIELD) | ||
) | ||
|
||
/datum/element/meteor_shield_coverage/Attach(turf/open/target) | ||
. = ..() | ||
if(!isgroundlessturf(target)) | ||
return ELEMENT_INCOMPATIBLE | ||
// We use a trait to prevent duplicate assignments. | ||
if(!HAS_TRAIT(target, TRAIT_METEOR_SHIELD_FIELD_MONITORED)) | ||
ADD_TRAIT(target, TRAIT_METEOR_SHIELD_FIELD_MONITORED, ELEMENT_TRAIT(type)) | ||
RegisterSignals(target, attach_signals, PROC_REF(update_global_shield_list)) | ||
GLOB.meteor_shielded_turfs += target | ||
|
||
/datum/element/meteor_shield_coverage/Detach(turf/open/target) | ||
REMOVE_TRAIT(target, TRAIT_METEOR_SHIELD_FIELD_MONITORED, ELEMENT_TRAIT(type)) | ||
UnregisterSignal(target, attach_signals) | ||
GLOB.meteor_shielded_turfs -= target | ||
return ..() | ||
|
||
/datum/element/meteor_shield_coverage/proc/update_global_shield_list(turf/open/source) | ||
SIGNAL_HANDLER | ||
if(!isgroundlessturf(source) || !HAS_TRAIT(source, TRAIT_COVERED_BY_METEOR_SHIELD)) | ||
source.RemoveElement(/datum/element/meteor_shield_coverage) | ||
|
||
/proc/get_meteor_sat_coverage() as num | ||
return length(GLOB.meteor_shielded_turfs) | ||
|
||
#undef TRAIT_METEOR_SHIELD_FIELD_MONITORED |
29 changes: 29 additions & 0 deletions
29
monkestation/code/modules/meteor_shield/meteor_shield_field.dm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
GLOBAL_LIST_EMPTY_TYPED(meteor_shield_fields, /datum/proximity_monitor/advanced/meteor_shield) | ||
|
||
/// A proximity monitor field that marks openspace turfs within as being covered by a meteor shield. | ||
/datum/proximity_monitor/advanced/meteor_shield | ||
edge_is_a_field = TRUE | ||
|
||
/datum/proximity_monitor/advanced/meteor_shield/New(atom/_host, range, _ignore_if_not_on_turf) | ||
. = ..() | ||
GLOB.meteor_shield_fields += src | ||
|
||
/datum/proximity_monitor/advanced/meteor_shield/Destroy() | ||
GLOB.meteor_shield_fields -= src | ||
return ..() | ||
|
||
/datum/proximity_monitor/advanced/meteor_shield/setup_field_turf(turf/open/target) | ||
if(!isgroundlessturf(target)) | ||
return | ||
var/obj/machinery/satellite/meteor_shield/host_sat = host | ||
if(host_sat.check_los(get_turf(host_sat), target)) | ||
ADD_TRAIT(target, TRAIT_COVERED_BY_METEOR_SHIELD, REF(src)) | ||
target.AddElement(/datum/element/meteor_shield_coverage) | ||
|
||
/datum/proximity_monitor/advanced/meteor_shield/cleanup_field_turf(turf/target) | ||
REMOVE_TRAIT(target, TRAIT_COVERED_BY_METEOR_SHIELD, REF(src)) | ||
|
||
/datum/proximity_monitor/advanced/meteor_shield/set_range(range, force_rebuild) | ||
. = ..() | ||
if(.) | ||
recalculate_field(full_recalc = TRUE) |
44 changes: 44 additions & 0 deletions
44
monkestation/code/modules/meteor_shield/meteor_shield_zap.dm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/obj/machinery/satellite/meteor_shield/HasProximity(obj/effect/meteor/meteor) | ||
if(!active || !istype(meteor) || QDELING(meteor) || (obj_flags & EMAGGED)) | ||
return | ||
var/turf/our_turf = get_turf(src) | ||
var/turf/meteor_turf = get_turf(meteor) | ||
if(!check_los(our_turf, meteor_turf)) | ||
return | ||
our_turf.Beam(meteor_turf, icon_state = "sat_beam", time = 5) | ||
if(meteor.shield_defense(src)) | ||
new /obj/effect/temp_visual/explosion(meteor_turf) | ||
INVOKE_ASYNC(src, PROC_REF(play_zap_sound), meteor_turf) | ||
SSblackbox.record_feedback("tally", "meteors_zapped", 1, "[meteor.type]") | ||
meteors_zapped++ | ||
qdel(meteor) | ||
|
||
/obj/machinery/satellite/meteor_shield/proc/check_los(turf/source, turf/target) as num | ||
// if something goes fucky wucky, let's just assume line-of-sight by default | ||
. = TRUE | ||
if(!check_sight) | ||
return TRUE | ||
for(var/turf/segment as anything in get_line(source, target)) | ||
if(QDELETED(segment)) | ||
continue | ||
if(isclosedturf(segment) && !istransparentturf(segment)) | ||
return FALSE | ||
|
||
/obj/machinery/satellite/meteor_shield/proc/play_zap_sound(turf/epicenter) | ||
if(QDELETED(epicenter)) | ||
return | ||
var/static/near_distance | ||
if(isnull(near_distance)) | ||
var/list/world_view = getviewsize(world.view) | ||
near_distance = max(world_view[1], world_view[2]) | ||
SSexplosions.shake_the_room( | ||
epicenter, | ||
near_distance, | ||
far_distance = near_distance * 8, | ||
quake_factor = 0, | ||
echo_factor = 0, | ||
creaking = FALSE, | ||
near_sound = sound('sound/weapons/lasercannonfire.ogg'), | ||
far_sound = sound('sound/weapons/marauder.ogg'), | ||
pressure_affected = FALSE | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters