Skip to content

Commit

Permalink
finish redstone singal source,add func and self config
Browse files Browse the repository at this point in the history
  • Loading branch information
hhhxiao committed Jan 22, 2021
1 parent 598980a commit 6c98f45
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 34 deletions.
17 changes: 3 additions & 14 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 3 additions & 10 deletions api/block/CircuitComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace trapdoor {
//打印信号源等信息
void BaseCircuitComponent::basePrint(CircuitSceneGraph *graph, trapdoor::Actor *player) {
MessageBuilder builder;
builder.text("1Signal: ").num(this->getStrength());
builder.text("Signal: ").num(this->getStrength());
auto begin = (uint32_t *) *((uint64_t *) this + 1);
auto end = (uint32_t *) *((uint64_t *) this + 2);
int num = 0;
Expand All @@ -40,7 +40,7 @@ namespace trapdoor {
if (comp) {
builder.text("\n - ").pos(pos).text(" <==> ").num(comp->getStrength());
vec3.x = (float) pos.x + 0.5f;
vec3.y = (float) pos.y + 1.7f;
vec3.y = (float) pos.y + 0.7f;
vec3.z = (float) pos.z + 0.5f;
spawnParticle(vec3, particleType, player->getDimensionID());
}
Expand Down Expand Up @@ -108,20 +108,13 @@ namespace trapdoor {

using namespace SymHook;
//初始化电路图
bool temp = false;

//这个函数没用了
THook(
trapdoor::BaseCircuitComponent
*,
MSSYM_B1QE16getBaseComponentB1AE17CircuitSceneGraphB2AAE28QEAAPEAVBaseCircuitComponentB2AAE12AEBVBlockPosB3AAAA1Z,
trapdoor::CircuitSceneGraph *graph,
trapdoor::BlockPos * pos
) {

if (!temp) {
L_DEBUG("%p", graph);
temp = true;
}

return original(graph, pos);
}
10 changes: 5 additions & 5 deletions mod/TrapdoorMod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,28 +245,28 @@ namespace mod {

commandManager.registerCmd("self", "玩家个人功能")
->then(ARG("chunk", "区块显示", BOOL, {
if (!configManager.getSelfEnbaleConfig().enableChunkShow) {
if (!configManager.getSelfEnableConfig().enableChunkShow) {
error(player, "该功能已被关闭,请联系服主");
return;
}
this->playerFunctions.setShowChunkAble(player->getNameTag(), holder->getBool());
info(player, "设置你的区块显示为 %d", holder->getBool());
}))
->then(ARG("me", "测量", BOOL, {
if (!configManager.getSelfEnbaleConfig().enableDistanceMeasure) {
->then(ARG("me", "信号源显示", BOOL, {
if (!configManager.getSelfEnableConfig().enableDistanceMeasure) {
error(player, "该功能已被关闭,请联系服主");
return;
}
this->playerFunctions.getMeasureData(player->getNameTag()).enableMeasure = holder->getBool();
info(player, "设置你的测量开启/关闭 %d", holder->getBool());
}))
->then(ARG("rs", "测量", BOOL, {
if (!configManager.getSelfEnbaleConfig().enableRedstoneStick) {
if (!configManager.getSelfEnableConfig().enableRedstoneStick) {
error(player, "该功能已被关闭,请联系服主");
return;
}
this->playerFunctions.setRedstoneHelperAble(player->getNameTag(), holder->getBool());
info(player, "设置你的信号源提 示开启/关闭 %d", holder->getBool());
info(player, "设置你的信号源提示开启/关闭 %d", holder->getBool());
}))

->EXE({ PlayerFunction::printInfo(player); });
Expand Down
2 changes: 1 addition & 1 deletion mod/TrapdoorMod.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace mod {

struct ModInfo {
const std::string minecraftVersion = "1.16.4.02";
const std::string modVersion = "trapdoor-0.9.16";
const std::string modVersion = "trapdoor-0.9.20";
};

class TrapdoorMod : public trapdoor::BDSMod {
Expand Down
2 changes: 1 addition & 1 deletion mod/config/ConfigManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ namespace mod {

inline const ServerConfig &getServerConfig() const { return this->serverConfig; }

inline const SelfEnableConfig &getSelfEnbaleConfig() const { return this->selfEnableConfig; }
inline const SelfEnableConfig &getSelfEnableConfig() const { return this->selfEnableConfig; }
};
}

Expand Down
2 changes: 1 addition & 1 deletion mod/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ trapdoor::BDSMod *createBDSModInstance() {
void mod_init() {
initConsole();
trapdoor::initLogger("trapdoor.log"); //初始化日志
trapdoor::setDevMode(true);
// trapdoor::setDevMode(true);
mod::TrapdoorMod::printCopyRightInfo(); //打印日志
auto *mod = createBDSModInstance();
mod->asInstance<mod::TrapdoorMod>()->readConfigFile("trapdoor-config.json"); //读取配置文件
Expand Down
2 changes: 1 addition & 1 deletion mod/player/PlayerFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ namespace mod {
}

void PlayerFunction::printRedstoneInfo(trapdoor::Actor *player, BlockPos &pos) {
if (!this->enableShowChunk[player->getNameTag()])return;
if (!this->enableRedstoneHelper[player->getNameTag()])return;
auto graph = player->getDimension()->getGraph();
auto component = graph->getBaseCircuitComponent(&pos);
if (!component) {
Expand Down
5 changes: 4 additions & 1 deletion mod/player/PlayerFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ namespace mod {

public:
inline void setShowChunkAble(const std::string &playerName, bool able) { enableShowChunk[playerName] = able; }
inline void setRedstoneHelperAble(const std::string &playerName, bool able) { enableRedstoneHelper[playerName] = able; }

inline void
setRedstoneHelperAble(const std::string &playerName, bool able) { enableRedstoneHelper[playerName] = able; }

MeasureData &getMeasureData(const std::string &playerName) { return playerMeasureData[playerName]; }

void tick();
Expand Down

0 comments on commit 6c98f45

Please sign in to comment.