From 45ae794078e1cfaeb73c7d1e3f4746b9696afbdd Mon Sep 17 00:00:00 2001 From: Morrow Date: Sat, 28 Oct 2023 03:41:09 -0400 Subject: [PATCH] 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