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

Dropship weapons console TGUI #4812

Merged
merged 93 commits into from
Dec 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
7405e53
managed to refactor out about half of ui data and all topic functiona…
mullenpaul Apr 23, 2023
6d6266b
done most of the refactoring out
mullenpaul Apr 23, 2023
957794f
started weapon selection screen
mullenpaul May 1, 2023
85feb88
Merge branch 'master' into dropship-weapons-console
mullenpaul Jun 3, 2023
e32dd98
refactoring of cassim to integrate with dropship equipment menu
mullenpaul Jun 7, 2023
deb0520
reworked dropship panel into crtpanel
mullenpaul Jun 11, 2023
0236703
got mfd styled closer to what is wanted
mullenpaul Jun 18, 2023
0c73a43
got embedded maps working
mullenpaul Jun 18, 2023
d63da39
got camera working
mullenpaul Jun 18, 2023
c761532
got signal buttons working
mullenpaul Jun 18, 2023
97d0dd0
starting mfd refactor
mullenpaul Jul 7, 2023
6f29d7d
refactored mfd into more generic component
mullenpaul Jul 7, 2023
516f61f
more mfd refactors
mullenpaul Jul 14, 2023
c0f0ebf
got generic refactor finished
mullenpaul Jul 15, 2023
cef2cf9
got medevac stretcher data to front end
mullenpaul Jul 16, 2023
aa4d513
mock up of medevac ui
mullenpaul Jul 23, 2023
de8ef79
Merge branch 'master' into dropship-weapons-console
mullenpaul Sep 19, 2023
3badd7e
commiting current work
mullenpaul Oct 5, 2023
a20c762
Merge branch 'master' into dropship-weapons-console
mullenpaul Oct 23, 2023
75f8fe0
equipment panel mockup
mullenpaul Oct 23, 2023
7336808
got cas camera working
mullenpaul Oct 24, 2023
1472954
medevac working
mullenpaul Oct 24, 2023
4e36880
deployable equipment working
mullenpaul Oct 25, 2023
4a102af
fix a couple of typing issues
mullenpaul Oct 25, 2023
4b3b22c
pushing current firemission work
mullenpaul Oct 27, 2023
5efd5cf
got firemission configuration working needs a lot of work
mullenpaul Oct 30, 2023
b6fd728
got firemission configuration working in a better way
mullenpaul Oct 30, 2023
724ba52
got gun camera working
mullenpaul Oct 30, 2023
a0ca75e
Merge branch 'master' into dropship-weapons-console
mullenpaul Oct 30, 2023
8b51098
Update code/game/cas_manager/datums/cas_fire_envelope.dm
mullenpaul Oct 31, 2023
43af804
Update code/game/cas_manager/datums/cas_fire_mission.dm
mullenpaul Oct 31, 2023
304beaa
Update code/modules/cm_marines/dropship_equipment.dm
mullenpaul Oct 31, 2023
3aca4af
Update code/game/machinery/computer/dropship_weapons.dm
mullenpaul Oct 31, 2023
606fcc4
Update code/game/machinery/computer/dropship_weapons.dm
mullenpaul Oct 31, 2023
93d2a76
Update code/game/cas_manager/datums/cas_fire_mission.dm
mullenpaul Oct 31, 2023
f020988
Update code/game/cas_manager/datums/cas_fire_mission.dm
mullenpaul Oct 31, 2023
035efa8
Update code/game/cas_manager/datums/cas_fire_mission.dm
mullenpaul Oct 31, 2023
fef997f
Update code/game/cas_manager/datums/cas_fire_mission.dm
mullenpaul Oct 31, 2023
9f14171
Update code/game/cas_manager/datums/cas_fire_mission.dm
mullenpaul Oct 31, 2023
4a91097
Update code/game/machinery/computer/dropship_weapons.dm
mullenpaul Oct 31, 2023
e4e7af6
Update code/game/machinery/computer/dropship_weapons.dm
mullenpaul Oct 31, 2023
29ea34b
Update code/game/machinery/computer/dropship_weapons.dm
mullenpaul Oct 31, 2023
d6d7399
Update code/game/machinery/computer/dropship_weapons.dm
mullenpaul Oct 31, 2023
82b1224
Update code/game/machinery/computer/dropship_weapons.dm
mullenpaul Oct 31, 2023
6905a13
review feedback - backend
mullenpaul Nov 1, 2023
ec3c620
firemissions now update with weapon update
mullenpaul Nov 5, 2023
f82e214
Merge branch 'master' into dropship-weapons-console
mullenpaul Nov 5, 2023
1e8a805
revert minimap changes
mullenpaul Nov 5, 2023
fc97fdb
remove build issue
mullenpaul Nov 5, 2023
ab85724
resolve null pointer map
mullenpaul Nov 5, 2023
f2cdc14
fixed N-S firemission direction
mullenpaul Nov 5, 2023
0f53dd8
added warning over using bad weapon in firemission
mullenpaul Nov 5, 2023
2502f9e
firemission offsets now working properly
mullenpaul Nov 5, 2023
ccde22c
fixed single weapon target acquisition
mullenpaul Nov 5, 2023
32c3121
Merge branch 'master' into dropship-weapons-console
fira Nov 8, 2023
9ed6697
upgraded cas firemissions to SPAN_WARNING
mullenpaul Nov 11, 2023
5da2f6b
ui refactor work
mullenpaul Nov 12, 2023
5fc4fd4
ui refactors to improve state management
mullenpaul Nov 12, 2023
a7eb555
tracked down bugs which came up during firemission creation and equip…
mullenpaul Nov 14, 2023
cf2261c
resolve linting error
mullenpaul Nov 14, 2023
37c926b
can now support an arbitrary number of firemissions, minimum name len…
mullenpaul Nov 14, 2023
1596785
styling improvements for the MFD
mullenpaul Nov 14, 2023
907eee0
finished styling the panel
mullenpaul Nov 14, 2023
ec34779
attempted nvg interface
mullenpaul Nov 15, 2023
1b4e692
refactored camera manager into datum, not fully working or tested
mullenpaul Nov 16, 2023
058a758
got nvgs working on gun camera
mullenpaul Nov 16, 2023
6ffd2ef
made functional d-pad for offset calibration
mullenpaul Nov 19, 2023
6caa210
got gun camera working on firemissions
mullenpaul Nov 22, 2023
06a7dc7
got camera moving sorted
mullenpaul Nov 25, 2023
3e9a3f0
fix linter issue
mullenpaul Nov 25, 2023
2e5feb4
trying to resolve weapon issue
mullenpaul Nov 25, 2023
4d09a54
Merge branch 'master' into dropship-weapons-console
mullenpaul Nov 25, 2023
96c27b4
Merge commit '3e0832cbd0b06d6a2266e52401b0269dbc3d0981' into dropship…
mullenpaul Dec 3, 2023
45c2327
ui no longer bricks when no ammo in weapons
mullenpaul Dec 3, 2023
6778063
increase rate limit to overcome limiter for cas offsets
mullenpaul Dec 3, 2023
6bf8cd3
basic spotlight page working
mullenpaul Dec 3, 2023
b5019ce
Merge commit '35f3406f070e32145e2cbb95518310d88e3f2cd2' into dropship…
mullenpaul Dec 6, 2023
def4a2b
fix spotlight issue
mullenpaul Dec 6, 2023
fe42c06
fix list null
mullenpaul Dec 6, 2023
923563b
nulling out list
mullenpaul Dec 6, 2023
7c13a62
Merge branch 'master' into dropship-weapons-console
mullenpaul Dec 18, 2023
d873240
resolve feedback issues
mullenpaul Dec 18, 2023
1cd88eb
fix width error for firemissions
mullenpaul Dec 19, 2023
100f736
debug flare compatible
mullenpaul Dec 21, 2023
dec1a84
rework firemission error messages
mullenpaul Dec 21, 2023
b3d5d28
properly unregister from cameras
mullenpaul Dec 23, 2023
7f55d8b
Merge branch 'master' into dropship-weapons-console
mullenpaul Dec 24, 2023
ca90fd9
changed fm directions
mullenpaul Dec 24, 2023
0e26e20
camera signal handler added
mullenpaul Dec 24, 2023
9fa3770
should have resolved topic lock restriction for offsets
mullenpaul Dec 24, 2023
9cc8088
resolve medevec camera issue
mullenpaul Dec 24, 2023
dc4c061
added sanity check to minute count
mullenpaul Dec 24, 2023
ef3e131
added initialisation for topic limiter when null
mullenpaul Dec 24, 2023
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
1 change: 1 addition & 0 deletions code/__DEFINES/__game.dm
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ block( \
#define FIRE_MISSION_WEAPON_REMOVED 8
#define FIRE_MISSION_WEAPON_UNUSABLE 16
#define FIRE_MISSION_WEAPON_OUT_OF_AMMO 32
#define FIRE_MISSION_BAD_DIRECTION 64
#define FIRE_MISSION_NOT_EXECUTABLE -1

//Defines for firemission state
Expand Down
9 changes: 9 additions & 0 deletions code/__DEFINES/dcs/signals/atom/signals_item.dm
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,12 @@

//from /datum/authority/branch/role/proc/equip_role()
#define COMSIG_POST_SPAWN_UPDATE "post_spawn_update"

#define COMSIG_CAMERA_MAPNAME_ASSIGNED "camera_manager_mapname_assigned"
#define COMSIG_CAMERA_REGISTER_UI "camera_manager_register_ui"
#define COMSIG_CAMERA_UNREGISTER_UI "camera_manager_unregister_ui"
#define COMSIG_CAMERA_SET_NVG "camera_manager_set_nvg"
#define COMSIG_CAMERA_CLEAR_NVG "camera_manager_clear_nvg"
#define COMSIG_CAMERA_SET_TARGET "camera_manager_set_target"
#define COMSIG_CAMERA_SET_AREA "camera_manager_set_area"
#define COMSIG_CAMERA_CLEAR "camera_manager_clear_target"
2 changes: 2 additions & 0 deletions code/__DEFINES/dcs/signals/atom/signals_obj.dm
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,6 @@
/// from /obj/proc/afterbuckle()
#define COSMIG_OBJ_AFTER_BUCKLE "signal_obj_after_buckle"

#define COMSIG_DROPSHIP_ADD_EQUIPMENT "dropship_add_equipment"
#define COMSIG_DROPSHIP_REMOVE_EQUIPMENT "dropship_remove_equipment"
#define COMSIG_STRUCTURE_CRATE_SQUAD_LAUNCHED "structure_crate_squad_launched"
1 change: 1 addition & 0 deletions code/__DEFINES/layers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@
///--------------- FULLSCREEN RUNECHAT BUBBLES ------------
#define LIGHTING_PLANE 100
#define EXTERIOR_LIGHTING_PLANE 101
#define NVG_PLANE 110

///Popup Chat Messages
#define RUNECHAT_PLANE 501
Expand Down
8 changes: 8 additions & 0 deletions code/_onclick/hud/rendering/plane_master.dm
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,14 @@
remove_filter("AO")
add_filter("AO", 1, drop_shadow_filter(x = 0, y = -2, size = 4, color = "#04080FAA"))

/atom/movable/screen/plane_master/nvg_plane
name = "NVG plane"
plane = NVG_PLANE
render_relay_plane = RENDER_PLANE_GAME
blend_mode_override = BLEND_MULTIPLY
//icon = 'icons/mob/hud/screen1.dmi'
//icon_state = "noise"

/atom/movable/screen/plane_master/fullscreen
name = "fullscreen alert plane"
plane = FULLSCREEN_PLANE
Expand Down
235 changes: 235 additions & 0 deletions code/game/camera_manager/camera_manager.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,235 @@
#define DEFAULT_MAP_SIZE 15

#define RENDER_MODE_TARGET 1
#define RENDER_MODE_AREA 2

/datum/component/camera_manager
var/map_name
var/obj/structure/machinery/camera/current
var/datum/shape/rectangle/current_area
var/atom/movable/screen/map_view/cam_screen
var/atom/movable/screen/background/cam_background
var/list/range_turfs = list()
/// The turf where the camera was last updated.
var/turf/last_camera_turf
var/target_x
var/target_y
var/target_z
var/target_width
var/target_height
var/list/cam_plane_masters
var/isXRay = FALSE
var/render_mode = RENDER_MODE_TARGET

/datum/component/camera_manager/Initialize()
. = ..()
map_name = "camera_manager_[REF(src)]_map"
cam_screen = new
cam_screen.name = "screen"
cam_screen.assigned_map = map_name
cam_screen.del_on_map_removal = FALSE
cam_screen.screen_loc = "[map_name]:1,1"
cam_background = new
cam_background.assigned_map = map_name
cam_background.del_on_map_removal = FALSE

cam_plane_masters = list()
for(var/plane in subtypesof(/atom/movable/screen/plane_master) - /atom/movable/screen/plane_master/blackness)
var/atom/movable/screen/plane_master/instance = new plane()
add_plane(instance)

/datum/component/camera_manager/Destroy(force, ...)
. = ..()
range_turfs = null
current_area = null
cam_plane_masters = null
QDEL_NULL(cam_background)
QDEL_NULL(cam_screen)
if(current)
UnregisterSignal(current, COMSIG_PARENT_QDELETING)

/datum/component/camera_manager/proc/add_plane(atom/movable/screen/plane_master/instance)
instance.assigned_map = map_name
instance.del_on_map_removal = FALSE
if(instance.blend_mode_override)
instance.blend_mode = instance.blend_mode_override
instance.screen_loc = "[map_name]:CENTER"
cam_plane_masters["[instance.plane]"] = instance

/datum/component/camera_manager/proc/register(source, mob/user)
SIGNAL_HANDLER
var/client/user_client = user.client
if(!user_client)
return
user_client.register_map_obj(cam_background)
user_client.register_map_obj(cam_screen)
for(var/plane_id in cam_plane_masters)
user_client.register_map_obj(cam_plane_masters[plane_id])

/datum/component/camera_manager/proc/unregister(source, mob/user)
SIGNAL_HANDLER
var/client/user_client = user.client
if(!user_client)
return
user_client.clear_map(cam_background)
user_client.clear_map(cam_screen)
for(var/plane_id in cam_plane_masters)
user_client.clear_map(cam_plane_masters[plane_id])

/datum/component/camera_manager/RegisterWithParent()
. = ..()
START_PROCESSING(SSdcs, src)
SEND_SIGNAL(parent, COMSIG_CAMERA_MAPNAME_ASSIGNED, map_name)
RegisterSignal(parent, COMSIG_CAMERA_REGISTER_UI, PROC_REF(register))
RegisterSignal(parent, COMSIG_CAMERA_UNREGISTER_UI, PROC_REF(unregister))
RegisterSignal(parent, COMSIG_CAMERA_SET_NVG, PROC_REF(enable_nvg))
RegisterSignal(parent, COMSIG_CAMERA_CLEAR_NVG, PROC_REF(disable_nvg))
RegisterSignal(parent, COMSIG_CAMERA_SET_AREA, PROC_REF(set_camera_rect))
RegisterSignal(parent, COMSIG_CAMERA_SET_TARGET, PROC_REF(set_camera))
RegisterSignal(parent, COMSIG_CAMERA_CLEAR, PROC_REF(clear_camera))
mullenpaul marked this conversation as resolved.
Show resolved Hide resolved

/datum/component/camera_manager/UnregisterFromParent()
. = ..()
STOP_PROCESSING(SSdcs, src)

UnregisterSignal(parent, COMSIG_CAMERA_REGISTER_UI)
UnregisterSignal(parent, COMSIG_CAMERA_UNREGISTER_UI)
UnregisterSignal(parent, COMSIG_CAMERA_SET_NVG)
UnregisterSignal(parent, COMSIG_CAMERA_CLEAR_NVG)
UnregisterSignal(parent, COMSIG_CAMERA_SET_AREA)
UnregisterSignal(parent, COMSIG_CAMERA_SET_TARGET)
UnregisterSignal(parent, COMSIG_CAMERA_CLEAR)

/datum/component/camera_manager/proc/clear_camera()
SIGNAL_HANDLER
if(current)
UnregisterSignal(current, COMSIG_PARENT_QDELETING)
current_area = null
current = null
target_x = null
target_y = null
target_z = null
target_width = null
target_height = null
show_camera_static()

/datum/component/camera_manager/proc/set_camera(source, atom/target, w, h)
SIGNAL_HANDLER
render_mode = RENDER_MODE_TARGET
if(current)
UnregisterSignal(current, COMSIG_PARENT_QDELETING)
current = target
target_width = w
target_height = h
RegisterSignal(current, COMSIG_PARENT_QDELETING, PROC_REF(show_camera_static))
mullenpaul marked this conversation as resolved.
Show resolved Hide resolved
update_target_camera()

/datum/component/camera_manager/proc/set_camera_rect(source, x, y, z, w, h)
SIGNAL_HANDLER
render_mode = RENDER_MODE_AREA
if(current)
UnregisterSignal(current, COMSIG_PARENT_QDELETING)
current = null
current_area = RECT(x, y, w, h)
target_x = x
target_y = y
target_z = z
update_area_camera()

/datum/component/camera_manager/proc/enable_nvg(source, power, matrixcol)
SIGNAL_HANDLER
for(var/plane_id in cam_plane_masters)
var/atom/movable/screen/plane_master/plane = cam_plane_masters["[plane_id]"]
plane.add_filter("nvg", 1, color_matrix_filter(color_matrix_from_string(matrixcol)))
sync_lighting_plane_alpha(LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE)

/datum/component/camera_manager/proc/disable_nvg()
SIGNAL_HANDLER
for(var/plane_id in cam_plane_masters)
var/atom/movable/screen/plane_master/plane = cam_plane_masters["[plane_id]"]
plane.remove_filter("nvg")
sync_lighting_plane_alpha(LIGHTING_PLANE_ALPHA_VISIBLE)

/datum/component/camera_manager/proc/sync_lighting_plane_alpha(lighting_alpha)
var/atom/movable/screen/plane_master/lighting/lighting = cam_plane_masters["[LIGHTING_PLANE]"]
if (lighting)
lighting.alpha = lighting_alpha
var/atom/movable/screen/plane_master/lighting/exterior_lighting = cam_plane_masters["[EXTERIOR_LIGHTING_PLANE]"]
if (exterior_lighting)
exterior_lighting.alpha = min(GLOB.minimum_exterior_lighting_alpha, lighting_alpha)

/**
* Set the displayed camera to the static not-connected.
*/
/datum/component/camera_manager/proc/show_camera_static()
cam_screen.vis_contents.Cut()
last_camera_turf = null
cam_background.icon_state = "scanline2"
cam_background.fill_rect(1, 1, DEFAULT_MAP_SIZE, DEFAULT_MAP_SIZE)

/datum/component/camera_manager/proc/update_target_camera()
// Show static if can't use the camera
if(!current?.can_use())
show_camera_static()
return

// Is this camera located in or attached to a living thing, Vehicle or helmet? If so, assume the camera's loc is the living (or non) thing.
var/cam_location = current
if(isliving(current.loc) || isVehicle(current.loc))
cam_location = current.loc
else if(istype(current.loc, /obj/item/clothing/head/helmet/marine))
var/obj/item/clothing/head/helmet/marine/helmet = current.loc
cam_location = helmet.loc

// If we're not forcing an update for some reason and the cameras are in the same location,
// we don't need to update anything.
// Most security cameras will end here as they're not moving.
var/newturf = get_turf(cam_location)
if(last_camera_turf == newturf)
return

// Cameras that get here are moving, and are likely attached to some moving atom such as cyborgs.
last_camera_turf = get_turf(cam_location)

var/list/visible_things = current.isXRay() ? range(current.view_range, cam_location) : view(current.view_range, cam_location)
render_objects(visible_things)

/datum/component/camera_manager/proc/update_area_camera()
// Show static if can't use the camera
if(!current_area || !target_z)
show_camera_static()
return

// If we're not forcing an update for some reason and the cameras are in the same location,
// we don't need to update anything.
// Most security cameras will end here as they're not moving.
var/turf/new_location = locate(target_x, target_y, target_z)
if(last_camera_turf == new_location)
return

// Cameras that get here are moving, and are likely attached to some moving atom such as cyborgs.
last_camera_turf = new_location

var/x_size = current_area.width
var/y_size = current_area.height
var/turf/target = locate(current_area.center_x, current_area.center_y, target_z)

var/list/visible_things = isXRay ? range("[x_size]x[y_size]", target) : view("[x_size]x[y_size]", target)
src.render_objects(visible_things)

/datum/component/camera_manager/proc/render_objects(list/visible_things)
var/list/visible_turfs = list()
for(var/turf/visible_turf in visible_things)
visible_turfs += visible_turf

var/list/bbox = get_bbox_of_atoms(visible_turfs)
var/size_x = bbox[3] - bbox[1] + 1
var/size_y = bbox[4] - bbox[2] + 1

cam_screen.vis_contents = visible_turfs
cam_background.icon_state = "clear"
cam_background.fill_rect(1, 1, size_x, size_y)

#undef DEFAULT_MAP_SIZE
#undef RENDER_MODE_TARGET
#undef RENDER_MODE_AREA
Loading