Skip to content

Commit

Permalink
Fixes the M707 spotting scope teleporting its user and M707 attachmen…
Browse files Browse the repository at this point in the history
…t camo (#5832)

# About the pull request
Adds some extra checks to the spotting scope to kick a user out if more
things (going prone, dying, moving) occurs.
Also fixes an issue where m707 attachments weren't reflecting their maps
camo despite having the sprites to do so.

Closes #5385

# Testing Photographs and Procedure
<details>
<summary>Screenshots & Videos</summary>


![image](https://github.com/cmss13-devs/cmss13/assets/41448081/5fcdbe5f-37e4-4180-a73c-aa5019b326d3)


![image](https://github.com/cmss13-devs/cmss13/assets/41448081/dbf2d46c-a425-4979-a2e0-b9db2016c489)

</details>


# Changelog
:cl:
fix: M707 spotting scope should no longer teleport its user.
fix: M707's attachments should now correctly reflect the map's
camouflage.
/:cl:
  • Loading branch information
Zonespace27 authored Feb 27, 2024
1 parent d808f1c commit e2e5fce
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 2 deletions.
8 changes: 6 additions & 2 deletions code/game/objects/structures/vulture_spotter.dm
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
if(user.client)
RegisterSignal(user.client, COMSIG_PARENT_QDELETING, PROC_REF(do_unscope))
user.client.change_view(scope_zoom, src)
RegisterSignal(user, list(COMSIG_MOB_PICKUP_ITEM, COMSIG_MOB_RESISTED), PROC_REF(do_unscope))
RegisterSignal(user, list(COMSIG_MOB_PICKUP_ITEM, COMSIG_MOB_RESISTED, COMSIG_MOB_DEATH, COMSIG_LIVING_SET_BODY_POSITION), PROC_REF(do_unscope))
user.see_in_dark += darkness_view
user.lighting_alpha = 127
user.sync_lighting_plane_alpha()
Expand Down Expand Up @@ -234,7 +234,7 @@
user.lighting_alpha = user.default_lighting_alpha
user.sync_lighting_plane_alpha()
user.clear_fullscreen("vulture_spotter")
UnregisterSignal(user, list(COMSIG_MOB_PICKUP_ITEM, COMSIG_MOB_RESISTED))
UnregisterSignal(user, list(COMSIG_MOB_PICKUP_ITEM, COMSIG_MOB_RESISTED, COMSIG_MOB_DEATH, COMSIG_LIVING_SET_BODY_POSITION))
user.pixel_x = 0
user.pixel_y = 0
if(user.client)
Expand Down Expand Up @@ -295,6 +295,10 @@

return rifle.attachments["rail"]

/obj/structure/vulture_spotter_tripod/check_eye(mob/living/user)
if((user.body_position != STANDING_UP) || (get_dist(user, src) > 0) || user.is_mob_incapacitated() || !user.client)
do_unscope()

/datum/action/vulture_tripod_unscope
name = "Stop Using Scope"
action_icon_state = "vulture_tripod_close"
Expand Down
44 changes: 44 additions & 0 deletions code/modules/projectiles/gun_attachables.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1271,6 +1271,19 @@ Defined in conflicts.dm of the #defines folder.
QDEL_NULL(scope_element)
return ..()

/obj/item/attachable/vulture_scope/select_gamemode_skin(expected_type, list/override_icon_state, list/override_protection)
. = ..()
var/new_attach_icon
switch(SSmapping.configs[GROUND_MAP].camouflage_type)
if("snow")
attach_icon = new_attach_icon ? new_attach_icon : "s_" + attach_icon
if("desert")
attach_icon = new_attach_icon ? new_attach_icon : "d_" + attach_icon
if("classic")
attach_icon = new_attach_icon ? new_attach_icon : "c_" + attach_icon
if("urban")
attach_icon = new_attach_icon ? new_attach_icon : "u_" + attach_icon

/obj/item/attachable/vulture_scope/tgui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
Expand Down Expand Up @@ -1814,13 +1827,27 @@ Defined in conflicts.dm of the #defines folder.
/obj/item/attachable/stock/vulture
name = "\improper M707 heavy stock"
icon_state = "vulture_stock"
attach_icon = "vulture_stock"
hud_offset_mod = 3

/obj/item/attachable/stock/vulture/Initialize(mapload, ...)
. = ..()
select_gamemode_skin(type)
// Doesn't give any stat additions due to the gun already having really good ones, and this is unremovable from the gun itself

/obj/item/attachable/stock/vulture/select_gamemode_skin(expected_type, list/override_icon_state, list/override_protection)
. = ..()
var/new_attach_icon
switch(SSmapping.configs[GROUND_MAP].camouflage_type)
if("snow")
attach_icon = new_attach_icon ? new_attach_icon : "s_" + attach_icon
if("desert")
attach_icon = new_attach_icon ? new_attach_icon : "d_" + attach_icon
if("classic")
attach_icon = new_attach_icon ? new_attach_icon : "c_" + attach_icon
if("urban")
attach_icon = new_attach_icon ? new_attach_icon : "u_" + attach_icon

/obj/item/attachable/stock/tactical
name = "\improper MK221 tactical stock"
desc = "A metal stock made for the MK221 tactical shotgun."
Expand Down Expand Up @@ -3513,6 +3540,23 @@ Defined in conflicts.dm of the #defines folder.
attach_icon = "vulture_bipod"
heavy_bipod = TRUE

/obj/item/attachable/bipod/vulture/Initialize(mapload, ...)
. = ..()
select_gamemode_skin(type)

/obj/item/attachable/bipod/vulture/select_gamemode_skin(expected_type, list/override_icon_state, list/override_protection)
. = ..()
var/new_attach_icon
switch(SSmapping.configs[GROUND_MAP].camouflage_type)
if("snow")
attach_icon = new_attach_icon ? new_attach_icon : "s_" + attach_icon
if("desert")
attach_icon = new_attach_icon ? new_attach_icon : "d_" + attach_icon
if("classic")
attach_icon = new_attach_icon ? new_attach_icon : "c_" + attach_icon
if("urban")
attach_icon = new_attach_icon ? new_attach_icon : "u_" + attach_icon

/obj/item/attachable/burstfire_assembly
name = "burst fire assembly"
desc = "A small angled piece of fine machinery that increases the burst count on some weapons, and grants the ability to others. \nIncreases weapon scatter."
Expand Down

0 comments on commit e2e5fce

Please sign in to comment.