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

[PTBF] Hallucination - Meet the Sniper #27579

Merged
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
d118de1
Boom, headshot.
PollardTheDragon Dec 7, 2024
16aa1c7
If spacing
PollardTheDragon Dec 8, 2024
2dd0cb5
Actually adds the hallucination to the list
PollardTheDragon Dec 8, 2024
3d39621
Spacing, moved fire to async, images, second hallucination for blood …
PollardTheDragon Dec 8, 2024
8748d67
Invisibility define
PollardTheDragon Dec 8, 2024
98afbb4
Merge branch 'master' into meet-the-sniper-hallucination-PTBF
PollardTheDragon Dec 8, 2024
e27fb9f
Bullet fires, image
PollardTheDragon Dec 8, 2024
13d7baf
Hit messages
PollardTheDragon Dec 8, 2024
027f277
Boom, headshot
PollardTheDragon Dec 8, 2024
c63c577
Blood splatter has color now
PollardTheDragon Dec 9, 2024
5a7ba36
Proc ref
PollardTheDragon Dec 10, 2024
a6b4939
Damage and target fix
PollardTheDragon Dec 10, 2024
391b76a
More efficient bump check
PollardTheDragon Dec 11, 2024
44eb735
Better List Appending
PollardTheDragon Dec 11, 2024
7c43a48
Better list appending
PollardTheDragon Dec 11, 2024
45d6efc
Knockdowm application
PollardTheDragon Dec 11, 2024
a7f1747
Loc to turf
PollardTheDragon Dec 11, 2024
5553aa1
Fixes knockdown
PollardTheDragon Dec 12, 2024
352abd5
Proper knockdown
PollardTheDragon Dec 13, 2024
7a717ef
Merge branch 'master' into meet-the-sniper-hallucination-PTBF
PollardTheDragon Dec 13, 2024
579bdf1
Range_Edge_Turfs
PollardTheDragon Jan 4, 2025
dea1b33
Capital Var
PollardTheDragon Jan 4, 2025
5feae34
Better target turf detection
PollardTheDragon Jan 10, 2025
61ba6cd
Better failure handling. Reverts change in RANGE_EDGE_TURFS
PollardTheDragon Jan 10, 2025
37476a1
Merge branch 'master' into meet-the-sniper-hallucination-PTBF
PollardTheDragon Jan 10, 2025
3234efb
Somehow a xeno got in. Purged it.
PollardTheDragon Jan 11, 2025
2ba58fd
Merge remote-tracking branch 'upstream/master' into meet-the-sniper-h…
PollardTheDragon Jan 11, 2025
5a845af
Handles lack of client in target
PollardTheDragon Jan 16, 2025
dacf19f
Removed extraneous debug log
PollardTheDragon Jan 16, 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
96 changes: 96 additions & 0 deletions code/modules/hallucinations/effects/major.dm
Original file line number Diff line number Diff line change
Expand Up @@ -408,3 +408,99 @@
if(images && images[1])
images[1].icon = 'icons/mob/alien.dmi'
images[1].icon_state = "alienh_pounce"

/**
* # Hallucination - Sniper
*
* Fires a penetrator round at the target. On hit, knockdown + stam loss + hallucinated blood splatter for a bit.
*/
/obj/effect/hallucination/sniper
duration = 15 SECONDS

/obj/effect/hallucination/sniper/Initialize(mapload, mob/living/carbon/target)
. = ..()

// Find a start spot for the sniper bullet
var/list/possible_turfs = list()
for(var/turf/t in RANGE_TURFS(13, target.loc))
PollardTheDragon marked this conversation as resolved.
Show resolved Hide resolved
possible_turfs += t
PollardTheDragon marked this conversation as resolved.
Show resolved Hide resolved
if(!length(possible_turfs))
return
PollardTheDragon marked this conversation as resolved.
Show resolved Hide resolved
var/turf/shot_loc = get_turf(pick(possible_turfs))
fire_bullet(shot_loc, target)

/obj/effect/hallucination/sniper/proc/fire_bullet(turf/shot_loc, mob/living/carbon/target)
// Fire the bullet
var/obj/item/projectile/bullet/sniper/penetrator/hallucination/bullet = new(shot_loc)
PollardTheDragon marked this conversation as resolved.
Show resolved Hide resolved
bullet.hallucinator = target
bullet.def_zone = BODY_ZONE_HEAD
bullet.suppressed = TRUE

// Turn right away
var/matrix/M = new
PollardTheDragon marked this conversation as resolved.
Show resolved Hide resolved
var/angle = round(get_angle(shot_loc, target))
M.Turn(angle)
bullet.transform = M

