Skip to content

Commit

Permalink
Mech fixes and equips overlay feature, mech icons(Scattergun and Lase…
Browse files Browse the repository at this point in the history
…rcanon) changes. (#726)

-Багажник открывается как раньше нормально, если нет пассажира на спине.
-Пассажиры и пилоты теперь нормально отображаются на диогонали
-Больше не должны происходить приколы отображений пассажиров, подкинул
проверку на нулл и дополнительный пересчёт пассажиров при поворотах.
(Пример багов на скринах)

![image](https://github.com/ss220-space/Baystation12/assets/88627712/0f90fc06-2f1c-426c-9afe-22944f302f95)

![image](https://github.com/ss220-space/Baystation12/assets/88627712/81393e20-b83c-4fb6-904c-6ce30092cf6a)

![image](https://github.com/ss220-space/Baystation12/assets/88627712/e57e9ff6-4d2f-45f5-b59f-c21d337ec6a5)
Вот ещё пачка видосов с показом: 

https://cdn.discordapp.com/attachments/907288887024553984/1208153470675451974/Pilot_.mp4?ex=65e23f99&is=65cfca99&hm=0348daf2a38929009447150d664c4ec228f8bbc88856525cd9a0351f7b6fb465&


https://cdn.discordapp.com/attachments/907288887024553984/1208153489985904690/Pilot_.mp4?ex=65e23f9e&is=65cfca9e&hm=b47575422fe71b0f9fd2bcb1a7df23e3017c41c42f90ea45dc5c9596e735ea3a&

На сдачу, сделал вот эту фичу: 

![Modules](https://github.com/ss220-space/Baystation12/assets/88627712/b2035ea2-6777-4d18-92d5-b39c64cca138)
Да, модули отображаются и ЗА мехом.
На сдачу от сдачи, сменил спрайты пулемёта и лазеркэнона, они теперь
невьебически крутые:

![image](https://github.com/ss220-space/Baystation12/assets/88627712/f3734a44-cbdf-4ea9-9231-e8aad55ba489)
Оверлеи такие же, да.


![ezgif-5-40ba21e66e](https://github.com/ss220-space/Baystation12/assets/88627712/c52eac59-2280-49bb-a4c1-512f2de11f16)
Чинится баг отображения при переходе по MULTI Z:

![image](https://github.com/ss220-space/Baystation12/assets/88627712/40763e9e-958d-4051-a46d-542506656210)

https://cdn.discordapp.com/attachments/907288887024553984/1208814914081259642/2024-02-18_21-36-52.mp4?ex=65e4a79e&is=65d2329e&hm=c1e674d8bb008f04b4c734bf4aa5199ce0db550a4d667d4f736a01a084d080a4&

![image](https://github.com/ss220-space/Baystation12/assets/88627712/5032f06a-1675-49d4-b344-bb0e78b056fe)
Чинится прикол с возможность прыгнуть на меха с любого расстояния после
открытия меню выбора
Чинится прикол с невозможность установки некоторых модулей, что мешают
пассажирам. Обычно это был резак.
  • Loading branch information
AmShegars authored Feb 19, 2024
1 parent bb79f34 commit 685f753
Show file tree
Hide file tree
Showing 10 changed files with 59 additions and 27 deletions.
1 change: 1 addition & 0 deletions code/modules/mechs/components/body.dm
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@

air_supply = new /obj/machinery/portable_atmospherics/canister/air/mech(src)
storage_compartment = new(src)
owner = loc

/obj/item/mech_component/chassis/proc/update_air(var/take_from_supply)

Expand Down
42 changes: 32 additions & 10 deletions code/modules/mechs/mech_icon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,18 @@ proc/get_mech_images(var/list/components = list(), var/overlay_layer = FLOAT_LAY
for(var/hardpoint in hardpoints)
var/obj/item/mech_equipment/hardpoint_object = hardpoints[hardpoint]
if(hardpoint_object)
//
if(hardpoint == "left hand")
if(dir == WEST || dir == SOUTHWEST || dir == NORTHWEST)
hardpoint_object.mech_layer = MECH_GEAR_LAYER
else if(dir == EAST || dir == SOUTHEAST || dir == NORTHEAST)
hardpoint_object.mech_layer = MECH_BACK_LAYER
if(hardpoint == "right hand")
if(dir == WEST || dir == SOUTHWEST || dir == NORTHWEST)
hardpoint_object.mech_layer = MECH_BACK_LAYER
else if(dir == EAST || dir == SOUTHEAST || dir == NORTHEAST)
hardpoint_object.mech_layer = MECH_GEAR_LAYER
//
var/use_icon_state = "[hardpoint_object.icon_state]_[hardpoint]"
if(power == MECH_POWER_ON)
if(use_icon_state in GLOB.mech_weapon_overlays)
Expand All @@ -59,20 +71,25 @@ proc/get_mech_images(var/list/components = list(), var/overlay_layer = FLOAT_LAY
overlays = new_overlays

/mob/living/exosuit/proc/update_pilots(var/update_overlays = TRUE)
var/local_dir = dir
if(update_overlays && LAZYLEN(pilot_overlays))
overlays -= pilot_overlays
pilot_overlays = null
if(local_dir == NORTHEAST || local_dir == SOUTHEAST)
local_dir = EAST
else if(local_dir == NORTHWEST || local_dir == SOUTHWEST)
local_dir = WEST
if(!body || ((body.pilot_coverage < 100 || body.transparent_cabin) && !body.hide_pilot))
for(var/i = 1 to LAZYLEN(pilots))
var/mob/pilot = pilots[i]
var/image/draw_pilot = new
draw_pilot.appearance = pilot
var/rel_pos = dir == NORTH ? -1 : 1
var/rel_pos = local_dir == NORTH ? -1 : 1
draw_pilot.layer = MECH_PILOT_LAYER + (body ? ((LAZYLEN(body.pilot_positions)-i)*0.001 * rel_pos) : 0)
draw_pilot.plane = FLOAT_PLANE
if(body && i <= LAZYLEN(body.pilot_positions))
var/list/offset_values = body.pilot_positions[i]
var/list/directional_offset_values = offset_values["[dir]"]
var/list/directional_offset_values = offset_values["[local_dir]"]
draw_pilot.pixel_x = pilot.default_pixel_x + directional_offset_values["x"]
draw_pilot.pixel_y = pilot.default_pixel_y + directional_offset_values["y"]
draw_pilot.pixel_z = 0
Expand All @@ -82,6 +99,7 @@ proc/get_mech_images(var/list/components = list(), var/overlay_layer = FLOAT_LAY
overlays += pilot_overlays

/mob/living/exosuit/proc/update_passengers(var/update_overlays = TRUE)
var/local_dir = dir // <- Для того чтоб не руинить направление передвижения меха, мы применим эту переменную
if(update_overlays && LAZYLEN(back_passengers_overlays))
overlays -= back_passengers_overlays
if(update_overlays && LAZYLEN(left_back_passengers_overlays))
Expand All @@ -94,20 +112,23 @@ proc/get_mech_images(var/list/components = list(), var/overlay_layer = FLOAT_LAY
var/passenger_back_layer
var/passenger_left_back_layer
var/passenger_right_back_layer
//
if(dir == EAST)
// Дабы исключить момент когда при боковом движении пассажиров не видно, помимо обычных направлений, будут прописаны следующие:

if(local_dir == EAST || local_dir == NORTHEAST || local_dir == SOUTHEAST)
local_dir = EAST
passenger_back_layer = MECH_BACK_LAYER
passenger_left_back_layer = MECH_BACK_LAYER - 0.01
passenger_right_back_layer = MECH_GEAR_LAYER
else if(dir == WEST)
else if(local_dir == WEST || local_dir == NORTHWEST || local_dir == SOUTHWEST)
local_dir = WEST
passenger_back_layer = MECH_BACK_LAYER
passenger_left_back_layer = MECH_GEAR_LAYER
passenger_right_back_layer = MECH_BACK_LAYER - 0.01
else if(dir == SOUTH)
else if(local_dir == SOUTH)
passenger_back_layer = MECH_BACK_LAYER
passenger_left_back_layer = MECH_BACK_LAYER
passenger_right_back_layer = MECH_BACK_LAYER
else if(dir == NORTH)
else if(local_dir == NORTH)
passenger_back_layer = MECH_GEAR_LAYER + 0.01
passenger_left_back_layer = MECH_GEAR_LAYER + 0.01
passenger_right_back_layer = MECH_GEAR_LAYER + 0.01
Expand All @@ -117,8 +138,9 @@ proc/get_mech_images(var/list/components = list(), var/overlay_layer = FLOAT_LAY
var/mob/passenger_back = passenger_compartment.back_passengers[1]
var/image/draw_passenger_back = new
draw_passenger_back.appearance = passenger_back
draw_passenger_back.plane = FLOAT_PLANE
var/list/back_offset_values = body.back_passengers_positions
var/list/back_directional_offset_values = back_offset_values["[dir]"]
var/list/back_directional_offset_values = back_offset_values["[local_dir]"]
draw_passenger_back.pixel_x = passenger_back.default_pixel_x + back_directional_offset_values["x"]
draw_passenger_back.pixel_y = passenger_back.default_pixel_y + back_directional_offset_values["y"]
draw_passenger_back.pixel_z = 0
Expand All @@ -132,7 +154,7 @@ proc/get_mech_images(var/list/components = list(), var/overlay_layer = FLOAT_LAY
draw_passenger_left_back.appearance = passenger_left_back
draw_passenger_left_back.plane = FLOAT_PLANE
var/list/left_offset_values = body.left_back_passengers_positions
var/list/left_directional_offset_values = left_offset_values["[dir]"]
var/list/left_directional_offset_values = left_offset_values["[local_dir]"]
draw_passenger_left_back.pixel_x = passenger_left_back.default_pixel_x + left_directional_offset_values["x"]
draw_passenger_left_back.pixel_y = passenger_left_back.default_pixel_y + left_directional_offset_values["y"]
draw_passenger_left_back.pixel_z = 0
Expand All @@ -147,7 +169,7 @@ proc/get_mech_images(var/list/components = list(), var/overlay_layer = FLOAT_LAY
draw_passenger_right_back.appearance = passenger_right_back
draw_passenger_right_back.plane = FLOAT_PLANE
var/list/right_offset_values = body.right_back_passengers_positions
var/list/right_directional_offset_values = right_offset_values["[dir]"]
var/list/right_directional_offset_values = right_offset_values["[local_dir]"]
draw_passenger_right_back.pixel_x = passenger_right_back.default_pixel_x + right_directional_offset_values["x"]
draw_passenger_right_back.pixel_y = passenger_right_back.default_pixel_y + right_directional_offset_values["y"]
draw_passenger_right_back.pixel_z = 0
Expand Down
29 changes: 15 additions & 14 deletions code/modules/mechs/mech_interaction.dm
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,8 @@
/mob/living/exosuit/proc/check_passenger(var/mob/user) // Выбираем желаемое место, проверяем можно ли его занять, стартуем прок занятия
var/choose
var/choosed_place = input(usr, "Choose passenger place which you want to take.", name, choose) as null|anything in passenger_places
if(!user.Adjacent(src)) // <- Мех рядом?
return FALSE
if(user.r_hand != null || user.l_hand != null)
to_chat(user,SPAN_NOTICE("You need two free hands to take [choosed_place]."))
return
Expand Down Expand Up @@ -384,10 +386,10 @@

/mob/living/exosuit/proc/enter_passenger(var/mob/user,var/place)// Пытается пихнуть на пассажирское место пассажира, перед этим ещё раз проверяя их
//Проверка спины
src.visible_message(SPAN_NOTICE(" [user] Starts climb on the [place] of mech!"))
src.visible_message(SPAN_NOTICE(" [user] starts climb on the [place] of [src]!"))
if(do_after(user, 2 SECONDS, get_turf(src),DO_SHOW_PROGRESS|DO_FAIL_FEEDBACK|DO_USER_CAN_TURN| DO_USER_UNIQUE_ACT | DO_PUBLIC_PROGRESS))
if(user.r_hand != null || user.l_hand != null)
to_chat(user,SPAN_NOTICE("You need two free hands to clim on[place] of mech."))
to_chat(user,SPAN_NOTICE("You need two free hands to clim on[place] of [src]."))
return
if(place == "Back" && LAZYLEN(passenger_compartment.back_passengers) == 0)
user.forceMove(passenger_compartment)
Expand All @@ -404,13 +406,13 @@
else
to_chat(user,SPAN_NOTICE("Looks like [place] is busy!"))
return 0
src.visible_message(SPAN_NOTICE(" [user] climbed on [place] of mech!"))
src.visible_message(SPAN_NOTICE(" [user] climbed on [place] of [src]!"))
passengers_ammount += 1
update_passengers()

// будет использоваться Life() дабы исключить моменты, когда по какой-то причине пассажир слез с меха, лежа на полу. Life вызовется, обработается pinned, всем в кайф.
/mob/living/exosuit/proc/leave_passenger(var/mob/user)// Пассажир сам покидает меха
src.visible_message(SPAN_NOTICE("[user] jump off from mech!"))
src.visible_message(SPAN_NOTICE("[user] jump off [src]!"))
user.dropInto(loc)
user.pinned -= src
user.Life()
Expand All @@ -433,23 +435,23 @@
i.pinned -= src
i.Life()
passengers_ammount -= 1
src.visible_message(SPAN_WARNING("[i] was forcelly removed from mech by [author]"))
src.visible_message(SPAN_WARNING("[i] was forcelly removed from [src] by [author]"))
if(LAZYLEN(passenger_compartment.left_back_passengers)>0)
for(var/mob/i in passenger_compartment.left_back_passengers)
LAZYREMOVE(passenger_compartment.left_back_passengers,i)
i.dropInto(loc)
i.pinned -= src
i.Life()
passengers_ammount -= 1
src.visible_message(SPAN_WARNING("[i] was forcelly removed from mech by [author]"))
src.visible_message(SPAN_WARNING("[i] was forcelly removed from [src] by [author]"))
if(LAZYLEN(passenger_compartment.right_back_passengers) > 0)
for(var/mob/i in passenger_compartment.right_back_passengers)
LAZYREMOVE(passenger_compartment.right_back_passengers,i)
i.dropInto(loc)
i.pinned -= src
i.Life()
passengers_ammount -= 1
src.visible_message(SPAN_WARNING("[i] was forcelly removed from mech by [author]"))
src.visible_message(SPAN_WARNING("[i] was forcelly removed from [src] by [author]"))
update_passengers()

else if(mode == MECH_DROP_ANY_PASSENGER) // Сброс по приоритету спина - левый бок - правый бок.
Expand All @@ -459,7 +461,7 @@
i.dropInto(loc)
i.pinned -= src
i.Life()
src.visible_message(SPAN_WARNING("[i] was forcelly removed from mech by [author]"))
src.visible_message(SPAN_WARNING("[i] was forcelly removed from [src] by [author]"))
passengers_ammount -= 1
update_passengers()
return
Expand All @@ -469,7 +471,7 @@
i.dropInto(loc)
i.pinned -= src
i.Life()
src.visible_message(SPAN_WARNING("[i] was forcelly removed from mech by [author]"))
src.visible_message(SPAN_WARNING("[i] was forcelly removed from [src] by [author]"))
passengers_ammount -= 1
update_passengers()
return
Expand All @@ -480,27 +482,27 @@
i.pinned -= src
i.Life()
i.Life()
src.visible_message(SPAN_WARNING("[i] was forcelly removed from mech by [author]"))
src.visible_message(SPAN_WARNING("[i] was forcelly removed from [src] by [author]"))
passengers_ammount -= 1
update_passengers()
return

else // <- Опустошается определённое место
if(place == "Back")
for(var/mob/i in passenger_compartment.back_passengers)
src.visible_message(SPAN_WARNING("[i] was forcelly removed from mech by [author]"))
src.visible_message(SPAN_WARNING("[i] was forcelly removed from [src] by [author]"))
i.dropInto(loc)
i.pinned -= src
LAZYREMOVE(passenger_compartment.back_passengers,i)
else if(place == "Left back")
for(var/mob/i in passenger_compartment.left_back_passengers)
src.visible_message(SPAN_WARNING("[i] was forcelly removed from mech by [author]!"))
src.visible_message(SPAN_WARNING("[i] was forcelly removed from [src] by [author]!"))
i.dropInto(loc)
i.pinned -= src
LAZYREMOVE(passenger_compartment.left_back_passengers,i)
else if(place == "Right back")
for(var/mob/i in passenger_compartment.right_back_passengers)
src.visible_message(SPAN_WARNING("[i] was forcelly removed from mech by [author]!"))
src.visible_message(SPAN_WARNING("[i] was forcelly removed from [src] by [author]!"))
i.dropInto(loc)
i.pinned -= src
LAZYREMOVE(passenger_compartment.right_back_passengers,i)
Expand Down Expand Up @@ -575,7 +577,6 @@
to_chat(user, SPAN_WARNING("[to_place] covered by passenger, you cant install \the [thing]."))
return
//
return
if(install_system(thing, to_place, user))
return
to_chat(user, SPAN_WARNING("\The [thing] could not be installed in that hardpoint."))
Expand Down
7 changes: 6 additions & 1 deletion code/modules/mechs/mech_movement.dm
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,13 @@
if(exosuit.dir != moving_dir && !(direction & (UP|DOWN)))
playsound(exosuit.loc, exosuit.mech_turn_sound, 40,1)
exosuit.set_dir(moving_dir)
if(exosuit.passengers_ammount>0)
//Данная формула нужна чтобы УБЕДИТЬСЯ в расчётах количества пассажиров, ибо по не очевидным причинам, оно может не расчитать верно
exosuit.passengers_ammount = LAZYLEN(exosuit.passenger_compartment.back_passengers) + LAZYLEN(exosuit.passenger_compartment.left_back_passengers) + LAZYLEN(exosuit.passenger_compartment.right_back_passengers)
if(exosuit.passengers_ammount > 0)
exosuit.update_passengers()
for(var/hardpoint in exosuit.hardpoints)
if(hardpoint == "left hand" || hardpoint == "right hand")
exosuit.update_icon()
exosuit.SetMoveCooldown(exosuit.legs.turn_delay)
//TURN

Expand Down
1 change: 1 addition & 0 deletions code/modules/mechs/premade/powerloader.dm
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
max_damage = 180
power_use = 0
climb_time = 6
allow_passengers = FALSE

/obj/item/mech_component/chassis/powerloader/prebuild()
. = ..()
Expand Down
4 changes: 3 additions & 1 deletion code/modules/mob/living/living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,9 @@ default behaviour is:
if(C.passengers_ammount > 1)
var/choose
var/choosed_place = input(usr, "Choose passenger place which you want unload.", name, choose) as null|anything in C.passenger_places
C.forced_leave_passenger(choosed_place , null , C)
if(choosed_place == null)
return FALSE
C.forced_leave_passenger(choosed_place, null , C)
else
C.forced_leave_passenger(null , MECH_DROP_ANY_PASSENGER , C)
return TRUE
Expand Down
Binary file modified icons/mecha/mech_equipment.dmi
Binary file not shown.
Binary file modified icons/mecha/mech_weapon_overlays.dmi
Binary file not shown.
Binary file modified icons/mecha/mech_weapon_overlays_off.dmi
Binary file not shown.
2 changes: 1 addition & 1 deletion infinity/code/modules/mechs/guns.dm
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
/obj/item/mech_equipment/mounted_system/taser/laser/Ert //Mech laser canon (Danger shit)
name = "\improper CH-PS \"Anigilator\" laser"
desc = "An exosuit-mounted laser rifle. Handle with care."
icon_state = "mech_lasercarbine"
icon_state = "mech_lasercanon"
holding_type = /obj/item/gun/energy/lasercannon/mounted

/obj/item/gun/energy/lasercannon/mounted
Expand Down

0 comments on commit 685f753

Please sign in to comment.