Skip to content

Commit

Permalink
Merge branch 'TauCetiStation:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Riverz1 authored Feb 14, 2025
2 parents ba44ddb + c6c6fc9 commit 267f683
Show file tree
Hide file tree
Showing 16 changed files with 128 additions and 4 deletions.
63 changes: 63 additions & 0 deletions .github/wiki/OBJ_DESTRUCTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Разрушаемость

Фреймворк разрушаемости был портирован в https://github.com/TauCetiStation/TauCetiClassic/pull/9835, но еще не все предметы переписаны под него.

## Как включить для предмета

Необходимый минимум - переопределить ``max_integrity`` и ``resistance_flags`` у объекта, например

```
max_integrity = 100 // "hp" предмета
resistance_flags = CAN_BE_HIT // включает возможность ударить предмет
```

При инициализации объект выставит ``atom_integrity`` соответствующе с ``max_integrity``, при получении урона и достижении ``atom_integrity`` нуля будет вызвана процедура разрушения.

Ниже перечислены опциональные возможности и твики системы.

### integrity_failure и atom_break()/atom_fix()

До достижения полного разрушения можно добавить объекту промежуточную стадию сломанности - объект еще существует, но может уже не работать, или работать не корректно.

``integrity_failure`` - процентное соотношение от ``max_integrity``, на котором объект "ломается". Значение от 0 до 1, где 0.5 это 50% от ``max_integrity``.

``/atom_break()`` - процедура, которая будет вызвана при достижении объектом ``integrity_failure``, и в которой вы должны прописать соответствующее поведение поломки (утрату функционала и тому подобное).

``/atom_fix()`` - если объект можно починить (вернуть потерянное integrity), то это процедура, которая будет вызвана при достижении объектом integrity выше ``integrity_failure``, и в которой вы должны прописать соответствующее поведение починки (возвращение функционала и тому подобное).


### atom_destruction(), deconstruct(), burn() и Destroy()

Когда ``atom_integrity`` достигает 0, вызывается ряд процедур в следующем порядке:

``atom_destruction()`` -> (обработчики в зависимости от типа урона, уничтожившего объект: ``burn()`` или ``deconstruct()``) -> ``Destroy()``

Вы можете переопределить их и на любом уровне подцепить свои эффекты, например, звук разрушения или спавн обломков.

``Destroy()`` вызывается всегда при уничтожении или разбора атома и более низкоуровневая процедура, про него можно почитать в [``/.github/wiki/HARDDELETES.md``](/.github/wiki/HARDDELETES.md).

### Armor и damage_deflection

``armor`` - список сопротивляемости предмета к определенным типам урона. Например,

```
armor = list(MELEE = 50, BULLET = 0, LASER = 0, ENERGY = 0, BOMB = 0, BIO = 0, FIRE = 100, ACID = 100)
```

будет значить, что объект будет игнорировать 50% от полученного урона от ударов в ручную, 100% от огня и кислоты.

Технически, вы можете использовать отрицательный коэффициент, но это не рекомендуется из-за плохой читаемости.

``damage_deflection`` - "порог" урона, который вовсе игнорируется. Например, если вы не хотите, чтобы кто-то мог расковырять металлическую стену ручкой.

```
damage_deflection = 5
```

Будет значить, что любой урон меньше 5 игнорируется и не влияет на объект, юзер получит соответствующее сообщение о тщетности своих попыток.

Стоит учесть, что атом сначала проверяет урон на ``damage_deflection``, и уже только потом применяет коэффициент брони.

### Другие resistance_flags

