Skip to content

Commit

Permalink
Ребаланс движков (Тестовый) ч2
Browse files Browse the repository at this point in the history
Часть 2 ребаланса , изменена логика плазменных двигателей , теперь двигатель адекватно потребляет топливо и адекватно регулирует тягу. Исправлено отображение реальной скорости. Требуются дополнительные тесты и фиксы.
  • Loading branch information
Mirag1993 committed May 15, 2024
1 parent 4afeb4c commit caf456d
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 8 deletions.
11 changes: 10 additions & 1 deletion code/game/machinery/shuttle/shuttle_engine.dm
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
var/thrust = 0
///Whether this engine is actively providing thrust to the ship
var/thruster_active = FALSE

// [CELADON-ADD] - CELADON FIXES
/// Определяем тип двигателя
var/engine_type = "generic" //# Добавлено новое свойство для типа двигателя
// [/CELADON-ADD]
/**
* Uses up a specified percentage of the fuel cost, and returns the amount of thrust if successful.
* * percentage - The percentage of total thrust that should be used
Expand All @@ -23,6 +26,12 @@
update_icon_state()
return FALSE

// [CELADON-ADD] - CELADON FIXES
/obj/machinery/power/shuttle/engine/proc/plasma_thrust(percentage = 100, deltatime)
update_icon_state()
return FALSE
// [/CELADON-ADD]

/**
* Returns how much "Fuel" is left. (For use with engine displays.)
*/
Expand Down
14 changes: 13 additions & 1 deletion code/game/machinery/shuttle/shuttle_engine_types.dm
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@
if(heat_creation)
heat_engine()
var/to_use = fuel_use * (percentage / 100) * deltatime
return resolved_heater.consume_fuel(to_use, fuel_type) / to_use * thrust //This proc returns how much was actually burned, so let's use that and multiply it by the thrust to get all the thrust we CAN give.
// [CELADON-EDIT] - CELADON_FIXES
//return resolved_heater.consume_fuel(to_use, fuel_type) / to_use * thrust //This proc returns how much was actually burned, so let's use that and multiply it by the thrust to get all the thrust we CAN give.
return resolved_heater.consume_fuel(to_use, fuel_type)
// [/CELADON-EDIT]

/obj/machinery/power/shuttle/engine/fueled/return_fuel()
. = ..()
Expand Down Expand Up @@ -96,6 +99,15 @@
fuel_use = 20
thrust = 17.5
// [/CELADON-EDIT]
// [CELADON-ADD] - CELADON_FIXES
engine_type = "plasma" // Явно указываем, что это плазменный двигатель

/obj/machinery/power/shuttle/engine/fueled/plasma/plasma_thrust(percentage = 100, deltatime)
. = ..() // Вызов родительского метода, если он существует
var/obj/machinery/atmospherics/components/unary/shuttle/heater/resolved_heater = attached_heater?.resolve()
var/true_percentage = min(resolved_heater.return_gas() / fuel_use , percentage / 100) //Выбираем меньшее доступное значение , запрещаем летать на пустом баке
return thrust * true_percentage // Возвращаем тягу, умноженную на рассчитанный процент мощности
// [/CELADON-ADD]

/obj/machinery/power/shuttle/engine/fueled/expulsion
name = "expulsion thruster"
Expand Down
8 changes: 7 additions & 1 deletion code/modules/overmap/ships/controlled_ship_datum.dm
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,13 @@
for(var/obj/machinery/power/shuttle/engine/real_engine as anything in shuttle_port.get_engines())
if(!real_engine.enabled)
continue
thrust_used += real_engine.burn_engine(percentage, deltatime)
// [CELADON-EDIT] - CELADON FIXES
//thrust_used += real_engine.burn_engine(percentage, deltatime)
var/engine_thrust = real_engine.burn_engine(percentage, deltatime)
thrust_used += engine_thrust
if(real_engine.engine_type == "plasma")
thrust_used += real_engine.plasma_thrust(percentage, deltatime)
// [/CELADON-EDIT]

thrust_used = thrust_used / (shuttle_port.turf_count * 100)
est_thrust = thrust_used / percentage * 100 //cheeky way of rechecking the thrust, check it every time it's used
Expand Down
9 changes: 9 additions & 0 deletions mod_celadon/fixes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ ID мода: CELADON_FIXES
### Описание мода

