From e0f4c0c5a2cbc77f4e9ef18f937319b1d0c25a96 Mon Sep 17 00:00:00 2001 From: Doubleumc Date: Thu, 26 Oct 2023 22:40:30 -0400 Subject: [PATCH 1/8] first test --- code/modules/vehicles/multitile/multitile.dm | 61 +++++++++++++++---- .../multitile/multitile_interaction.dm | 2 +- code/modules/vehicles/tank/tank.dm | 2 +- code/modules/vehicles/van/van.dm | 2 +- 4 files changed, 52 insertions(+), 15 deletions(-) diff --git a/code/modules/vehicles/multitile/multitile.dm b/code/modules/vehicles/multitile/multitile.dm index 9e4d2c9d29..e5d765efee 100644 --- a/code/modules/vehicles/multitile/multitile.dm +++ b/code/modules/vehicles/multitile/multitile.dm @@ -21,8 +21,9 @@ can_buckle = FALSE - light_system = MOVABLE_LIGHT - light_range = 5 + //light_system = MOVABLE_LIGHT + //light_range = 5 + //light_flags = LIGHT_ATTACHED var/atom/movable/vehicle_light_holder/lighting_holder @@ -175,16 +176,22 @@ rotate_entrances(angle_to_turn) rotate_bounds(angle_to_turn) + //light_pixel_x = -64 + //light_pixel_y = -64 + if(bound_width > world.icon_size || bound_height > world.icon_size) lighting_holder = new(src) - lighting_holder.set_light_range(vehicle_light_range) - lighting_holder.set_light_power(vehicle_light_power) + //lighting_holder.light_pixel_x = -64 + //lighting_holder.light_pixel_y = -64 + //lighting_holder.transform = lighting_holder.transform.Translate(-64, -64) + lighting_holder.set_light_range(1.4) + lighting_holder.set_light_power(10) lighting_holder.set_light_on(vehicle_light_range || vehicle_light_power) - else if(light_range) - set_light_on(TRUE) - - light_pixel_x = -bound_x - light_pixel_y = -bound_y + //lighting_holder.cone.transform = lighting_holder.cone.transform.Translate(32, 32) + //affected_movable_lights[1].cone.transform = affected_movable_lights[1].cone.transform.Translate(-64, -64) + //SEND_SIGNAL(lighting_holder, COMSIG_ITEM_EQUIPPED, src) + //else if(light_range) + //set_light_on(TRUE) healthcheck() update_icon() @@ -209,6 +216,8 @@ return /obj/vehicle/multitile/Destroy() + QDEL_NULL(lighting_holder) + if(!QDELETED(interior)) QDEL_NULL(interior) @@ -383,8 +392,8 @@ handle_all_modules_broken() //vehicle is dead, no more lights - if(health <= 0 && lighting_holder.light_range) - lighting_holder.set_light_on(FALSE) + //if(health <= 0 && lighting_holder.light_range) + //lighting_holder.set_light_on(FALSE) update_icon() /* @@ -442,18 +451,46 @@ Loco.handle_acid_damage(A) /atom/movable/vehicle_light_holder - light_system = MOVABLE_LIGHT + light_system = DIRECTIONAL_LIGHT mouse_opacity = MOUSE_OPACITY_TRANSPARENT /atom/movable/vehicle_light_holder/Initialize(mapload, ...) . = ..() + //pixel_x = 0 + //pixel_y = -2 * world.icon_size + + //var/matrix/transform = matrix() + transform = transform.Translate(0, -2 * world.icon_size) + var/atom/attached_to = loc forceMove(attached_to.loc) RegisterSignal(attached_to, COMSIG_MOVABLE_MOVED, PROC_REF(handle_parent_move)) + RegisterSignal(attached_to, COMSIG_ATOM_DIR_CHANGE, PROC_REF(handle_parent_dir_change)) /atom/movable/vehicle_light_holder/proc/handle_parent_move(atom/movable/mover, atom/oldloc, direction) SIGNAL_HANDLER forceMove(get_turf(mover)) + +/atom/movable/vehicle_light_holder/proc/handle_parent_dir_change(atom/movable/source, olddir, newdir) + SIGNAL_HANDLER + + /* + switch(newdir) + if(NORTH) + pixel_x = 0 + pixel_y = 2 * world.icon_size + if(SOUTH) + pixel_x = 0 + pixel_y = -2 * world.icon_size + if(EAST) + pixel_x = 2 * world.icon_size + pixel_y = 0 + if(WEST) + pixel_x = -2 * world.icon_size + pixel_y = 0 + */ + + setDir(newdir) diff --git a/code/modules/vehicles/multitile/multitile_interaction.dm b/code/modules/vehicles/multitile/multitile_interaction.dm index 42b141327b..5e2138fb82 100644 --- a/code/modules/vehicles/multitile/multitile_interaction.dm +++ b/code/modules/vehicles/multitile/multitile_interaction.dm @@ -209,7 +209,7 @@ to_chat(user, SPAN_NOTICE("Hull integrity is at [SPAN_HELPFUL(100.0*health/max_hp)]%.")) health = initial(health) - lighting_holder.set_light_range(vehicle_light_range) + //lighting_holder.set_light_range(vehicle_light_range) toggle_cameras_status(TRUE) update_icon() user.visible_message(SPAN_NOTICE("[user] finishes [repair_message] on \the [src]."), SPAN_NOTICE("You finish [repair_message] on \the [src]. Hull integrity is at [SPAN_HELPFUL(100.0*health/max_hp)]%. ")) diff --git a/code/modules/vehicles/tank/tank.dm b/code/modules/vehicles/tank/tank.dm index ad69f80cdf..d877803210 100644 --- a/code/modules/vehicles/tank/tank.dm +++ b/code/modules/vehicles/tank/tank.dm @@ -36,7 +36,7 @@ move_momentum_build_factor = 1.8 move_turn_momentum_loss_factor = 0.6 - vehicle_light_range = 7 + //vehicle_light_range = 7 // Rest (all the guns) is handled by the tank turret hardpoint hardpoints_allowed = list( diff --git a/code/modules/vehicles/van/van.dm b/code/modules/vehicles/van/van.dm index fdb2f397bb..5b925b747f 100644 --- a/code/modules/vehicles/van/van.dm +++ b/code/modules/vehicles/van/van.dm @@ -41,7 +41,7 @@ movement_sound = 'sound/vehicles/tank_driving.ogg' honk_sound = 'sound/vehicles/honk_2_truck.ogg' - vehicle_light_range = 8 + //vehicle_light_range = 8 move_max_momentum = 3 From 05791bd4cb3a35c828629b811a8f8923aeaae87c Mon Sep 17 00:00:00 2001 From: Doubleumc Date: Fri, 27 Oct 2023 01:18:18 -0400 Subject: [PATCH 2/8] headlights THANK YOU MORROW --- code/datums/components/overlay_lighting.dm | 27 +++++++ code/modules/vehicles/multitile/multitile.dm | 81 +++++-------------- .../multitile/multitile_interaction.dm | 2 +- code/modules/vehicles/tank/tank.dm | 2 +- code/modules/vehicles/van/van.dm | 2 +- 5 files changed, 48 insertions(+), 66 deletions(-) diff --git a/code/datums/components/overlay_lighting.dm b/code/datums/components/overlay_lighting.dm index 00a5e86b5d..19022dcd91 100644 --- a/code/datums/components/overlay_lighting.dm +++ b/code/datums/components/overlay_lighting.dm @@ -462,6 +462,7 @@ scanning = next_turf current_holder.underlays -= visible_mask + current_holder.underlays -= cone var/translate_x = -((range - 1) * 32) var/translate_y = translate_x @@ -474,14 +475,40 @@ translate_x += 32 * final_distance if(WEST) translate_x += -32 * final_distance + + var/multitile_light = length(current_holder.locs) > 1 + var/multitile_translate_x = 0 + var/multitile_translate_y = 0 + + if(multitile_light) + switch(current_direction) + if(NORTH) + multitile_translate_x += current_holder.bound_width / 2 + multitile_translate_y += current_holder.bound_height + if(SOUTH) + multitile_translate_x += current_holder.bound_width / 2 + if(EAST) + multitile_translate_x += current_holder.bound_width + multitile_translate_y += current_holder.bound_height / 2 + if(WEST) + multitile_translate_y += current_holder.bound_height / 2 + + translate_x += multitile_translate_x + translate_y += multitile_translate_y + if((directional_offset_x != translate_x) || (directional_offset_y != translate_y)) directional_offset_x = translate_x directional_offset_y = translate_y var/matrix/transform = matrix() transform.Translate(translate_x, translate_y) visible_mask.transform = transform + if(multitile_light) + var/matrix/cone_transform = matrix() + cone_transform.Translate(multitile_translate_x - 32, multitile_translate_y - 32) + cone.transform = cone_transform if(overlay_lighting_flags & LIGHTING_ON) current_holder.underlays += visible_mask + current_holder.underlays += cone ///Called when current_holder changes loc. /datum/component/overlay_lighting/proc/on_holder_dir_change(atom/movable/source, olddir, newdir) diff --git a/code/modules/vehicles/multitile/multitile.dm b/code/modules/vehicles/multitile/multitile.dm index e5d765efee..c53abd3fdc 100644 --- a/code/modules/vehicles/multitile/multitile.dm +++ b/code/modules/vehicles/multitile/multitile.dm @@ -21,12 +21,14 @@ can_buckle = FALSE - //light_system = MOVABLE_LIGHT - //light_range = 5 - //light_flags = LIGHT_ATTACHED - - var/atom/movable/vehicle_light_holder/lighting_holder - + //Vehicle self-illumination + light_system = MOVABLE_LIGHT + light_flags = LIGHT_ATTACHED + light_range = 5 + light_power = 2 + + //Vehicle headlights + var/atom/movable/vehicle_light/light_holder var/vehicle_light_range = 5 var/vehicle_light_power = 2 @@ -176,22 +178,17 @@ rotate_entrances(angle_to_turn) rotate_bounds(angle_to_turn) - //light_pixel_x = -64 - //light_pixel_y = -64 + //light_pixel_x = -bound_x + //light_pixel_y = -bound_y if(bound_width > world.icon_size || bound_height > world.icon_size) - lighting_holder = new(src) - //lighting_holder.light_pixel_x = -64 - //lighting_holder.light_pixel_y = -64 - //lighting_holder.transform = lighting_holder.transform.Translate(-64, -64) - lighting_holder.set_light_range(1.4) - lighting_holder.set_light_power(10) - lighting_holder.set_light_on(vehicle_light_range || vehicle_light_power) - //lighting_holder.cone.transform = lighting_holder.cone.transform.Translate(32, 32) - //affected_movable_lights[1].cone.transform = affected_movable_lights[1].cone.transform.Translate(-64, -64) - //SEND_SIGNAL(lighting_holder, COMSIG_ITEM_EQUIPPED, src) + light_holder = new(src) + light_holder.set_light_flags(LIGHT_ATTACHED) + light_holder.set_light_range(vehicle_light_range) + light_holder.set_light_power(vehicle_light_power) + light_holder.set_light_on(vehicle_light_range && vehicle_light_power) //else if(light_range) - //set_light_on(TRUE) + //set_light_on(TRUE) healthcheck() update_icon() @@ -216,7 +213,7 @@ return /obj/vehicle/multitile/Destroy() - QDEL_NULL(lighting_holder) + QDEL_NULL(light_holder) if(!QDELETED(interior)) QDEL_NULL(interior) @@ -450,47 +447,5 @@ for(var/obj/item/hardpoint/locomotion/Loco in hardpoints) Loco.handle_acid_damage(A) -/atom/movable/vehicle_light_holder +/atom/movable/vehicle_light light_system = DIRECTIONAL_LIGHT - mouse_opacity = MOUSE_OPACITY_TRANSPARENT - -/atom/movable/vehicle_light_holder/Initialize(mapload, ...) - . = ..() - - //pixel_x = 0 - //pixel_y = -2 * world.icon_size - - //var/matrix/transform = matrix() - transform = transform.Translate(0, -2 * world.icon_size) - - var/atom/attached_to = loc - - forceMove(attached_to.loc) - RegisterSignal(attached_to, COMSIG_MOVABLE_MOVED, PROC_REF(handle_parent_move)) - RegisterSignal(attached_to, COMSIG_ATOM_DIR_CHANGE, PROC_REF(handle_parent_dir_change)) - -/atom/movable/vehicle_light_holder/proc/handle_parent_move(atom/movable/mover, atom/oldloc, direction) - SIGNAL_HANDLER - - forceMove(get_turf(mover)) - -/atom/movable/vehicle_light_holder/proc/handle_parent_dir_change(atom/movable/source, olddir, newdir) - SIGNAL_HANDLER - - /* - switch(newdir) - if(NORTH) - pixel_x = 0 - pixel_y = 2 * world.icon_size - if(SOUTH) - pixel_x = 0 - pixel_y = -2 * world.icon_size - if(EAST) - pixel_x = 2 * world.icon_size - pixel_y = 0 - if(WEST) - pixel_x = -2 * world.icon_size - pixel_y = 0 - */ - - setDir(newdir) diff --git a/code/modules/vehicles/multitile/multitile_interaction.dm b/code/modules/vehicles/multitile/multitile_interaction.dm index 5e2138fb82..f80f13c6c4 100644 --- a/code/modules/vehicles/multitile/multitile_interaction.dm +++ b/code/modules/vehicles/multitile/multitile_interaction.dm @@ -209,7 +209,7 @@ to_chat(user, SPAN_NOTICE("Hull integrity is at [SPAN_HELPFUL(100.0*health/max_hp)]%.")) health = initial(health) - //lighting_holder.set_light_range(vehicle_light_range) + //light_holder.set_light_on(vehicle_light_range && vehicle_light_power) toggle_cameras_status(TRUE) update_icon() user.visible_message(SPAN_NOTICE("[user] finishes [repair_message] on \the [src]."), SPAN_NOTICE("You finish [repair_message] on \the [src]. Hull integrity is at [SPAN_HELPFUL(100.0*health/max_hp)]%. ")) diff --git a/code/modules/vehicles/tank/tank.dm b/code/modules/vehicles/tank/tank.dm index d877803210..ad69f80cdf 100644 --- a/code/modules/vehicles/tank/tank.dm +++ b/code/modules/vehicles/tank/tank.dm @@ -36,7 +36,7 @@ move_momentum_build_factor = 1.8 move_turn_momentum_loss_factor = 0.6 - //vehicle_light_range = 7 + vehicle_light_range = 7 // Rest (all the guns) is handled by the tank turret hardpoint hardpoints_allowed = list( diff --git a/code/modules/vehicles/van/van.dm b/code/modules/vehicles/van/van.dm index 5b925b747f..fdb2f397bb 100644 --- a/code/modules/vehicles/van/van.dm +++ b/code/modules/vehicles/van/van.dm @@ -41,7 +41,7 @@ movement_sound = 'sound/vehicles/tank_driving.ogg' honk_sound = 'sound/vehicles/honk_2_truck.ogg' - //vehicle_light_range = 8 + vehicle_light_range = 8 move_max_momentum = 3 From 030c533cff56ee5cece7a73225e3ff79c5690968 Mon Sep 17 00:00:00 2001 From: Doubleumc Date: Fri, 27 Oct 2023 01:30:03 -0400 Subject: [PATCH 3/8] lights off when dead --- code/modules/vehicles/multitile/multitile.dm | 4 ++-- code/modules/vehicles/multitile/multitile_interaction.dm | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/code/modules/vehicles/multitile/multitile.dm b/code/modules/vehicles/multitile/multitile.dm index c53abd3fdc..8857f8871d 100644 --- a/code/modules/vehicles/multitile/multitile.dm +++ b/code/modules/vehicles/multitile/multitile.dm @@ -389,8 +389,8 @@ handle_all_modules_broken() //vehicle is dead, no more lights - //if(health <= 0 && lighting_holder.light_range) - //lighting_holder.set_light_on(FALSE) + if(health <= 0 && light_holder.light_range) + light_holder.set_light_on(FALSE) update_icon() /* diff --git a/code/modules/vehicles/multitile/multitile_interaction.dm b/code/modules/vehicles/multitile/multitile_interaction.dm index f80f13c6c4..5450cea0d0 100644 --- a/code/modules/vehicles/multitile/multitile_interaction.dm +++ b/code/modules/vehicles/multitile/multitile_interaction.dm @@ -209,7 +209,7 @@ to_chat(user, SPAN_NOTICE("Hull integrity is at [SPAN_HELPFUL(100.0*health/max_hp)]%.")) health = initial(health) - //light_holder.set_light_on(vehicle_light_range && vehicle_light_power) + light_holder.set_light_on(vehicle_light_range && vehicle_light_power) toggle_cameras_status(TRUE) update_icon() user.visible_message(SPAN_NOTICE("[user] finishes [repair_message] on \the [src]."), SPAN_NOTICE("You finish [repair_message] on \the [src]. Hull integrity is at [SPAN_HELPFUL(100.0*health/max_hp)]%. ")) From b77555ea94963901e857739406a3316e3b20c207 Mon Sep 17 00:00:00 2001 From: Doubleumc Date: Fri, 27 Oct 2023 04:41:17 -0400 Subject: [PATCH 4/8] body light testing --- code/datums/components/overlay_lighting.dm | 33 +++++++++++++++++--- code/modules/vehicles/multitile/multitile.dm | 4 +-- 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/code/datums/components/overlay_lighting.dm b/code/datums/components/overlay_lighting.dm index 19022dcd91..712ee0f395 100644 --- a/code/datums/components/overlay_lighting.dm +++ b/code/datums/components/overlay_lighting.dm @@ -74,6 +74,9 @@ ///Cast range for the directional cast (how far away the atom is moved) var/cast_range = 2 + var/base_offset_x + var/base_offset_y + /datum/component/overlay_lighting/Initialize(_range, _power, _color, starts_on, is_directional) if(!ismovable(parent)) @@ -191,6 +194,24 @@ return if(directional) cast_directional_light() + else if(length(current_holder?.locs) > 1) + var/multitile_translate_x = 0 + var/multitile_translate_y = 0 + switch(current_holder.dir) + if(NORTH, SOUTH) + multitile_translate_x = current_holder.bound_width * 0.5 + multitile_translate_y = current_holder.bound_height * 0.5 + if(EAST, WEST) + multitile_translate_x = current_holder.bound_height * 0.5 + multitile_translate_y = current_holder.bound_width * 0.5 + if(current_holder && overlay_lighting_flags & LIGHTING_ON) + current_holder.underlays -= visible_mask + var/matrix/transform = new + transform.Translate(multitile_translate_x - base_offset_x, multitile_translate_y - base_offset_y) + visible_mask.transform = transform + if(current_holder && overlay_lighting_flags & LIGHTING_ON) + current_holder.underlays += visible_mask + get_new_turfs() @@ -336,6 +357,8 @@ visible_mask.transform = null return var/offset = (pixel_bounds - 32) * 0.5 + base_offset_x = offset + base_offset_y = offset var/matrix/transform = new transform.Translate(-offset, -offset) visible_mask.transform = transform @@ -476,22 +499,22 @@ if(WEST) translate_x += -32 * final_distance - var/multitile_light = length(current_holder.locs) > 1 + var/multitile_light = length(current_holder?.locs) > 1 var/multitile_translate_x = 0 var/multitile_translate_y = 0 if(multitile_light) switch(current_direction) if(NORTH) - multitile_translate_x += current_holder.bound_width / 2 + multitile_translate_x += current_holder.bound_width * 0.5 multitile_translate_y += current_holder.bound_height if(SOUTH) - multitile_translate_x += current_holder.bound_width / 2 + multitile_translate_x += current_holder.bound_width * 0.5 if(EAST) multitile_translate_x += current_holder.bound_width - multitile_translate_y += current_holder.bound_height / 2 + multitile_translate_y += current_holder.bound_height * 0.5 if(WEST) - multitile_translate_y += current_holder.bound_height / 2 + multitile_translate_y += current_holder.bound_height * 0.5 translate_x += multitile_translate_x translate_y += multitile_translate_y diff --git a/code/modules/vehicles/multitile/multitile.dm b/code/modules/vehicles/multitile/multitile.dm index 8857f8871d..863a58afd4 100644 --- a/code/modules/vehicles/multitile/multitile.dm +++ b/code/modules/vehicles/multitile/multitile.dm @@ -186,9 +186,9 @@ light_holder.set_light_flags(LIGHT_ATTACHED) light_holder.set_light_range(vehicle_light_range) light_holder.set_light_power(vehicle_light_power) - light_holder.set_light_on(vehicle_light_range && vehicle_light_power) + //light_holder.set_light_on(vehicle_light_range && vehicle_light_power) //else if(light_range) - //set_light_on(TRUE) + set_light_on(TRUE) healthcheck() update_icon() From cb9732cb7483ff2b4028ad200f2fb2d65c3512f5 Mon Sep 17 00:00:00 2001 From: Doubleumc Date: Fri, 27 Oct 2023 05:20:11 -0400 Subject: [PATCH 5/8] hull light offset --- code/datums/components/overlay_lighting.dm | 38 +++++++++++--------- code/modules/vehicles/apc/apc.dm | 2 ++ code/modules/vehicles/multitile/multitile.dm | 5 ++- code/modules/vehicles/tank/tank.dm | 2 +- code/modules/vehicles/van/van.dm | 3 +- 5 files changed, 29 insertions(+), 21 deletions(-) diff --git a/code/datums/components/overlay_lighting.dm b/code/datums/components/overlay_lighting.dm index 712ee0f395..205478c91c 100644 --- a/code/datums/components/overlay_lighting.dm +++ b/code/datums/components/overlay_lighting.dm @@ -195,22 +195,7 @@ if(directional) cast_directional_light() else if(length(current_holder?.locs) > 1) - var/multitile_translate_x = 0 - var/multitile_translate_y = 0 - switch(current_holder.dir) - if(NORTH, SOUTH) - multitile_translate_x = current_holder.bound_width * 0.5 - multitile_translate_y = current_holder.bound_height * 0.5 - if(EAST, WEST) - multitile_translate_x = current_holder.bound_height * 0.5 - multitile_translate_y = current_holder.bound_width * 0.5 - if(current_holder && overlay_lighting_flags & LIGHTING_ON) - current_holder.underlays -= visible_mask - var/matrix/transform = new - transform.Translate(multitile_translate_x - base_offset_x, multitile_translate_y - base_offset_y) - visible_mask.transform = transform - if(current_holder && overlay_lighting_flags & LIGHTING_ON) - current_holder.underlays += visible_mask + handle_multitile_light() get_new_turfs() @@ -442,6 +427,8 @@ add_dynamic_lumi(current_holder) if(directional) cast_directional_light() + else if(length(current_holder?.locs) > 1) + handle_multitile_light() if(current_holder && current_holder != parent && current_holder != parent_attached_to) RegisterSignal(current_holder, COMSIG_MOVABLE_MOVED, PROC_REF(on_holder_moved)) get_new_turfs() @@ -533,6 +520,25 @@ current_holder.underlays += visible_mask current_holder.underlays += cone +/datum/component/overlay_lighting/proc/handle_multitile_light() + if(length(current_holder?.locs) > 1) + var/multitile_translate_x = 0 + var/multitile_translate_y = 0 + switch(current_holder.dir) + if(NORTH, SOUTH) + multitile_translate_x = current_holder.bound_width * 0.5 + multitile_translate_y = current_holder.bound_height * 0.5 + if(EAST, WEST) + multitile_translate_x = current_holder.bound_height * 0.5 + multitile_translate_y = current_holder.bound_width * 0.5 + if(current_holder && overlay_lighting_flags & LIGHTING_ON) + current_holder.underlays -= visible_mask + var/matrix/transform = new + transform.Translate(multitile_translate_x - base_offset_x, multitile_translate_y - base_offset_y) + visible_mask.transform = transform + if(current_holder && overlay_lighting_flags & LIGHTING_ON) + current_holder.underlays += visible_mask + ///Called when current_holder changes loc. /datum/component/overlay_lighting/proc/on_holder_dir_change(atom/movable/source, olddir, newdir) SIGNAL_HANDLER diff --git a/code/modules/vehicles/apc/apc.dm b/code/modules/vehicles/apc/apc.dm index 60d21f7090..55e2cf2d11 100644 --- a/code/modules/vehicles/apc/apc.dm +++ b/code/modules/vehicles/apc/apc.dm @@ -34,6 +34,8 @@ GLOBAL_LIST_EMPTY(command_apc_list) movement_sound = 'sound/vehicles/tank_driving.ogg' + light_range = 4 + var/gunner_view_buff = 10 hardpoints_allowed = list( diff --git a/code/modules/vehicles/multitile/multitile.dm b/code/modules/vehicles/multitile/multitile.dm index 863a58afd4..527cd25a59 100644 --- a/code/modules/vehicles/multitile/multitile.dm +++ b/code/modules/vehicles/multitile/multitile.dm @@ -23,7 +23,6 @@ //Vehicle self-illumination light_system = MOVABLE_LIGHT - light_flags = LIGHT_ATTACHED light_range = 5 light_power = 2 @@ -186,9 +185,9 @@ light_holder.set_light_flags(LIGHT_ATTACHED) light_holder.set_light_range(vehicle_light_range) light_holder.set_light_power(vehicle_light_power) - //light_holder.set_light_on(vehicle_light_range && vehicle_light_power) + light_holder.set_light_on(vehicle_light_range && vehicle_light_power) //else if(light_range) - set_light_on(TRUE) + set_light_on(light_range && light_power) healthcheck() update_icon() diff --git a/code/modules/vehicles/tank/tank.dm b/code/modules/vehicles/tank/tank.dm index ad69f80cdf..87f17458aa 100644 --- a/code/modules/vehicles/tank/tank.dm +++ b/code/modules/vehicles/tank/tank.dm @@ -36,7 +36,7 @@ move_momentum_build_factor = 1.8 move_turn_momentum_loss_factor = 0.6 - vehicle_light_range = 7 + light_range = 4 // Rest (all the guns) is handled by the tank turret hardpoint hardpoints_allowed = list( diff --git a/code/modules/vehicles/van/van.dm b/code/modules/vehicles/van/van.dm index fdb2f397bb..5969b73957 100644 --- a/code/modules/vehicles/van/van.dm +++ b/code/modules/vehicles/van/van.dm @@ -41,7 +41,8 @@ movement_sound = 'sound/vehicles/tank_driving.ogg' honk_sound = 'sound/vehicles/honk_2_truck.ogg' - vehicle_light_range = 8 + light_range = 3 + vehicle_light_range = 6 move_max_momentum = 3 From 83017aa03e3f4519a343e667d1ae1dc8b8cf5268 Mon Sep 17 00:00:00 2001 From: Doubleumc Date: Fri, 27 Oct 2023 05:28:29 -0400 Subject: [PATCH 6/8] merged x/y offsets --- code/datums/components/overlay_lighting.dm | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/code/datums/components/overlay_lighting.dm b/code/datums/components/overlay_lighting.dm index 205478c91c..2f5c50c279 100644 --- a/code/datums/components/overlay_lighting.dm +++ b/code/datums/components/overlay_lighting.dm @@ -74,8 +74,7 @@ ///Cast range for the directional cast (how far away the atom is moved) var/cast_range = 2 - var/base_offset_x - var/base_offset_y + var/base_offset /datum/component/overlay_lighting/Initialize(_range, _power, _color, starts_on, is_directional) @@ -342,8 +341,7 @@ visible_mask.transform = null return var/offset = (pixel_bounds - 32) * 0.5 - base_offset_x = offset - base_offset_y = offset + base_offset = offset var/matrix/transform = new transform.Translate(-offset, -offset) visible_mask.transform = transform @@ -534,7 +532,7 @@ if(current_holder && overlay_lighting_flags & LIGHTING_ON) current_holder.underlays -= visible_mask var/matrix/transform = new - transform.Translate(multitile_translate_x - base_offset_x, multitile_translate_y - base_offset_y) + transform.Translate(multitile_translate_x - base_offset, multitile_translate_y - base_offset) visible_mask.transform = transform if(current_holder && overlay_lighting_flags & LIGHTING_ON) current_holder.underlays += visible_mask From 45ae794078e1cfaeb73c7d1e3f4746b9696afbdd Mon Sep 17 00:00:00 2001 From: Morrow Date: Sat, 28 Oct 2023 03:41:09 -0400 Subject: [PATCH 7/8] Some stuff --- code/datums/components/overlay_lighting.dm | 33 ++++++----- code/modules/vehicles/multitile/multitile.dm | 6 +- .../multitile/multitile_interaction.dm | 57 +++++++++++-------- 3 files changed, 50 insertions(+), 46 deletions(-) diff --git a/code/datums/components/overlay_lighting.dm b/code/datums/components/overlay_lighting.dm index 2f5c50c279..325d9d5c17 100644 --- a/code/datums/components/overlay_lighting.dm +++ b/code/datums/components/overlay_lighting.dm @@ -519,23 +519,22 @@ current_holder.underlays += cone /datum/component/overlay_lighting/proc/handle_multitile_light() - if(length(current_holder?.locs) > 1) - var/multitile_translate_x = 0 - var/multitile_translate_y = 0 - switch(current_holder.dir) - if(NORTH, SOUTH) - multitile_translate_x = current_holder.bound_width * 0.5 - multitile_translate_y = current_holder.bound_height * 0.5 - if(EAST, WEST) - multitile_translate_x = current_holder.bound_height * 0.5 - multitile_translate_y = current_holder.bound_width * 0.5 - if(current_holder && overlay_lighting_flags & LIGHTING_ON) - current_holder.underlays -= visible_mask - var/matrix/transform = new - transform.Translate(multitile_translate_x - base_offset, multitile_translate_y - base_offset) - visible_mask.transform = transform - if(current_holder && overlay_lighting_flags & LIGHTING_ON) - current_holder.underlays += visible_mask + var/multitile_translate_x = 0 + var/multitile_translate_y = 0 + switch(current_holder.dir) + if(NORTH, SOUTH) + multitile_translate_x = current_holder.bound_width * 0.5 + multitile_translate_y = current_holder.bound_height * 0.5 + if(EAST, WEST) + multitile_translate_x = current_holder.bound_height * 0.5 + multitile_translate_y = current_holder.bound_width * 0.5 + if(current_holder && overlay_lighting_flags & LIGHTING_ON) + current_holder.underlays -= visible_mask + var/matrix/transform = new + transform.Translate(multitile_translate_x - base_offset, multitile_translate_y - base_offset) + visible_mask.transform = transform + if(current_holder && overlay_lighting_flags & LIGHTING_ON) + current_holder.underlays += visible_mask ///Called when current_holder changes loc. /datum/component/overlay_lighting/proc/on_holder_dir_change(atom/movable/source, olddir, newdir) diff --git a/code/modules/vehicles/multitile/multitile.dm b/code/modules/vehicles/multitile/multitile.dm index 527cd25a59..148af24e0d 100644 --- a/code/modules/vehicles/multitile/multitile.dm +++ b/code/modules/vehicles/multitile/multitile.dm @@ -177,16 +177,13 @@ rotate_entrances(angle_to_turn) rotate_bounds(angle_to_turn) - //light_pixel_x = -bound_x - //light_pixel_y = -bound_y - if(bound_width > world.icon_size || bound_height > world.icon_size) light_holder = new(src) light_holder.set_light_flags(LIGHT_ATTACHED) light_holder.set_light_range(vehicle_light_range) light_holder.set_light_power(vehicle_light_power) light_holder.set_light_on(vehicle_light_range && vehicle_light_power) - //else if(light_range) + set_light_on(light_range && light_power) healthcheck() @@ -389,6 +386,7 @@ //vehicle is dead, no more lights if(health <= 0 && light_holder.light_range) + set_light_on(FALSE) light_holder.set_light_on(FALSE) update_icon() diff --git a/code/modules/vehicles/multitile/multitile_interaction.dm b/code/modules/vehicles/multitile/multitile_interaction.dm index 5450cea0d0..c4f1ed2d3d 100644 --- a/code/modules/vehicles/multitile/multitile_interaction.dm +++ b/code/modules/vehicles/multitile/multitile_interaction.dm @@ -134,22 +134,23 @@ take_damage_type(O.force * 0.05, "blunt", user) //Melee weapons from people do very little damage // Frame repairs on the vehicle itself -/obj/vehicle/multitile/proc/handle_repairs(obj/item/O, mob/user) +/obj/vehicle/multitile/proc/handle_repairs(obj/item/repairing_item, mob/user) if(user.action_busy) return + var/max_hp = initial(health) if(health > max_hp) health = max_hp to_chat(user, SPAN_NOTICE("The hull is fully intact.")) for(var/obj/item/hardpoint/holder/H in hardpoints) if(H.health > 0) - if(!iswelder(O)) - to_chat(user, SPAN_WARNING("You need welding tool to repair \the [H.name].")) + if(!iswelder(repairing_item)) + to_chat(user, SPAN_WARNING("You need welding tool to repair [H.name].")) return - if(!HAS_TRAIT(O, TRAIT_TOOL_BLOWTORCH)) + if(!HAS_TRAIT(repairing_item, TRAIT_TOOL_BLOWTORCH)) to_chat(user, SPAN_WARNING("You need a stronger blowtorch!")) return - H.handle_repair(O, user) + H.handle_repair(repairing_item, user) update_icon() return else @@ -158,25 +159,25 @@ var/repair_message = "welding structural struts back in place" var/sound_file = 'sound/items/weldingtool_weld.ogg' - var/obj/item/tool/weldingtool/WT + var/obj/item/tool/weldingtool/welder // For health < 75%, the frame needs welderwork, otherwise wrench if(health < max_hp * 0.75) - if(!iswelder(O)) + if(!iswelder(repairing_item)) to_chat(user, SPAN_NOTICE("The frame is way too busted! Try using a [SPAN_HELPFUL("welder")].")) return - if(!HAS_TRAIT(O, TRAIT_TOOL_BLOWTORCH)) + if(!HAS_TRAIT(repairing_item, TRAIT_TOOL_BLOWTORCH)) to_chat(user, SPAN_NOTICE("You need a more powerful blowtorch!")) return - WT = O - if(!WT.isOn()) - to_chat(user, SPAN_WARNING("\The [WT] needs to be on!")) + welder = repairing_item + if(!welder.isOn()) + to_chat(user, SPAN_WARNING("[welder] needs to be on!")) return else - if(!HAS_TRAIT(O, TRAIT_TOOL_WRENCH)) + if(!HAS_TRAIT(repairing_item, TRAIT_TOOL_WRENCH)) to_chat(user, SPAN_NOTICE("The frame is structurally sound, but there are a lot of loose nuts and bolts. Try using a [SPAN_HELPFUL("wrench")].")) return @@ -184,7 +185,7 @@ sound_file = 'sound/items/Ratchet.ogg' var/amount_fixed_adjustment = user.get_skill_duration_multiplier(SKILL_ENGINEER) - user.visible_message(SPAN_WARNING("[user] [repair_message] on \the [src]."), SPAN_NOTICE("You begin [repair_message] on \the [src].")) + user.visible_message(SPAN_WARNING("[user] [repair_message] on [src]."), SPAN_NOTICE("You begin [repair_message] on [src].")) playsound(get_turf(user), sound_file, 25) while(health < max_hp) @@ -192,27 +193,33 @@ playsound(get_turf(user), sound_file, 25) if(!do_after(user, 1 SECONDS, INTERRUPT_ALL, BUSY_ICON_BUILD)) - user.visible_message(SPAN_WARNING("[user] stops [repair_message] on \the [src]."), SPAN_NOTICE("You stop [repair_message] on \the [src]. Hull integrity is at [SPAN_HELPFUL(100.0*health/max_hp)]%.")) + user.visible_message(SPAN_WARNING("[user] stops [repair_message] on [src]."), SPAN_NOTICE("You stop [repair_message] on [src]. Hull integrity is at [SPAN_HELPFUL(100.0*health/max_hp)]%.")) return health = min(health + max_hp/100 * (5 / amount_fixed_adjustment), max_hp) - - if(WT) - WT.remove_fuel(1, user) - if(WT.get_fuel() < 1) - user.visible_message(SPAN_WARNING("[user] stops [repair_message] on \the [src]."), SPAN_NOTICE("You stop [repair_message] on \the [src]. Hull integrity is at [SPAN_HELPFUL(100.0*health/max_hp)]%.")) - return - if(health >= max_hp * 0.75) - user.visible_message(SPAN_WARNING("[user] finishes [repair_message] on \the [src]."), SPAN_NOTICE("You finish [repair_message] on \the [src]. The frame is structurally sound now, but there are a lot of loose nuts and bolts. Try using a [SPAN_HELPFUL("wrench")].")) - return + if(health >= max_hp * 0.50) + set_light_on(vehicle_light_range && vehicle_light_power) + light_holder.set_light_on(vehicle_light_range && vehicle_light_power) + to_chat(user, SPAN_NOTICE("[src]'s lights flicker to life!")) to_chat(user, SPAN_NOTICE("Hull integrity is at [SPAN_HELPFUL(100.0*health/max_hp)]%.")) + if(!welder) + continue + + welder.remove_fuel(1, user) + if(welder.get_fuel() < 1) + user.visible_message(SPAN_WARNING("[user] stops [repair_message] on [src]."), SPAN_NOTICE("You stop [repair_message] on [src]. Hull integrity is at [SPAN_HELPFUL(100.0*health/max_hp)]%.")) + return + if(health >= max_hp * 0.75) + user.visible_message(SPAN_WARNING("[user] finishes [repair_message] on [src]."), SPAN_NOTICE("You finish [repair_message] on [src]. The frame is structurally sound now, but there are a lot of loose nuts and bolts. Try using a [SPAN_HELPFUL("wrench")].")) + return + health = initial(health) - light_holder.set_light_on(vehicle_light_range && vehicle_light_power) + toggle_cameras_status(TRUE) update_icon() - user.visible_message(SPAN_NOTICE("[user] finishes [repair_message] on \the [src]."), SPAN_NOTICE("You finish [repair_message] on \the [src]. Hull integrity is at [SPAN_HELPFUL(100.0*health/max_hp)]%. ")) + user.visible_message(SPAN_NOTICE("[user] finishes [repair_message] on [src]."), SPAN_NOTICE("You finish [repair_message] on [src]. Hull integrity is at [SPAN_HELPFUL(100.0*health/max_hp)]%. ")) return //Special case for entering the vehicle without using the verb From 6516670a4fe101bfa7282ec19d2b7e6f627d18e5 Mon Sep 17 00:00:00 2001 From: Morrow Date: Sat, 28 Oct 2023 03:44:47 -0400 Subject: [PATCH 8/8] bam --- code/datums/components/overlay_lighting.dm | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/code/datums/components/overlay_lighting.dm b/code/datums/components/overlay_lighting.dm index 325d9d5c17..e14066ffb7 100644 --- a/code/datums/components/overlay_lighting.dm +++ b/code/datums/components/overlay_lighting.dm @@ -340,10 +340,9 @@ if(pixel_bounds == 32) visible_mask.transform = null return - var/offset = (pixel_bounds - 32) * 0.5 - base_offset = offset + base_offset = (pixel_bounds - 32) * 0.5 var/matrix/transform = new - transform.Translate(-offset, -offset) + transform.Translate(-base_offset, -base_offset) visible_mask.transform = transform directional_offset_x = 0 directional_offset_y = 0