Skip to content

Commit de3b115

Browse files
committed
add binds for editor
1 parent 9d59dcb commit de3b115

File tree

6 files changed

+60
-14
lines changed

6 files changed

+60
-14
lines changed

Modules/BindingsModule/BindingsCommon.as

+22-5
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ string[] page_texts =
1818
Names::buildernmb,
1919
Names::quartersnmb,
2020
Names::vehiclenmb,
21-
Names::boatnmb
21+
Names::boatnmb,
22+
Names::edmenu
2223
};
2324

2425
string[][] button_texts =
@@ -130,6 +131,14 @@ string[][] button_texts =
130131
Names::dinghynmb,
131132
Names::longboatnmb,
132133
Names::warboatnmb
134+
},
135+
{
136+
Names::edmodifier,
137+
Names::edonceaction,
138+
Names::edmode,
139+
Names::eddestroy,
140+
Names::edplace,
141+
Names::edcopy
133142
}
134143
};
135144

@@ -244,6 +253,14 @@ string[][] button_file_names =
244253
"boat_dinghy",
245254
"boat_longboat",
246255
"boat_warboat"
256+
},
257+
{
258+
"ed_modifier",
259+
"ed_once_action",
260+
"ed_mode",
261+
"ed_destroying",
262+
"ed_placing",
263+
"ed_copy"
247264
}
248265
};
249266

@@ -1889,7 +1906,7 @@ class ClickableButtonGUI
18891906
GUI::SetFont("menu");
18901907

18911908
Vec2f start_offset = Vec2f(50, 600);
1892-
Vec2f start_offset_p = Vec2f(70, 550);
1909+
Vec2f start_offset_p = Vec2f(40, 550);
18931910

18941911
closebutton.Render(m_clickable_origin + Vec2f(1000 - 40, 0), Vec2f(40, 40));
18951912

@@ -1912,7 +1929,7 @@ class ClickableButtonGUI
19121929

19131930
if (i == 5)
19141931
{
1915-
start_offset_p = Vec2f(70, 600);
1932+
start_offset_p = Vec2f(40, 600);
19161933
}
19171934
}
19181935

@@ -1960,7 +1977,7 @@ class ClickableButtonGUI
19601977
u8 scale = screen_height / 720.0;
19611978

19621979
Vec2f start_offset = Vec2f(50, 600);
1963-
Vec2f start_offset_p = Vec2f(70, 550);
1980+
Vec2f start_offset_p = Vec2f(40, 550);
19641981

19651982
closebutton.Update(m_clickable_origin + Vec2f(1000 - 40, 0), Vec2f(40, 40));
19661983

@@ -1983,7 +2000,7 @@ class ClickableButtonGUI
19832000

19842001
if (i == 5)
19852002
{
1986-
start_offset_p = Vec2f(70, 600);
2003+
start_offset_p = Vec2f(40, 600);
19872004
}
19882005
}
19892006

Modules/BindingsModule/BindingsSystem.as

+1-1
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ void onTick(CRules@ this)
519519

520520
Vec2f MENU_SIZE = Vec2f(1000, 700);
521521
Vec2f ENTRY_SIZE = Vec2f(900, 30);
522-
Vec2f PAGE_BUTTON_SIZE = Vec2f(130, 40);
522+
Vec2f PAGE_BUTTON_SIZE = Vec2f(120, 40);
523523

