Merge branch 'remote_control' of https://github.com/JapaMala/dfhack into remote_control

develop
Japa Mala Illo 2017-12-27 11:20:01 +05:30
commit 1b891bc3dc
4 changed files with 74 additions and 2 deletions

@ -73,6 +73,13 @@ enum CarefulMovementType
ITEM_INTERACT_PUSH = 12;
}
enum MiscMoveType
{
SET_CLIMB = 0;
SET_STAND = 1;
SET_CANCEL = 2;
}
message MoveCommandParams
{
optional RemoteFortressReader.Coord direction = 1;
@ -90,4 +97,9 @@ message MenuContents
{
optional AdvmodeMenu current_menu = 1;
repeated MovementOption movements = 2;
}
message MiscMoveParams
{
optional MiscMoveType type = 1;
}

@ -240,6 +240,33 @@ command_result MenuQuery(DFHack::color_ostream &stream, const EmptyMessage *in,
out->set_current_menu((AdvmodeMenu)advUi->menu);
// /$$$$$$$$ /$$$$$$ /$$ /$$ /$$ /$$ /$$$$$$$$
//| $$_____/|_ $$_/| $$ / $$| $$$ /$$$| $$_____/
//| $$ | $$ | $$/ $$/| $$$$ /$$$$| $$
//| $$$$$ | $$ \ $$$$/ | $$ $$/$$ $$| $$$$$
//| $$__/ | $$ >$$ $$ | $$ $$$| $$| $$__/
//| $$ | $$ /$$/\ $$| $$\ $ | $$| $$
//| $$ /$$$$$$| $$ \ $$| $$ \/ | $$| $$$$$$$$
//|__/ |______/|__/ |__/|__/ |__/|________/
//
//
//
// /$$$$$$$$ /$$ /$$ /$$ /$$ /$$ /$$ /$$ /$$
//|__ $$__/| $$ |__/ |__/ | $$ |__/ | $$ | $$ | $$
// | $$ | $$$$$$$ /$$ /$$$$$$$ /$$ /$$$$$$$ /$$$$$$ /$$$$$$$ /$$$$$$ /$$ /$$ /$$$$$$ /$$ /$$$$$$$ | $$$$$$$ /$$$$$$ /$$$$$$$| $$ /$$
// | $$ | $$__ $$| $$ /$$_____/ | $$ /$$_____/ |____ $$ /$$_____/|_ $$_/ | $$ | $$ /$$__ $$| $$ /$$__ $$ | $$__ $$ |____ $$ /$$_____/| $$ /$$/
// | $$ | $$ \ $$| $$| $$$$$$ | $$| $$$$$$ /$$$$$$$ | $$$$$$ | $$ | $$ | $$| $$ \ $$| $$| $$ | $$ | $$ \ $$ /$$$$$$$| $$ | $$$$$$/
// | $$ | $$ | $$| $$ \____ $$ | $$ \____ $$ /$$__ $$ \____ $$ | $$ /$$| $$ | $$| $$ | $$| $$| $$ | $$ | $$ | $$ /$$__ $$| $$ | $$_ $$
// | $$ | $$ | $$| $$ /$$$$$$$/ | $$ /$$$$$$$/ | $$$$$$$ /$$$$$$$/ | $$$$/| $$$$$$/| $$$$$$$/| $$| $$$$$$$ | $$ | $$| $$$$$$$| $$$$$$$| $$ \ $$
// |__/ |__/ |__/|__/|_______/ |__/|_______/ \_______/ |_______/ \___/ \______/ | $$____/ |__/ \_______/ |__/ |__/ \_______/ \_______/|__/ \__/
// | $$
// | $$
// |__/
if (advUi->menu == ui_advmode_menu::FallAction)
{
getCurViewscreen()->feed_key(interface_key::OPTION1);
}
switch (advUi->menu)
{
case ui_advmode_menu::MoveCarefully:
@ -252,10 +279,16 @@ command_result MenuQuery(DFHack::color_ostream &stream, const EmptyMessage *in,
STRICT_VIRTUAL_CAST_VAR(climbMovement, df::adventure_movement_climbst, movement);
if (climbMovement)
{
SetCoord(climbMovement->grab, send_movement->mutable_grab());
send_movement->set_movement_type(CarefulMovementType::CLIMB);
}
STRICT_VIRTUAL_CAST_VAR(holdTileMovement, df::adventure_movement_hold_tilest, movement);
if (holdTileMovement)
{
SetCoord(holdTileMovement->grab, send_movement->mutable_grab());
send_movement->set_movement_type(CarefulMovementType::HOLD_TILE);
}
}
default:
break;
@ -278,3 +311,28 @@ command_result MovementSelectCommand(DFHack::color_ostream &stream, const dfprot
keyQueue.push((interface_key::interface_key)(interface_key::OPTION1 + select));
return CR_OK;
}
command_result MiscMoveCommand(DFHack::color_ostream &stream, const MiscMoveParams *in)
{
if (!df::global::ui_advmode->menu == ui_advmode_menu::Default)
return CR_OK;
auto type = in->type();
switch (type)
{
case AdventureControl::SET_CLIMB:
getCurViewscreen()->feed_key(interface_key::A_HOLD);
break;
case AdventureControl::SET_STAND:
getCurViewscreen()->feed_key(interface_key::A_STANCE);
break;
case AdventureControl::SET_CANCEL:
getCurViewscreen()->feed_key(interface_key::LEAVESCREEN);
break;
default:
break;
}
return CR_OK;
}

@ -8,6 +8,7 @@ DFHack::command_result MoveCommand(DFHack::color_ostream &stream, const Adventur
DFHack::command_result JumpCommand(DFHack::color_ostream &stream, const AdventureControl::MoveCommandParams *in);
DFHack::command_result MenuQuery(DFHack::color_ostream &stream, const dfproto::EmptyMessage *in, AdventureControl::MenuContents *out);
DFHack::command_result MovementSelectCommand(DFHack::color_ostream &stream, const dfproto::IntMessage *in);
DFHack::command_result MiscMoveCommand(DFHack::color_ostream &stream, const AdventureControl::MiscMoveParams *in);
void KeyUpdate();

@ -294,8 +294,9 @@ DFhackCExport RPCService *plugin_rpcconnect(color_ostream &)
svc->addFunction("MoveCommand", MoveCommand, SF_ALLOW_REMOTE);
svc->addFunction("JumpCommand", JumpCommand, SF_ALLOW_REMOTE);
svc->addFunction("MenuQuery", MenuQuery, SF_ALLOW_REMOTE);
svc->addFunction("MovementSelectCommand", MovementSelectCommand, SF_ALLOW_REMOTE);
return svc;
svc->addFunction("MovementSelectCommand", MovementSelectCommand, SF_ALLOW_REMOTE);
svc->addFunction("MiscMoveCommand", MiscMoveCommand, SF_ALLOW_REMOTE);
return svc;
}
// This is called right before the plugin library is removed from memory.