Этот мод Фиксит различные вещи в коде, например крашеры.

<!--
Что он делает, что добавляет: что, куда, зачем и почему - всё здесь.
А также любая полезная информация.
Expand All @@ -36,6 +37,14 @@ ID мода: CELADON_FIXES

- EDIT: `code\modules\projectiles\ammunition\caseless\_caseless.dm`: `/obj/item/ammo_casing/caseless/on_eject()`

- ADD: `code\game\machinery\shuttle\shuttle_engine.dm`: `var/engine_type=`
- ADD: `code\game\machinery\shuttle\shuttle_engine.dm`: `/obj/machinery/power/shuttle/engine/proc/plasma_thrust`
- EDIT: `code\game\machinery\shuttle\shuttle_engine_types.dm`: `/obj/machinery/power/shuttle/engine/fueled/burn_engine`-> `return resolved_heater.consume_fuel(to_use, fuel_type)`
- ADD: `code\game\machinery\shuttle\shuttle_engine_types.dm`: `/obj/machinery/power/shuttle/engine/fueled/plasma`-> `engine_type = "plasma"`
- ADD: `code\game\machinery\shuttle\shuttle_engine_types.dm`: `/obj/machinery/power/shuttle/engine/fueled/plasma/plasma_thrust`
- EDIT: `code\modules\overmap\ships\controlled_ship_datum.dm`: `/datum/overmap/ship/controlled/burn_engines` -> `Добавлена логика`
- EDIT: `tgui\packages\tgui\interfaces\HelmConsole.js`: `estThrust * 500`-> `estThrust * 1600`
- EDIT: `tgui\packages\tgui\interfaces\HelmConsole.js`: ` format={(value) => value.toFixed(1)}` -> ` format={(value) => value.toFixed(2)}`
<!--
Если вы редактировали какие-либо процедуры или переменные в кор коде,
они должны быть указаны здесь.
Expand Down
25 changes: 20 additions & 5 deletions tgui/packages/tgui/interfaces/HelmConsole.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,10 @@ const ShipContent = (_props, context) => {
>
<AnimatedNumber
value={speed}
format={(value) => value.toFixed(1)}
// [CELADON-EDIT] - CELADON FIXES
// format={(value) => value.toFixed(1)}
format={(value) => value.toFixed(2)}
// [/CELADON-EDIT]
/>
Gm/s
</ProgressBar>
Expand Down Expand Up @@ -240,7 +243,10 @@ const ShipContent = (_props, context) => {
<Table.Cell>Max thrust per second:</Table.Cell>
<Table.Cell>
<AnimatedNumber
value={estThrust * 500}
// [CELADON-EDIT] - CELADON FIXES
// value={estThrust * 500}
value={estThrust * 1600}
// [/CELADON-EDIT]
format={(value) => value.toFixed(2)}
/>
Gm/s²
Expand Down Expand Up @@ -465,15 +471,24 @@ const ShipControlContent = (_props, context) => {
animated
/>
<NumberInput
value={(burnPercentage / 100) * estThrust * 500}
// [CELADON-EDIT] CELADON FIXES
// value={(burnPercentage / 100) * estThrust * 500}
value={(burnPercentage / 100) * estThrust * 1600}
// [/CELADON-EDIT]
minValue={0.01}
step={0.01}
// 5 times a second, 60 seconds in a minute (5 * 60 = 300)
maxValue={estThrust * 500}
// [CELADON-EDIT] CELADON FIXES
// maxValue={estThrust * 500}
maxValue={estThrust * 1600}
// [/CELADON-EDIT]
unit="Gm/s²"
onDrag={(e, value) =>
act('change_burn_percentage', {
percentage: Math.round((value / (estThrust * 500)) * 100),
// [CELADON-EDIT] CELADON FIXES
// percentage: Math.round((value / (estThrust * 500)) * 100),
percentage: Math.round((value / (estThrust * 1600)) * 100),
// [/CELADON-EDIT]
})
}
format={(value) => value.toFixed(2)}
Expand Down

0 comments on commit caf456d

Please sign in to comment.