void CMiniMap::SetCameraPos() { CTerrain* terrain = g_Game->GetWorld()->GetTerrain(); CVector3D target; GetMouseWorldCoordinates(target.X, target.Z); target.Y = terrain->GetExactGroundLevel(target.X, target.Z); g_Game->GetView()->MoveCameraTarget(target); }
void CMiniMap::FireWorldClickEvent(int button, int clicks) { float x, z; GetMouseWorldCoordinates(x, z); CScriptValRooted coords; g_ScriptingHost.GetScriptInterface().Eval("({})", coords); g_ScriptingHost.GetScriptInterface().SetProperty(coords.get(), "x", x, false); g_ScriptingHost.GetScriptInterface().SetProperty(coords.get(), "z", z, false); ScriptEvent("worldclick", coords); UNUSED2(button); UNUSED2(clicks); }
void CMiniMap::FireWorldClickEvent(int UNUSED(button), int UNUSED(clicks)) { JSContext* cx = g_GUI->GetActiveGUI()->GetScriptInterface()->GetContext(); JSAutoRequest rq(cx); float x, z; GetMouseWorldCoordinates(x, z); JS::RootedValue coords(cx); g_GUI->GetActiveGUI()->GetScriptInterface()->Eval("({})", &coords); g_GUI->GetActiveGUI()->GetScriptInterface()->SetProperty(coords, "x", x, false); g_GUI->GetActiveGUI()->GetScriptInterface()->SetProperty(coords, "z", z, false); ScriptEvent("worldclick", coords); }
/* Moves to mouse cursor position in world coordinates. */ bool ARTSUnit::PerformCommand() { FHitResult Hit = GetMouseWorldCoordinates(); if (Hit.bBlockingHit) { if (Hit.Actor != NULL) { ARTSUnit* unit = Cast<ARTSUnit>(Hit.GetActor()); if (unit != NULL) { Attack(unit); return true; } } // We hit something, move there Move(Hit.ImpactPoint); return true; } State = UnitAction::Idle; return false; }