/*! \brief Create the context menu for the modules tree. */ void ApplicationViewWidget::createModulesViewContextMenu() { modRunAction = new QAction("Run",this); modStopAction = new QAction("Stop",this); modkillAction = new QAction("Kill",this); modSeparator = new QAction(this); modSeparator->setSeparator(true); modRefreshAction = new QAction("Refresh Status",this); modSelectAllAction = new QAction("Select All Modules",this); modAttachAction = new QAction("Attach to stdout",this); modAssignAction = new QAction("Assign Hosts",this); modRunAction->setIcon(QIcon(":/images/run_ico.png")); modStopAction->setIcon(QIcon(":/images/stop_ico.png")); modkillAction->setIcon(QIcon(":/images/kill_ico.png")); modRefreshAction->setIcon(QIcon(":/images/progress_ico.png")); modSelectAllAction->setIcon(QIcon(":/images/selectall_ico.png")); modAssignAction->setIcon(QIcon(":/images/yesres_ico.png")); ui->moduleList->addAction(modRunAction); ui->moduleList->addAction(modStopAction); ui->moduleList->addAction(modkillAction); ui->moduleList->addAction(modSeparator); ui->moduleList->addAction(modRefreshAction); ui->moduleList->addAction(modSelectAllAction); ui->moduleList->addAction(modAttachAction); ui->moduleList->addAction(modAssignAction); connect(modRunAction,SIGNAL(triggered()),this,SLOT(onRun())); connect(modStopAction,SIGNAL(triggered()),this,SLOT(onStop())); connect(modkillAction,SIGNAL(triggered()),this,SLOT(onKill())); connect(modRefreshAction,SIGNAL(triggered()),this,SLOT(onRefresh())); connect(modSelectAllAction,SIGNAL(triggered()),this,SLOT(selectAllModule())); }
void Turret::onImpact(DamageType::Type damage_type, float damage, const float3 &force, EntityRef source) { float resistance = 0.7f; damage *= 1.0f - resistance; if(isDying()) { m_hit_points -= int(damage); return; } m_hit_points -= int(damage); if(m_hit_points <= 0.0f) { DeathId::Type death_id = deathType(damage_type, damage, force); setOrder(new DieOrder(death_id), true); onKill(ref(), source); } else { //TODO: sound } ThinkingEntity::onImpact(damage_type, damage, force, source); }
/*! \brief Create the context menu for the modules tree. */ void ApplicationViewWidget::createModulesViewContextMenu() { modRunAction = new QAction("Run",this); modStopAction = new QAction("Stop",this); modkillAction = new QAction("Kill",this); modSeparator = new QAction(this); modSeparator->setSeparator(true); modRefreshAction = new QAction("Refresh Status",this); modSelectAllAction = new QAction("Select All Modules",this); modAttachAction = new QAction("Attach to stdout",this); modAssignAction = new QAction("Assign Hosts",this); modRunAction->setIcon(QIcon(":/play22.svg")); modStopAction->setIcon(QIcon(":/stop22.svg")); modkillAction->setIcon(QIcon(":/kill22.svg")); modRefreshAction->setIcon(QIcon(":/refresh22.svg")); modSelectAllAction->setIcon(QIcon(":/select-all22.svg")); modAssignAction->setIcon(QIcon(":/computer-available22.svg")); ui->moduleList->addAction(modRunAction); ui->moduleList->addAction(modStopAction); ui->moduleList->addAction(modkillAction); ui->moduleList->addAction(modSeparator); ui->moduleList->addAction(modRefreshAction); ui->moduleList->addAction(modSelectAllAction); ui->moduleList->addAction(modAttachAction); ui->moduleList->addAction(modAssignAction); connect(modRunAction,SIGNAL(triggered()),this,SLOT(onRun())); connect(modStopAction,SIGNAL(triggered()),this,SLOT(onStop())); connect(modkillAction,SIGNAL(triggered()),this,SLOT(onKill())); connect(modRefreshAction,SIGNAL(triggered()),this,SLOT(onRefresh())); connect(modSelectAllAction,SIGNAL(triggered()),this,SLOT(selectAllModule())); connect(modAttachAction,SIGNAL(triggered()),this,SLOT(onAttachStdout())); connect(modAssignAction,SIGNAL(triggered()),this,SLOT(onAssignHost())); }
/*! \brief Kill all running modules in the application */ void ApplicationViewWidget::killApplicationSet() { selectAllModule(true); onKill(); }
bool CPPModule::onEvent(IrcConnection* connection, const std::string& senderID, const std::string& eventName, const std::string& json, const std::string& optString) { JSONNode n; if(!json.empty()) { n = libjson::parse(json); } if(senderID=="IRCCONNECTION") { //Create a IrcModuleConnection instance IrcModuleConnection ircModuleConnection(mID, mModuleManager, connection); //Call onConnect if its the called event if(eventName=="onConnect") { return onConnect(ircModuleConnection); } //Convert the IRC Message IrcMessage message; message.ircLine = n["ircLine"].as_string(); message.prefix = n["prefix"].as_string(); message.hasDetailedPrefix = n["hasDetailedPrefix"].as_bool(); if(message.hasDetailedPrefix) { message.msgPrefix.nick_or_server = n["msgPrefix"]["nick_or_server"].as_string(); message.msgPrefix.user = n["msgPrefix"]["user"].as_string(); message.msgPrefix.host = n["msgPrefix"]["host"].as_string(); } message.command = n["command"].as_string(); message.isNumeric = n["isNumeric"].as_bool(); message.target = n["target"].as_string(); message.params = n["params"].as_string(); //Call all other event handlers if(eventName=="onMessage") { return onMessage(ircModuleConnection, message); } else if(eventName=="onJoin") { return onJoin(ircModuleConnection, message); } else if(eventName=="onPart") { return onPart(ircModuleConnection, message); } else if(eventName=="onKick") { return onKick(ircModuleConnection, message, optString); } else if(eventName=="onQuit") { return onQuit(ircModuleConnection, message); } else if(eventName=="onKill") { return onKill(ircModuleConnection, message, optString); } else if(eventName=="onPrivateMessage") { return onPrivateMessage(ircModuleConnection, message); } else if(eventName=="onChannelMessage") { return onChannelMessage(ircModuleConnection, message); } else if(eventName=="onNotice") { return onNotice(ircModuleConnection, message); } else if(eventName=="onInvite") { return onInvite(ircModuleConnection, message); } else if(eventName=="onTopicChanged") { return onTopicChanged(ircModuleConnection, message); } else if(eventName=="onNickChanged") { return onNickChanged(ircModuleConnection, message); } } return true; }