// Handle who can see the bullet
if(target.client)
bullet.bullet_image = image(bullet.icon, bullet, bullet.icon_state, OBJ_LAYER, bullet.dir)
bullet.bullet_image.transform = M
target.client.images.Add(bullet.bullet_image)
PollardTheDragon marked this conversation as resolved.
Show resolved Hide resolved

// Start flying
bullet.trajectory = new(bullet.x, bullet.y, bullet.z, bullet.pixel_x, bullet.pixel_y, angle, SSprojectiles.global_pixel_speed)
bullet.last_projectile_move = world.time
bullet.has_been_fired = TRUE
target.playsound_local(target.loc, 'sound/weapons/gunshots/gunshot_sniper.ogg', 50)
PollardTheDragon marked this conversation as resolved.
Show resolved Hide resolved
START_PROCESSING(SSprojectiles, bullet)

/obj/effect/hallucination/sniper_bloodsplatter
duration = 15 SECONDS
PollardTheDragon marked this conversation as resolved.
Show resolved Hide resolved
hallucination_icon = 'icons/effects/blood.dmi'
hallucination_icon_state = "mfloor1"
hallucination_color = "#A10808"

/obj/effect/hallucination/sniper_bloodsplatter/Initialize(mapload, mob/living/carbon/target)
var/list/b_data = target.get_blood_data(target.get_blood_id())
if(b_data && !isnull(b_data["blood_color"]))
hallucination_color = b_data["blood_color"]
. = ..()
hallucination_icon_state = pick("mfloor1", "mfloor2", "mfloor3", "mfloor4", "mfloor5", "mfloor6", "mfloor7")


/obj/item/projectile/bullet/sniper/penetrator/hallucination
nodamage = TRUE
invisibility = INVISIBILITY_MAXIMUM // You no see boolet
/// The hallucinator
var/mob/living/carbon/hallucinator = null
/// Handles only the victim seeing it
var/image/bullet_image = null

/obj/item/projectile/bullet/sniper/penetrator/hallucination/on_hit(atom/target, blocked, hit_zone)
if(!isliving(target))
return
if(target != hallucinator)
return
var/mob/living/hit_target = target
var/organ_hit_text = ""
if(hit_target.has_limbs)
organ_hit_text = " in \the [parse_zone(def_zone)]"
hit_target.playsound_local(loc, hitsound, 5, TRUE)
hit_target.apply_damage(60, STAMINA, def_zone)
hit_target.apply_effects(knockdown = 2 SECONDS)
PollardTheDragon marked this conversation as resolved.
Show resolved Hide resolved
new /obj/effect/hallucination/sniper_bloodsplatter(src.loc, hit_target)
PollardTheDragon marked this conversation as resolved.
Show resolved Hide resolved
to_chat(hit_target, "<span class='userdanger'>You're shot by \a [src][organ_hit_text]!</span>")

/obj/item/projectile/bullet/sniper/penetrator/hallucination/Bump(atom/A, yes)
if(!yes) // prevents double bumps.
return
var/turf/target_turf = get_turf(A)
prehit(A)
var/mob/living/hit_target = A
if(hit_target == hallucinator)
hit_target.bullet_act(src, def_zone)
loc = target_turf
if(A)
permutated.Add(A)
PollardTheDragon marked this conversation as resolved.
Show resolved Hide resolved
return 0
5 changes: 5 additions & 0 deletions code/modules/hallucinations/hallucinations.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ GLOBAL_LIST_INIT(hallucinations, list(
/obj/effect/hallucination/assault = 10,
/obj/effect/hallucination/terror_infestation = 10,
/obj/effect/hallucination/loose_energy_ball = 10,
/obj/effect/hallucination/sniper = 10,
)
))

Expand All @@ -45,6 +46,8 @@ GLOBAL_LIST_INIT(hallucinations, list(
var/hallucination_icon_state
/// Hallucination override.
var/hallucination_override = FALSE
/// Hallucination color
var/hallucination_color
PollardTheDragon marked this conversation as resolved.
Show resolved Hide resolved
/// Hallucination layer.
var/hallucination_layer = MOB_LAYER
/// The mob that sees this hallucination.
Expand All @@ -62,6 +65,8 @@ GLOBAL_LIST_INIT(hallucinations, list(
target = hallucination_target
if(hallucination_icon && hallucination_icon_state)
var/image/I = image(hallucination_icon, hallucination_override ? src : get_turf(src), hallucination_icon_state)
if(hallucination_color)
I.color = hallucination_color
I.override = hallucination_override
I.layer = hallucination_layer
add_icon(I)
Expand Down
Loading