forked from shiptest-ss13/Shiptest
-
-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'beta-dev' into mod_celadon_yata_gandon
Signed-off-by: MrCat15352 <[email protected]>
- Loading branch information
Showing
121 changed files
with
485 additions
and
4,617 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# Модпаки | ||
|
||
Модпаки загружаются компилятором сразу после всего остального кода и после карты, что позволяет делать оверрайды, безболезненно добавлять предметы, пользуясь дефайнами из *core code* и много много всего. | ||
|
||
Инициализируются же модпаки на этапе `INIT_ORDER_MODPACKS` сразу после `INIT_ORDER_INPUT` с вызовом соответствующего прока у датума. | ||
Подробнее можно почитать в [`mods/_modpack.dm`] | ||
|
||
## Зачем? | ||
|
||
1. Чтобы не изменять *core code*, а оверрайдить здесь | ||
2. Удобный ввод новых предметов | ||
3. Сохранять ивентовые паки для последующего возможного использования в других ивентах | ||
|
||
## Создание модпака | ||
|
||
Любой модпак состоит из: | ||
|
||
- Папки пака | ||
|
||
- `.dme` файла с подключением всех остальных | ||
- `.dm` файла с датумом, содержащем информацию о паке | ||
- Остальных файлов пака | ||
|
||
Быстро создать модпак можно с помощью скрипта `mod_celadon/create_modpack.bat`. | ||
|
||
### Структура модпака | ||
|
||
Если мы условимся, что наш пак будет называется `hello_world`, то это будет выглядеть так: | ||
|
||
```text | ||
mod_celadon/hello_world | ||
|- _hello_world.dm | ||
|- _hello_world.dme | ||
|- any_file.dm | ||
|- ... | ||
\- some_file.dm | ||
``` | ||
|
||
А теперь каждый файл по отдельности: | ||
|
||
### `mod_celadon/hello_world/_hello_world.dme` | ||
|
||
```dm | ||
#include "_hello_world.dm" | ||
#include "any_file.dm" | ||
// ... | ||
#include "some_file.dm" | ||
``` | ||
|
||
Здесь подключаются все необходимые файлы, включая файл с датумом модпака. Ничего особенного. | ||
|
||
Стоит лишь учитывать, что пути локальные, а не глобальные. | ||
|
||
### `mod_celadon/hello_world/_hello_world.dm` | ||
|
||
```dm | ||
/datum/modpack/hello_world | ||
name = "Hello world" | ||
desc = "Описание модпака" | ||
author = "SuhEugene" // Хороший мужик, систему модапаков у него 'позаимствована'. | ||
``` | ||
|
||
- `name` - Имя пака. Необязательно такое же, как в коде, но желательно. | ||
- `desc` - Очевидно, описание пака. Хотелось бы, чтобы оно было достаточно подробным, чтобы можно было понять что содержит пак, но не сильно замудрённым, чтобы любой игрок осилил буквы. | ||
- `author` - Никнейм на гитхабе, тег дискорда или даже несколько таких. Просто чтобы обозначить автора(ов) в простейшей форме. | ||
|
||
### `mod_celadon/hello_world/any_file.dm` | ||
|
||
Это просто любой файл. Как в названии и написано. И название необязательно такое. Просто какой-либо угодно файл с dm кодом. | ||
|
||
## Ассеты | ||
|
||
Этим обобщающим словом обычно называют картинки и звуки. Их я попрошу оставлять в папке `mod_celadon/hello_world/icons/` и в `mod_celadon/hello_world/sound/` соответственно. | ||
Лучше всего, если модпак будет использовать собственные ассеты и не обращаться к *пакам* или же другим модпакам. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/datum/modpack | ||
/// A string name for the modpack. Used for looking up other modpacks in init. | ||
var/name | ||
/// A string desc for the modpack. Can be used for modpack verb list as description. | ||
var/desc | ||
/// A string with authors of this modpack. | ||
var/author | ||
|
||
/datum/modpack/proc/pre_initialize() | ||
if(!name) | ||
return "Modpack name is unset." | ||
|
||
/datum/modpack/proc/initialize() | ||
return | ||
|
||
/datum/modpack/proc/post_initialize() | ||
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
#define INIT_ORDER_MODPACKS 16.5 | ||
|
||
SUBSYSTEM_DEF(modpacks) | ||
name = "Modpacks" | ||
init_order = INIT_ORDER_MODPACKS | ||
flags = SS_NO_FIRE | ||
var/list/loaded_modpacks | ||
var/list/tgui_data | ||
|
||
/datum/controller/subsystem/modpacks/Initialize() | ||
var/list/all_modpacks = list() | ||
init_subtypes(/datum/modpack/, all_modpacks) | ||
|
||
loaded_modpacks = list() | ||
// Pre-init and register all compiled modpacks. | ||
for(var/datum/modpack/package as anything in all_modpacks) | ||
var/fail_msg = package.pre_initialize() | ||
if(QDELETED(package)) | ||
stack_trace("Modpack of type [package.type] is null or queued for deletion.") | ||
if(fail_msg) | ||
stack_trace("Modpack [package.type] failed to pre-initialize: [fail_msg].") | ||
if(loaded_modpacks[package.name]) | ||
stack_trace("Attempted to register duplicate modpack name: [package.name].") | ||
loaded_modpacks.Add(package) | ||
|
||
// Handle init and post-init (two stages in case a modpack needs to implement behavior based on the presence of other packs). | ||
for(var/datum/modpack/package as anything in loaded_modpacks) | ||
var/fail_msg = package.initialize() | ||
if(fail_msg) | ||
stack_trace("Modpack [(istype(package) && package.name) || "Unknown"] failed to initialize: [fail_msg]") | ||
for(var/datum/modpack/package as anything in loaded_modpacks) | ||
var/fail_msg = package.post_initialize() | ||
if(fail_msg) | ||
stack_trace("Modpack [(istype(package) && package.name) || "Unknown"] failed to post-initialize: [fail_msg]") | ||
|
||
if(SSdbcore.IsConnected()) | ||
load_admins() // To make admins always have modular added verbs | ||
|
||
/mob/verb/modpacks_list() | ||
set name = "Modpacks List" | ||
set category = "OOC" | ||
|
||
if(!SSmodpacks.initialized) | ||
return | ||
|
||
if(!length(SSmodpacks.loaded_modpacks)) | ||
to_chat(src, "Этот сервер не использует какие-либо модификации.") | ||
return | ||
|
||
SSmodpacks.ui_interact(src) | ||
|
||
/datum/controller/subsystem/modpacks/ui_static_data(mob/user) | ||
var/list/data = list() | ||
|
||
if(!length(tgui_data)) | ||
tgui_data = generate_modpacks_data() | ||
data["modpacks"] = tgui_data | ||
|
||
return data | ||
|
||
/datum/controller/subsystem/modpacks/proc/generate_modpacks_data() | ||
var/list/modpacks = list() | ||
for(var/datum/modpack/modpack as anything in loaded_modpacks) | ||
if(modpack.name) | ||
modpacks += list(list( | ||
"name" = modpack.name, | ||
"desc" = modpack.desc, | ||
"author" = modpack.author | ||
)) | ||
return modpacks | ||
|
||
/datum/controller/subsystem/modpacks/ui_state(mob/user) | ||
return GLOB.always_state | ||
|
||
/datum/controller/subsystem/modpacks/ui_interact(mob/user, datum/tgui/ui = null) | ||
ui = SStgui.try_update_ui(user, src, ui) | ||
if(!ui) | ||
ui = new(user, src, "ModpacksList", name) | ||
ui.open() | ||
ui.set_autoupdate(FALSE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/datum/modpack/cargo_items | ||
name = "Новые позиции в карго" | ||
desc = "Новая продукция в карго различных направленностей для разнообразия игры" | ||
author = "Yata9arasu" | ||
|
||
/datum/modpack/cargo_items/pre_initialize() | ||
. = ..() | ||
|
||
/datum/modpack/cargo_items/initialize() | ||
. = ..() | ||
|
||
/datum/modpack/cargo_items/post_initialize() | ||
. = ..() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#include "_cargo_items.dm" | ||
|
||
#include "code/machinery.dm" | ||
#include "code/vendor_refill.dm" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/datum/supply_pack/machinery/rnd_beac | ||
name = "R&D Beacon" | ||
desc = "A set of specialized platforms for research and production, limited by license. " | ||
cost = 9000 | ||
contains = list(/obj/item/choice_beacon/rnd, | ||
/obj/item/circuitboard/machine/rdserver) | ||
crate_name = "r&d starter kit" | ||
crate_type = /obj/structure/closet/crate/science | ||
|
||
/datum/supply_pack/machinery/selling_pad_pack | ||
name = "Cargo teleport" | ||
desc = " A set of specialized platforms for building and managing a cargo teleport " | ||
cost = 8000 | ||
contains = list(/obj/item/circuitboard/machine/selling_pad, | ||
/obj/item/circuitboard/computer/selling_pad_control) | ||
crate_name = "cargo teleport" | ||
crate_type = /obj/structure/closet/crate/science | ||
|
||
/datum/supply_pack/machinery/rnd_full | ||
name = "Suspicious circuits" | ||
desc = "A set of specialized circuits for research and production. An unknown craftsman hacked them, now they are not limited by license. " | ||
cost = 39999 | ||
contains = list(/obj/item/circuitboard/machine/circuit_imprinter, | ||
/obj/item/circuitboard/machine/protolathe, | ||
/obj/item/circuitboard/machine/rdserver) | ||
crate_name = "hacked r&d kit" | ||
crate_type = /obj/structure/closet/crate/science |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/datum/supply_pack/vendor_refill/vend_circ | ||
name = "Vendor circuit board " | ||
desc = "Circuit board for building vendors." | ||
cost = 250 | ||
contains = list(/obj/item/circuitboard/machine/vendor, | ||
/obj/item/screwdriver) | ||
crate_name = "vend circuit crate" | ||
|
||
/datum/supply_pack/vendor_refill/shaft | ||
name = "Mining equipment vendor refill" | ||
desc = "Mining equipment vendor cartridge for replacing in Mining vendors." | ||
cost = 8000 | ||
contains = list(/obj/item/vending_refill/mining_equipment) | ||
crate_name = "miner supply crate" | ||
|
||
/datum/supply_pack/vendor_refill/sectech | ||
name = "SecTech vendor refill" | ||
desc = "SecTech vendor cartridge for replacing in SecTech vendors." | ||
cost = 1500 | ||
contains = list(/obj/item/vending_refill/security) | ||
crate_name = "SecTech supply crate" | ||
|
||
/datum/supply_pack/vendor_refill/secdrobe | ||
name = "SecDrobe vendor refill" | ||
desc = "SecTech vendor cartridge for replacing in SecTech vendors." | ||
cost = 1000 | ||
contains = list(/obj/item/vending_refill/wardrobe/sec_wardrobe) | ||
crate_name = "SecDrobe supply crate" |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.