Skip to content

Commit

Permalink
Merge pull request Huz2e#181 from Artemchik542/modular-stage-2
Browse files Browse the repository at this point in the history
Modular stage 2 + new modpacks TGUI
  • Loading branch information
Huz2e authored Nov 27, 2024
2 parents 94e0276 + e44b31e commit 59716c4
Show file tree
Hide file tree
Showing 48 changed files with 682 additions and 176 deletions.
4 changes: 3 additions & 1 deletion code/__DEFINES/___meta_modpaks_includes.dm
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
#include "..\..\modular_meta\__config_modpaks.dm"
// THIS IS A MASSMETA FILE

#include "..\..\modular_meta\__config_modpacks.dm"
2 changes: 2 additions & 0 deletions code/__DEFINES/~meta_defines_include.dm
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
// THIS IS A MASSMETA FILE

#include "..\..\modular_meta\_defines\_main_modular_defines_include.dm"
2 changes: 2 additions & 0 deletions code/__HELPERS/~meta_helpers_include.dm
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
// THIS IS A MASSMETA FILE

#include "..\..\modular_meta\_helpers\_main_modular_helpers_include.dm"
2 changes: 2 additions & 0 deletions code/_globalvars/~meta_globalvars_include.dm
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
// THIS IS A MASSMETA FILE

