|
| 1 | +/datum/action/cooldown/glare |
| 2 | + name = "Glare" |
| 3 | + desc = "Enfeeble a target with a single glare." |
| 4 | + button_icon = 'goon/icons/actions.dmi' |
| 5 | + button_icon_state = "hypno" |
| 6 | + ranged_mousepointer = 'icons/effects/mouse_pointers/cult_target.dmi' |
| 7 | + |
| 8 | + check_flags = AB_CHECK_CONSCIOUS |
| 9 | + click_to_activate = TRUE |
| 10 | + |
| 11 | + cooldown_time = 180 SECONDS |
| 12 | + |
| 13 | +/datum/action/cooldown/glare/is_valid_target(atom/cast_on) |
| 14 | + var/mob/living/carbon/human/victim = cast_on |
| 15 | + if(!istype(cast_on)) |
| 16 | + return FALSE |
| 17 | + |
| 18 | + if(victim == owner) |
| 19 | + return FALSE |
| 20 | + |
| 21 | + if(victim.stat != CONSCIOUS) |
| 22 | + return FALSE |
| 23 | + |
| 24 | + if(get_dist(victim, cast_on) > 2) |
| 25 | + to_chat(owner, span_warning("[victim] is too far away.")) |
| 26 | + return FALSE |
| 27 | + |
| 28 | + if(victim.loc != owner.loc) |
| 29 | + var/victim_to_attacker = get_dir(victim, owner) |
| 30 | + if(victim.dir & REVERSE_DIR(victim_to_attacker)) |
| 31 | + to_chat(owner, span_warning("[victim] is not looking at you.")) |
| 32 | + return FALSE |
| 33 | + return TRUE |
| 34 | + |
| 35 | +/datum/action/cooldown/glare/IsAvailable(feedback) |
| 36 | + . = ..() |
| 37 | + if(!.) |
| 38 | + return |
| 39 | + |
| 40 | + if(owner.incapacitated(IGNORE_RESTRAINTS|IGNORE_GRAB)) |
| 41 | + if (feedback) |
| 42 | + to_chat(owner, span_warning("You cannot use [name] while incapacitated.")) |
| 43 | + return FALSE |
| 44 | + |
| 45 | + var/mob/living/carbon/human/human_owner = owner |
| 46 | + var/obj/item/organ/eyes/eyes = human_owner.getorganslot(ORGAN_SLOT_EYES) |
| 47 | + if(!eyes || (eyes.organ_flags & ORGAN_DEAD)) |
| 48 | + if (feedback) |
| 49 | + to_chat(owner, span_warning("You cannot use [name] while you have no eyes.")) |
| 50 | + return FALSE |
| 51 | + |
| 52 | + if(human_owner.is_blind()) |
| 53 | + if (feedback) |
| 54 | + to_chat(owner, span_warning("You cannot use [name] while you are blind.")) |
| 55 | + return FALSE |
| 56 | + |
| 57 | +/datum/action/cooldown/glare/Activate(atom/target) |
| 58 | + . = ..() |
| 59 | + var/mob/living/carbon/human/victim = target |
| 60 | + |
| 61 | + glare_visual(get_turf(owner)) |
| 62 | + addtimer(CALLBACK(src, PROC_REF(glare_visual), victim.loc), 0.1 SECONDS) |
| 63 | + playsound(target, 'goon/sounds/glare.ogg', 50, TRUE, extrarange = MEDIUM_RANGE_SOUND_EXTRARANGE) |
| 64 | + owner.visible_message(span_notice("[owner] glances into [target]'s eyes."), vision_distance = COMBAT_MESSAGE_RANGE) |
| 65 | + |
| 66 | + if(victim.get_total_tint() || victim.get_eye_protection()) |
| 67 | + return // Lol owned |
| 68 | + |
| 69 | + if(!victim.flash_act(INFINITY, FALSE, FALSE, TRUE)) |
| 70 | + return // Lol owned |
| 71 | + |
| 72 | + victim.stamina.adjust(-300) |
| 73 | + victim.adjust_drowsyness(50) |
| 74 | + |
| 75 | +/datum/action/cooldown/glare/proc/glare_visual(loc) |
| 76 | + new /obj/effect/temp_visual/vamp_glare(loc) |
0 commit comments