From 83e331c500768ed9d1ac4030c4eb0a83afaee783 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Thu, 14 Dec 2023 19:32:29 +1100 Subject: [PATCH] BlockEdit: Also allow changing whether a block emits and/or stops light Also set an actual proper file version for the android APK --- android/app/src/main/AndroidManifest.xml | 4 ++-- src/Commands.c | 27 ++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 0f75fcf75..5285e9e88 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -2,8 +2,8 @@ + android:versionCode="1360" + android:versionName="1.3.6"> diff --git a/src/Commands.c b/src/Commands.c index ba93e9583..c5d24c722 100644 --- a/src/Commands.c +++ b/src/Commands.c @@ -550,11 +550,28 @@ static cc_bool BlockEditCommand_GetCoords(const cc_string* str, Vec3* coords) { return true; } +static cc_bool BlockEditCommand_GetBool(const cc_string* str, const char* name, cc_bool* value) { + if (String_CaselessEqualsConst(str, "true") || String_CaselessEqualsConst(str, "yes")) { + *value = true; + return true; + } + + if (String_CaselessEqualsConst(str, "false") || String_CaselessEqualsConst(str, "no")) { + *value = false; + return true; + } + + Chat_Add1("&eBlockEdit: &e%c must be either &ayes &eor &ano", name); + return false; +} + + static void BlockEditCommand_Execute(const cc_string* args, int argsCount__) { cc_string parts[3]; cc_string* prop; cc_string* value; int argsCount, block, v; + cc_bool b; Vec3 coords; if (String_CaselessEqualsConst(args, "properties")) { @@ -573,6 +590,8 @@ static void BlockEditCommand_Execute(const cc_string* args, int argsCount__) { Chat_AddRaw("&eEditable block properties (page 2):"); Chat_AddRaw("&a walksound &e- Sets walk/step sound of the block"); Chat_AddRaw("&a breaksound &e- Sets break sound of the block"); + Chat_AddRaw("&a emitslight &e- Sets whether the block emits light"); + Chat_AddRaw("&a blockslight &e- Sets whether the block stops light"); return; } @@ -651,6 +670,14 @@ static void BlockEditCommand_Execute(const cc_string* args, int argsCount__) { if (!BlockEditCommand_GetInt(value, "Sound", &v, 0, SOUND_COUNT - 1)) return; Blocks.DigSounds[block] = v; + } else if (String_CaselessEqualsConst(prop, "emitslight")) { + if (!BlockEditCommand_GetBool(value, "Emits light", &b)) return; + + Blocks.FullBright[block] = b; + } else if (String_CaselessEqualsConst(prop, "blockslight")) { + if (!BlockEditCommand_GetBool(value, "Blocks light", &b)) return; + + Blocks.BlocksLight[block] = b; } else { Chat_Add1("&eBlockEdit: &eUnknown property %s &e(See &a/client help blockedit&e)", prop); return;