#include "..\..\modular_meta\_globalvars\_main_modular_globalvars_include.dm"
2 changes: 1 addition & 1 deletion interface/fonts/grand_9k.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/// Base font
/datum/font/grand9k
name = "Grand9K Pixel"
//MASSMETA EDIT CHANGE BEGIN (tweak_say_font)
//MASSMETA EDIT CHANGE BEGIN (ru_tweak_say_font)
/* ORIGINAL
font_family = 'interface/fonts/Grand9K_Pixel.ttf'
*/
Expand Down
2 changes: 1 addition & 1 deletion interface/fonts/pixellari.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/// Base font
/datum/font/pixellari
name = "Pixellari"
//MASSMETA EDIT CHANGE BEGIN (tweak_say_font)
//MASSMETA EDIT CHANGE BEGIN (ru_tweak_say_font)
/* ORIGINAL
font_family = 'interface/fonts/Pixellari.ttf'
*/
Expand Down
4 changes: 2 additions & 2 deletions interface/skin.dmf
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ window "mapwindow"
size = 640x480
anchor1 = 0,0
anchor2 = 100,100
//MASSMETA EDIT CHANGE BEGIN (tweak_say_font)
//MASSMETA EDIT CHANGE BEGIN (ru_tweak_say_font)
/* ORIGINAL
font-family = "Arial"
font-size = 7pt
Expand All @@ -163,7 +163,7 @@ window "mapwindow"
is-default = true
right-click = true
saved-params = "zoom;letterbox;zoom-mode"
/MASSMETA EDIT CHANGE BEGIN (tweak_say_font)
/MASSMETA EDIT CHANGE BEGIN (ru_tweak_say_font)
/* ORIGINAL
style = ".center { text-align: center; } .maptext { font-family: 'Small Fonts'; font-size: 7pt; -dm-text-outline: 1px black; color: white; line-height: 1.0; } .command_headset { font-weight: bold; } .context { font-family: 'Pixellari'; font-size: 12pt; -dm-text-outline: 1px black; } .subcontext { font-family: 'Small Fonts'; font-size: 12pt; line-height: 0.75; } .small { font-family: 'Small Fonts'; font-size: 6pt; line-height: 1.4; } .big { font-family: 'Small Fonts'; font-size: 12pt; } .reallybig { font-size: 12pt; } .extremelybig { font-size: 12pt; } .greentext { color: #00FF00; font-size: 6pt; } .redtext { color: #FF0000; font-size: 6pt; } .clown { color: #FF69BF; font-weight: bold; } .his_grace { color: #15D512; } .hypnophrase { color: #0d0d0d; font-weight: bold; } .yell { font-weight: bold; } .italics { font-family: 'Small Fonts'; font-size: 6pt; line-height: 1.4; }" //MASSMETA EDIT CHANGE (cyrillic)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
// Looks like mods in minecraft, isn't it?
// Some mods may have dependencies, have fun buddy!

// If you are ENG server - you need at first turn off all PEREVODY (= translations on russian lang)
// If you are ENG server - you need at first turn off all translations on russian lang


/// FEATURES
#define ADDITIONAL_CIRCUITS 1
#define CHEBUREK_CAR 1

/// PEREVODY
#define RU_CRAYONS 1
#define RU_VENDORS 1

/// REVERTS
21 changes: 21 additions & 0 deletions modular_meta/__modpack/assets_modpacks.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#define MODPACKS_SET 'modular_meta/__modpack/mods_icon_placeholder.dmi'

/datum/asset/spritesheet/simple/modpacks
name = "modpacks"

/datum/asset/spritesheet/simple/modpacks/create_spritesheets()
InsertAll("modpack", MODPACKS_SET)
// catch all modpack's previews which are pulling icons from preview.dmi files
var/icon_placeholder = "default"
for(var/datum/modpack/this_modpack as anything in subtypesof(/datum/modpack))
if(!this_modpack.visible)
continue

var/icon = initial(this_modpack.icon)
var/icon_state = initial(this_modpack.id)
if(icon == MODPACKS_SET)
Insert("modpack-[icon_state]", icon, icon_state=icon_placeholder)
else
Insert("modpack-[icon_state]", icon, icon_state=icon_state)

#undef MODPACKS_SET
87 changes: 87 additions & 0 deletions modular_meta/__modpack/modpack.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/datum/modpack
/// A string unique ID for the modpack. Used for self-cheсks, must be same as modpack name in code. /datum/modpack/ru_crayons -> "id = ru_crayons"
var/id
/// An icon for modpack preview,
var/icon = 'modular_meta/__modpack/mods_icon_placeholder.dmi'
/// 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
/// A string with group of this modpack. Choose between "Features", "Translations" and "Reverts"
var/group
/// A list of your modpack's dependencies. If you use obj from another modpack - put it here.
var/list/mod_depends = list()

/// Is modpack visible, (for hidden modpacks, like "example" one)
var/visible = TRUE // by default set to TRUE


// Modpacks initialization steps
/datum/modpack/proc/pre_initialize() // Basic modpack fuctions
if(!id)
return "Modpack ID is unset."
if(!name)
return "Modpack name is unset."

/datum/modpack/proc/initialize() // Mods dependencies-checks
if(!mod_depends)
return
var/passed = 0
for(var/depend_id in mod_depends)
passed = 0
if(depend_id == id)
return "Mod depends on itself, ok and?"
for(var/datum/modpack/package as anything in SSmodpacks.loaded_modpacks)
if(package.id == depend_id)
if(passed >= 1)
return "Multiple include of one module in [id] mod dependencies."
passed++
if(passed == 0)
return "Module [id] depends on [depend_id], please include it in your game."

// Modpacks TGUI
/datum/modpack/ui_assets(mob/user)
return list(
get_asset_datum(/datum/asset/spritesheet/simple/modpacks),
)

/datum/modpack/ui_state()
return GLOB.always_state

/datum/modpack/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if (!ui)
ui = new(user, src, "Modpacks")
ui.open()

/datum/modpack/ui_static_data(mob/user)
. = ..()
.["categories"] = list("Features", "Translations", "Reverts")
.["features"] = list()
.["translations"] = list()
.["reverts"] = list()

var/datum/asset/spritesheet/simple/assets = get_asset_datum(/datum/asset/spritesheet/simple/modpacks)
for(var/datum/modpack/modpack as anything in SSmodpacks.loaded_modpacks)
if (!modpack.visible) // if modpack hidden then do not add it to list
continue

var/list/modpack_data = list(
"name" = modpack.name,
"desc" = modpack.desc,
"author" = modpack.author,
"icon_class" = assets.icon_class_name("modpack-[modpack.id]"),
"id" = modpack.id,
)

if (modpack.group == "Фичи" || modpack.group == "Features")
.["features"] += list(modpack_data)
else if (modpack.group == "Переводы" || modpack.group == "Translations")
.["translations"] += list(modpack_data)
else if (modpack.group == "Балансы" || modpack.group == "Reverts")
.["reverts"] += list(modpack_data)
else
CRASH("Modpack [modpack.name] has bad group name or queued for deletion.")
// TODO: add here events group, only visible for admins
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ SUBSYSTEM_DEF(modpacks)
//Show modpacks button on lobby screen
//ORIGINAL FILE: code/_onclick/hud/new_player.dm
/atom/movable/screen/lobby/button/bottom/poll
icon = 'modular_meta/mods_button.dmi'
icon = 'modular_meta/__modpack/mods_button.dmi'
name = "View Loaded Modpacks"
icon_state = "mods"
base_icon_state = "mods"
Expand Down
File renamed without changes.
Binary file added modular_meta/__modpack/mods_icon_placeholder.dmi
Binary file not shown.
2 changes: 1 addition & 1 deletion modular_meta/_globalvars/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

Все они добавляются непосредственно в `main_modular_globalvars_include.dm`

Сами хелперы инициализируются сразу после хелперов офф ТГ в code/\_\_DEFINES/~meta_helpers_include.dm (такая же переадресация аналогичная как и у дефайнов)
Сами глобальные переменные инициализируются сразу после хелперов офф ТГ в code/\_globalvars/~meta_globalvars_include.dm (такая же переадресация аналогичная как и у дефайнов)
4 changes: 2 additions & 2 deletions modular_meta/_helpers/readme.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Тут лежат все наши Новые Helpers (помощники?), что мы определили в нашем модуле.
## Тут лежат все наши Новые Helpers (помощники), что мы определили в нашем модуле.

Все они добавляются непосредственно в `main_modular_helpers_include.dm`

Сами хелперы инициализируются сразу после хелперов офф ТГ в code/\_\_DEFINES/~meta_helpers_include.dm (такая же переадресация аналогичная как и у дефайнов)
Сами хелперы инициализируются сразу после хелперов офф ТГ в code/\_\_HELPERS/~meta_helpers_include.dm (такая же переадресация аналогичная как и у дефайнов)
57 changes: 0 additions & 57 deletions modular_meta/_modpack.dm

This file was deleted.

3 changes: 3 additions & 0 deletions modular_meta/features/additional_circuit/includes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
#include "code\target_scanner.dm"

/datum/modpack/additional_circuit
id = "additional_circuit"
icon = 'modular_meta/features/additional_circuit/preview.dmi'
name = "Доп. микросхемы"
group = "Features"
desc = "Добавляет микросхемы для Циркуитов."
author = "Jake Park. Портирование: homexp13"
Binary file not shown.
4 changes: 2 additions & 2 deletions modular_meta/features/cheburek_car/code/cheburek.dm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
Really big car with 4х4 sprite.
Can run people over.
Expand Down Expand Up @@ -339,7 +339,7 @@ Some memes and gags included.
playsound(src, pick('modular_meta/features/cheburek_car/sound/gear_blyat.ogg', 'modular_meta/features/cheburek_car/sound/gear_nah.ogg'), 100)
toggle_blinkers()
canmove = FALSE
balloon_alert(user, "Gearbox broken")
balloon_alert(user, "gearbox broken")
else
gearbox_failure_count++
AddElement(/datum/element/waddling) // your gears are juggling like a clown do
Expand Down
Binary file modified modular_meta/features/cheburek_car/icons/shaha.dmi
Binary file not shown.
3 changes: 3 additions & 0 deletions modular_meta/features/cheburek_car/includes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
#include "code\vehicle_actions.dm"

/datum/modpack/cheburek_car
id = "cheburek_car"
icon = 'modular_meta/features/cheburek_car/preview.dmi'
name = "Жигуль 2106, корч, машинка"
group = "Features"
desc = "Межгалактическое ведро с болтами не догнившее еще с тех лет, Вау!"
author = "Artemchik542"
Binary file added modular_meta/features/cheburek_car/preview.dmi
Binary file not shown.
27 changes: 15 additions & 12 deletions modular_meta/main_modular_include.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,27 @@
// Some modules can be easy excludes from code compile sequence by commenting #define you need to remove in code\__DEFINES\__meta_modpaks_includes.dm
// Keep in mind, that module may not be only in modular folder but also embedded directly in TG code and covered with #ifdef - #endif structure

#include "_modpack.dm" //modpack obj
#include "_modpacks_subsystem.dm" //actually mods subsystem + tgui in "tgui/packages/tgui/interfaces/Modpacks.tsx"
#include "__modpack\assets_modpacks.dm"
#include "__modpack\modpack.dm" //modpack obj
#include "__modpack\modpacks_subsystem.dm" //actually mods subsystem + tgui in "tgui/packages/tgui/interfaces/Modpacks.tsx"

/// FEATURES
/* --FEATURES-- */

#if ADDITIONAL_CIRCUITS
#include "features\additional_circuit\includes.dm"
#endif
#include "features\additional_circuit\includes.dm"
#if CHEBUREK_CAR
#include "features\cheburek_car\includes.dm"
#endif

/// PEREVODY
#if RU_CRAYONS
#include "perevody\ru_crayons\includes.dm"
/* -- REVERTS -- */

#include "reverts\revert_glasses_protect_welding\includes.dm"

/* --TRANSLATIONS-- */

#if RU_CRAYONS
#include "ru_translate\ru_crayons\includes.dm"
#endif
#include "ru_translate\ru_tweak_say_fonts\includes.dm"
#if RU_VENDORS
#include "perevody\ru_vendors\includes.dm"
#include "ru_translate\ru_vendors\includes.dm"
#endif

/// REVERTS
Loading

0 comments on commit 59716c4

Please sign in to comment.