524524
void InitMenu()
525525
{

Translations/TranslationsSystem.as

+9
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,15 @@ namespace Names
248248
longboatnmb = Translate(en::n_longboatnmb+"\\"+ru::n_longboatnmb),
249249
warboatnmb = Translate(en::n_warboatnmb+"\\"+ru::n_warboatnmb),
250250

251+
// Editor
252+
edmenu = Translate(en::n_edmenu+"\\"+ru::n_edmenu),
253+
edmodifier = Translate(en::n_edmodifier+"\\"+ru::n_edmodifier),
254+
edonceaction = Translate(en::n_edonceaction+"\\"+ru::n_edonceaction),
255+
edmode = Translate(en::n_edmode+"\\"+ru::n_edmode),
256+
eddestroy = Translate(en::n_eddestroy+"\\"+ru::n_eddestroy),
257+
edplace = Translate(en::n_edplace+"\\"+ru::n_edplace),
258+
edcopy = Translate(en::n_edcopy+"\\"+ru::n_edcopy),
259+
251260
// Settings
252261
buildmode = Translate(en::n_buildmode+"\\"+ru::n_buildmode),
253262
blockbar = Translate(en::n_blockbar+"\\"+ru::n_blockbar),

Translations/language_en.as

+9
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,15 @@ namespace en
240240
n_longboatnmb = "Long Boat",
241241
n_warboatnmb = "War Boat",
242242

243+
// Editor
244+
n_edmenu = "Editor",
245+
n_edmodifier = "Modifier",
246+
n_edonceaction = "Modifier (once action)",
247+
n_edmode = "Change editor mode",
248+
n_eddestroy = "Destroying blocks/blobs",
249+
n_edplace = "Placing blocks/blobs",
250+
n_edcopy = "Copy block/blob",
251+
243252
// Settings
244253
n_buildmode = "Build Mode",
245254
n_blockbar = "Show block bar HUD",

Translations/language_ru.as

+9
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,15 @@ namespace ru
240240
n_longboatnmb = "Большая лодка",
241241
n_warboatnmb = "Военная лодка",
242242

243+
// Editor
244+
n_edmenu = "Редактор",
245+
n_edmodifier = "Модификатор",
246+
n_edonceaction = "Модификатор (одно действие)",
247+
n_edmode = "Режим редактора",
248+
n_eddestroy = "Разрушение блоков/блобов",
249+
n_edplace = "Установка блоков/спаун блобов",
250+
n_edcopy = "Копировать блок/блоб",
251+
243252
// Settings
244253
n_buildmode = "Режим строительства",
245254
n_blockbar = "Показывать панель с блоками",

Utility/CoolEditor.as

+10-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include "SocialStatus.as";
2+
#include "BindingsCommon.as";
23

34
const string editor_place = "editor place";
45
const string editor_destroy = "editor destroy";
@@ -37,23 +38,24 @@ void onTick(CRules@ this)
3738
if (controls.isKeyJustPressed(KEY_RCONTROL)) {
3839
p.set_bool("editor_cursor", !p.get_bool("editor_cursor"));
3940
}
41+
4042
//changing mode BLOBS/TILES
41-
if (controls.isKeyPressed(KEY_LMENU) && controls.isKeyJustPressed(KEY_KEY_1)) {
43+
if (b_KeyJustPressed("ed_mode")) {
4244
CBitStream params;
4345
params.write_u16(p.getNetworkID());
4446
this.SendCommand(this.getCommandID(change_mode), params);
4547
}
4648

47-
if (!controls.isKeyPressed(KEY_MBUTTON)) return;
49+
if (!b_KeyPressed("ed_modifier")) return;
4850
//placing/destroing by single item
49-
if (controls.isKeyPressed(KEY_LSHIFT)) {
50-
if (controls.isKeyJustPressed(KEY_KEY_X)) {
51+
if (b_KeyPressed("ed_once_action")) {
52+
if (b_KeyJustPressed("ed_placing")) {
5153
CBitStream params;
5254
params.write_u16(p.getNetworkID());
5355
params.write_Vec2f(controls.getMouseWorldPos());
5456
this.SendCommand(this.getCommandID(editor_place), params);
5557
}
56-
if (controls.isKeyJustPressed(KEY_KEY_Z)) {
58+
if (b_KeyJustPressed("ed_destroying")) {
5759
CBitStream params;
5860
params.write_u16(p.getNetworkID());
5961
params.write_Vec2f(controls.getMouseWorldPos());
@@ -62,20 +64,20 @@ void onTick(CRules@ this)
6264
}
6365
//placing/destroying continuously
6466
else {
65-
if (controls.isKeyPressed(KEY_KEY_X)) {
67+
if (b_KeyPressed("ed_placing")) {
6668
CBitStream params;
6769
params.write_u16(p.getNetworkID());
6870
params.write_Vec2f(controls.getMouseWorldPos());
6971
this.SendCommand(this.getCommandID(editor_place), params);
7072
}
71-
if (controls.isKeyPressed(KEY_KEY_Z)) {
73+
if (b_KeyPressed("ed_destroying")) {
7274
CBitStream params;
7375
params.write_u16(p.getNetworkID());
7476
params.write_Vec2f(controls.getMouseWorldPos());
7577
this.SendCommand(this.getCommandID(editor_destroy), params);
7678
}
7779
}
78-
if (controls.isKeyJustPressed(KEY_KEY_B)) {
80+
if (b_KeyJustPressed("ed_copy")) {
7981
CBitStream params;
8082
params.write_u16(p.getNetworkID());
8183
params.write_Vec2f(controls.getMouseWorldPos());

0 commit comments

Comments
 (0)