Thread Tools Display Modes
12-30-09, 06:42 AM   #1
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
oUF layout with group vehicles?

Is there a layout out there that can handle the vehicle swapping in groups/raid groups?

Or that handles vehicles in groups/raids at all? (By spawning player pets for example...not sure)
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)
  Reply With Quote
12-30-09, 08:13 AM   #2
yj589794
A Rage Talon Dragon Guard
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 314
I've got a custom layout for just handling Raid/party groups that includes spawning of pets/vehicles.

It's based on the style of oUF_P3lim, but should be fairly easy to modify.

You can take a look at it here.


Swapping units when entering a vehicle is not supported yet as I've not had need for that feature so far.
  Reply With Quote
12-30-09, 09:53 AM   #3
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Originally Posted by zork View Post
Is there a layout out there that can handle the vehicle swapping in groups/raid groups?

Or that handles vehicles in groups/raids at all? (By spawning player pets for example...not sure)
One of my raid layouts works with vehicle swapping, though the objects won't update.
  Reply With Quote
12-30-09, 05:18 PM   #4
Dawn
A Molten Giant
 
Dawn's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 918
viv 3.8 had party and raid pets. It worked with vehicles (show vehicle as pet). 4.x has raidpets, too. Party pets aren't implemented, yet.
__________________
Rock: "We're sub-standard DPS. Nerf Paper, Scissors are fine."
Paper: "OMG, WTF, Scissors!"
Scissors: "Rock is OP and Paper are QQers. We need PvP buffs."

"neeh the game wont be remembered as the game who made blizz the most money, it will be remembered as the game who had the most QQ'ers that just couldnt quit the game for some reason..."

  Reply With Quote
01-04-10, 01:00 PM   #5
profalbert
A Defias Bandit
Join Date: Aug 2009
Posts: 2
I played around a little (like 100 hours....) and came up with a way to realize it in my oUF-layout.
I added my own custom "VehicleSwitch2"-element

Code:
local oUF = _G.oUF
assert(oUF, "oUF not found")

-- how long the OnUpdate should run on the frame after vehicle-state changed
local UPDATE_TIME = 3

local vehicleDelayFrame = CreateFrame('Frame')
local affectedFrames = {}

local function updateAllElements(frame)
	for _, v in ipairs(frame.__elements) do
		v(frame, 'UpdateElement', frame.unit)
	end
end

local function forceUpdate(self, elapsed)
	for k,v in pairs(affectedFrames) do
		if k.unit and UnitExists(k.unit) then
			updateAllElements(k)
			affectedFrames[k] = nil
			return
		end

		local afterUpdate = v - elapsed
		if afterUpdate < 0 then
			afterUpdate = nil
		end
		affectedFrames[k] = afterUpdate
	end
	if not next(affectedFrames) then
		self:Hide()
	end
end
vehicleDelayFrame:SetScript("OnUpdate", forceUpdate)
vehicleDelayFrame:Hide()

local Update = function(self)
	if not self.unit then return end
	local unit = self.unit
	local normalUnit = self:GetAttribute("unit")
	local modunit = SecureButton_GetModifiedUnit(self)
	if modunit ~= unit then
		self.unit = modunit
		if unit == normalUnit then
			-- not in vehicle
			self.vehicleUnit = nil
		else
			self.vehicleUnit = modunit
		end
		affectedFrames[self] = UPDATE_TIME
		vehicleDelayFrame:Show()
	end
	
	if unit == "player" then
		PlayerFrame.unit = self.unit
		BuffFrame_Update()
	end
end

local function attrChanged(self, name, value)
	local modunit = SecureButton_GetModifiedUnit(self)
	if self.unit and modunit ~= self.unit then
		self.vehicleUnit = modunit
		self.unit = modunit
	end
end

local Enable = function(self, unit)
	-- do not interfere with the default vehicleswitch
	if (unit == "player" or unit == "pet") and not self.disallowVehicleSwap then
		return
	end
	if not self.VehicleSwap2 or not self:GetAttribute("toggleForVehicle") then
		return
	end

	self:RegisterEvent("UNIT_ENTERED_VEHICLE", Update)
	self:RegisterEvent("UNIT_EXITED_VEHICLE", Update)
	self:RegisterEvent("PLAYER_ENTERING_WORLD", Update)
	self:HookScript("OnAttributeChanged", attrChanged)
	self:HookScript("OnShow", Update)

	Update(self)
end

local Disable = function(self)
	self.unit = self:GetAttribute("unit")
end

oUF:AddElement("VehicleSwitch2", Update, Enable, Disable)
As opposed to the current swapvehicle-element, this element does change the unit-attribute of the frame. It changes the frame.unit value using SecureButton_GetModifiedUnit() like many other UF-addons. For this to make sense the "toggleForVehicle"-attribute must be set on the frame.

After a swap, it needs some time until the vehicle-data becomes available, therefore I added an delayedupdate-Frame that updates all elements as soon as the vehicle-unit exists (took that idea from shadowed-UF).

I also hooked the OnAttributeChanged-script because the default-script on the frame overwrites the frame.unit-value.

This thing works on player, pet, party, partypet, and raidframes.

Last edited by profalbert : 01-04-10 at 01:10 PM.
  Reply With Quote
01-05-10, 05:55 AM   #6
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Nice job. Can you post your layout aswell? Where do you call the new VehicleSwitch2 element?
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 01-05-10 at 05:57 AM.
  Reply With Quote
01-05-10, 06:01 PM   #7
profalbert
A Defias Bandit
Join Date: Aug 2009
Posts: 2
It's based on oUF_Ammo and available on github
http://github.com/ChristophGr/oUF_profalbert
  Reply With Quote
01-11-10, 04:20 AM   #8
Shestak
A Deviate Faerie Dragon
 
Shestak's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2008
Posts: 11
I tried to do the same.

What I did:
In .toc file add vehicle2.lua
In the creation of style I adde:
self:SetAttribute("toggleForVehicle", true)
self.VehicleSwap2 = true
Layout based on oUF Caellian.


Change of vehicle is correctly on all frames. But when changing target name remains on the first target that I chose. Color, health and mana is updated according to the currently selected target, but no name. And given this error:
Code:
Interface\AddOns\oUF\ouf.lua:88: attempt to call local 'func' (a string value)
Count: 1

Call Stack:
[C]: in function `func'
Interface\AddOns\oUF\ouf.lua:88: in function <Interface\AddOns\oUF\ouf.lua:86>
(tail call): ?
[C]: in function `CameraOrSelectOrMoveStop'
[string "CAMERAORSELECTORMOVE"]:4: in function <[string "CAMERAORSELECTORMOVE"]:1>
Help please in solving this problem.
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » oUF layout with group vehicles?


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off