Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
im Still not fast enough to get the achievement i care too much to let my allies die to save 5 minutes
I'm going to have a try about your suggestions
local old_fn = Widget.MainOverlayTopBar.init
function Widget.MainOverlayTopBar:init()
old_fn(self)
self.game_timer = self.main_bar_left_widgets:AddChild( Widget.GameTimer() )
:Bloom(0.1)
:SetFocusable( true )
:SetToolTipLayoutFn( function( w, tooltip_widget ) tooltip_widget:LayoutBounds( "left", "below", w ):Offset( 0, -SPACING.M1 ) end )
:LayoutBounds( "after", "center" ):Offset( 20, 0 )
end
This does almost the same thing, but the difference is that it appends to the existing function instead of replacing it, so you don't need to worry about the source code changing or another mod adding to the overlay bar.
One of the downside to this method is that you can only append or prepend code, so you cannot insert code in the middle. However, when that is not necessary, it is better to use this method.
Here's a few suggestions for the mod: I noticed that you copied and pasted the game's source code and modified it. However, this can lead to a few issues, because if the source code changes, you are forced to change the entire code, and you have to keep track of the different branches. Seems way too much work. And it doesn't work well with other mods that modifies the main overlay bar.
Instead of setting the function, what you can do is reusing the old function. For example, for your Widget.MainOverlayTopBar:init function, instead of rewriting everything, you can store it to a local variable, and then call that variable in your modified function.
码了