Более полный и актуальный список флагов всегда можно посмотреть в [``/code/__DEFINES/flags.dm``](/code/__DEFINES/flags.dm).
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
- [Сигналы, компоненты, элементы (hackmd)](https://hackmd.io/@tgstation/SignalsComponentsElements)
- [Сборщик мусора, Destroy, Harddeletes](/.github/wiki/HARDDELETES.md)
- [Переводы на русский](/.github/wiki/TRANSLATION.md)
* **Игра:**
- [Разрушаемость](/.github/wiki/OBJ_DESTRUCTION.md)
* **Карта:**
- [F.A.Q. по работе с картой](/.github/wiki/WORK_WITH_MAP.md)
- [Вводный курс (форум)](https://forum.taucetistation.org/t/gajd-na-maping-i-kak-etim-voobshhe-zanimatsya/32439)
Expand Down
11 changes: 9 additions & 2 deletions code/__DEFINES/flags.dm
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,14 @@ var/global/list/bitflags = list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 204
#define LAVA_PROOF (1<<0)
/// 100% immune to fire damage (but not necessarily to lava or heat)
#define FIRE_PROOF (1<<1)
/* todo, not implemented yet, part of the fire refactoring
// atom is flammable and can have the burning component
#define FLAMMABLE (1<<2)
/// currently burning
#define ON_FIRE (1<<3)
*/
/// acid can't even appear on it, let alone melt it.
#define UNACIDABLE (1<<4)
/// acid stuck on it doesn't melt it.
Expand All @@ -155,8 +162,8 @@ var/global/list/bitflags = list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 204
#define INDESTRUCTIBLE (1<<6)
/// can't be deconstructed with instruments
#define DECONSTRUCT_IMMUNE (1<<7)
/// can be hit with melee (mb change to CANT_BE_HIT)
#define CAN_BE_HIT (1<<8)
/// can be hit with melee
#define CAN_BE_HIT (1<<8) // todo: invert to CANT_BE_HIT or move from resistance_flags like on tg, or maybe rename resistance_flags to something like integrity_flags

#define FULL_INDESTRUCTIBLE INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF | DECONSTRUCT_IMMUNE

Expand Down
28 changes: 28 additions & 0 deletions code/game/machinery/vending/medical.dm
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,31 @@
/obj/item/device/healthanalyzer = 3,
)
private = TRUE

/obj/machinery/vending/firstaid
name = "NanoMed Kits"
desc = "First Aid Kits dispenser."
icon_state = "med_firstaid"
icon_deny = "med_firstaid-deny"
light_color = "#e6fff2"
product_ads = "Go save some lives!;The best stuff for your medbay.;Only the finest tools.;Natural chemicals!;This stuff saves lives.;Don't you want some?;Ping!"
products = list(
/obj/item/weapon/storage/firstaid/regular = 4,
/obj/item/weapon/storage/firstaid/adv = 4,
/obj/item/weapon/storage/firstaid/fire = 4,
/obj/item/weapon/storage/firstaid/o2 = 4,
/obj/item/weapon/storage/firstaid/toxin = 4,

)
contraband = list(
/obj/item/weapon/storage/firstaid/small_firstaid_kit/combat = 1,
)
prices = list(

)
premium = list(
/obj/item/weapon/storage/firstaid/small_firstaid_kit/space = 2,
/obj/item/weapon/storage/firstaid/small_firstaid_kit/civilian = 2,
/obj/item/weapon/storage/firstaid/small_firstaid_kit/nutriment = 2,
)
private = TRUE
1 change: 1 addition & 0 deletions code/game/objects/items/weapons/dice.dm
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@
poof()

/obj/item/weapon/dice/proc/diceroll(mob/user)
playsound(src, 'sound/misc/dice.ogg', VOL_EFFECTS_MASTER)
result = rand(1, sides)
var/comment = ""
if(sides == 20 && result == 20)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/datum/event/feature/area/replace/med_storage
special_area_types = list(/area/station/medical/storage)
replace_types = list(
/obj/item/weapon/storage/firstaid = null
/obj/item/weapon/storage/firstaid = null,
/obj/machinery/vending/firstaid = null
)
13 changes: 13 additions & 0 deletions code/modules/mining/mine_items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,19 @@ var/global/mining_shuttle_location = 0 // 0 = station 13, 1 = mining station
QUALITY_PRYING = 0.75
)

/obj/item/weapon/shovel/experimental
name = "experimental shovel"
desc = "It's a damn cool shovel."
icon_state = "expshovel"
item_state = "expshovel"
item_state_world = "expshovel_world"
force = 10.0
toolspeed = 0.1
origin_tech = "materials=2;engineering=3"
qualities = list(
QUALITY_PRYING = 0.1
)

/obj/item/weapon/shovel/spade
name = "spade"
desc = "A small tool for digging and moving dirt."
Expand Down
9 changes: 9 additions & 0 deletions code/modules/research/designs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1542,6 +1542,15 @@ other types of metals and chemistry for reagents).
build_path = /obj/item/weapon/circuitboard/miningdrill
category = list("Machine")

/datum/design/expshovel
name = "Experimental shovel"
desc = "This is an experimental shovel that digs damn fast!"
id = "expshovel"
build_type = PROTOLATHE
materials = list(MAT_METAL = 2500, MAT_GLASS = 200)
build_path = /obj/item/weapon/shovel/experimental
category = list("Equipment")

/datum/design/mining_drill_brace
name = "Machine Design (Mining Drill Brace)"
desc = "Brace for mining drill."
Expand Down
2 changes: 1 addition & 1 deletion code/modules/research/research.dm
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ The tech datums are the actual "tech trees" that you improve through researching
required_tech_levels = list()
cost = 500

unlocks_designs = list("ordercomp", "supplycomp", "advmop", "holosign", "spraycan", "space_suit", "space_suit_helmet", "glowsticks_adv", "stimpack")
unlocks_designs = list("ordercomp", "supplycomp", "advmop", "holosign", "spraycan", "space_suit", "space_suit_helmet", "glowsticks_adv", "stimpack", "expshovel")

/datum/technology/basic_mining
name = "Basic Mining"
Expand Down
Binary file modified icons/mob/human_face.dmi
Binary file not shown.
Binary file modified icons/mob/inhands/items_lefthand.dmi
Binary file not shown.
Binary file modified icons/mob/inhands/items_righthand.dmi
Binary file not shown.
Binary file modified icons/obj/robot_component.dmi
Binary file not shown.
Binary file modified icons/obj/tools.dmi
Binary file not shown.
Binary file modified icons/obj/vending.dmi
Binary file not shown.
Binary file added sound/misc/dice.ogg
Binary file not shown.

0 comments on commit 267f683

Please sign in to comment.