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

Motion sensor #60

Merged
merged 1 commit into from
Jul 31, 2024
Merged
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
8 changes: 6 additions & 2 deletions code/game/objects/items/motion_detector.dm
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
///If a hostile was detected
var/hostile_detected = FALSE
///The time needed after the last move to not be detected by this motion detector
//var/move_sensitivity = 1 SECONDS RU TGMC EDIT
var/move_sensitivity = 1 SECONDS
///The range of this motion detector
var/range = 16
///The list of all the blips
Expand Down Expand Up @@ -135,12 +135,16 @@
for(var/mob/living/carbon/human/nearby_human AS in cheap_get_humans_near(operator, range))
if(nearby_human == operator)
continue
if(nearby_human.last_move_time + move_sensitivity < world.time)
continue
if(HAS_TRAIT(nearby_human, TRAIT_LIGHT_STEP))
continue
prepare_blip(nearby_human, nearby_human.wear_id?.iff_signal & operator.wear_id.iff_signal ? MOTION_DETECTOR_FRIENDLY : MOTION_DETECTOR_HOSTILE)
for(var/mob/living/carbon/xenomorph/nearby_xeno AS in cheap_get_xenos_near(operator, range))
if(HAS_TRAIT(nearby_xeno, TRAIT_TURRET_HIDDEN))
continue
if(nearby_xeno.last_move_time + move_sensitivity < world.time )
continue
prepare_blip(nearby_xeno, MOTION_DETECTOR_HOSTILE)
for(var/mob/illusion/nearby_illusion AS in cheap_get_illusions_near(operator, range))
prepare_blip(nearby_illusion, MOTION_DETECTOR_HOSTILE)
Expand All @@ -160,7 +164,7 @@
/obj/item/attachable/motiondetector/proc/prepare_blip(mob/target, status)
if(!operator.client)
return
if(!target)
if(!target) //если мы вызываем метод без target то где то в вышестоящем коде ошибка, но всё же лучше чем ничего
return
if(status == MOTION_DETECTOR_HOSTILE)
hostile_detected = TRUE
Expand Down
10 changes: 8 additions & 2 deletions code/modules/clothing/modular_armor/attachments/modules.dm
Original file line number Diff line number Diff line change
Expand Up @@ -777,10 +777,12 @@
var/mob/living/carbon/human/operator
///The range of this motion detector
var/range = 16
//таймер для работы модуля
///таймер для работы модуля
var/motion_timer = null
//время через которое будет срабатывать модуль
///время через которое будет срабатывать модуль
var/scan_time = 2 SECONDS
///The time needed after the last move to not be detected by this motion detector
var/move_sensitivity = 1 SECONDS
///The list of all the blips
var/list/obj/effect/blip/blips_list = list()

Expand Down Expand Up @@ -827,6 +829,8 @@
for(var/mob/living/carbon/human/nearby_human AS in cheap_get_humans_near(operator, range))
if(nearby_human == operator)
continue
if(nearby_human.last_move_time + move_sensitivity < world.time)
continue
if(HAS_TRAIT(nearby_human, TRAIT_LIGHT_STEP))
continue
if(!hostile_detected && (!operator.wear_id || !nearby_human.wear_id || nearby_human.wear_id.iff_signal != operator.wear_id.iff_signal))
Expand All @@ -835,6 +839,8 @@
for(var/mob/living/carbon/xenomorph/nearby_xeno AS in cheap_get_xenos_near(operator, range))
if(HAS_TRAIT(nearby_xeno, TRAIT_TURRET_HIDDEN))
continue
if(nearby_xeno.last_move_time + move_sensitivity < world.time )
continue
if(!hostile_detected)
hostile_detected = TRUE
prepare_blip(nearby_xeno, MOTION_DETECTOR_HOSTILE)
Expand Down
Loading