Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix hypertext in the mainmenu #13731

Merged
merged 2 commits into from Aug 13, 2023

Conversation

rubenwardy
Copy link
Member

@rubenwardy rubenwardy commented Aug 12, 2023

The hypertext element is currently disabled in the mainmenu because the client object is used to get the texture source and item definitions. This PR makes the client object optional

image

To do

This PR is Ready for Review

How to test

Replace builtin/mainmenu/tab_about.lua with the following content:

local logofile = defaulttexturedir .. "logo.png"
local hypertext = "<tag name=code color=#7bf font=mono> <tag name=action color=#77f hovercolor=#aaf>" ..
		"<img name=" .. logofile .. " width=64>\n" ..
		"<b>Overview</b>\nConquer is a mod that adds RTS gameplay. It allows players to start Conquer sub-games, where they can place buildings, train units, and fight other players.\nConquer is designed with the intention to eventually convert it into a game, with custom mapgen and richer features. This standalone mini-game version will remain, however.\n\n<b>Starting or joining a Conquer session</b>\nStart a new conquer game by running:\n<code>/conquer start</code>\nYou'll switch into Conquer playing mode, where you will be given buildings that you can place.\nYou'll need to place a keep, which you must protect at all costs.\nOther players can join your conquer session if they are within 50 nodes by typing:\n<code>/conquer join yourname</code>\nYou may leave a game and return to normal playing mode at any time by typing:\n<code>/conquer leave</code>\n\n<b>Conquer GUI</b>\nThe Conquer GUI is the central place for monitoring your kingdom. Once in a session, you can view it by pressing the inventory key (I), or by punching/right-clicking the keep node.\n\n<b>Recruiting Units</b>\nYou'll need to place a barracks to be able to train new units. Once you have done that, open the Conquer GUI and select a unit to train.\nTraining a unit requires time and resources. The barracks will start training the unit as soon as you select it, and with spawn the unit nearby when complete.\nCurrently, there is no way to obtain resources. This is on the to-do list.\n\n<b>Controlling Units</b>\nSelect a unit by left clicking. You can select multiple units using shift+click. You can deselect units by pressing Q or clicking somewhere else.\nRight-click to command the unit to do something.\nChange the active wand by scrolling or pressing a number - just like with normal hotbars.\n<img name=blank.png width=16 height=1>• <b>Move:</b> right-click on a node to move the unit there.\n<img name=blank.png width=16 height=1>• <b>Melee Attack:</b> right-click on a unit or building to move the unit there, and attack.\n<img name=blank.png width=16 height=1>• <b>Ranged Attack:</b> right-click on a unit to fire arrows. The unit must be in sight, and must be less than 10 nodes and more than 2 nodes away.\nAttacking buildings will damage them. Damaged buildings will be repaired automatically when there are no enemies nearby.\n\n<b>Winning</b>\nYou win the game by being the last surviving country. To defeat another kingdom, you will need to destroy their keep.\nYou can destroy an enemy's barracks to prevent them from training troops.\n"

return {
	name = "about",
	caption = fgettext("About"),
	cbf_formspec = function(tabview, name, tabdata)
		local fs =
			"hypertext[5.5,0.1;9.5,6.9;ht;" .. core.formspec_escape(hypertext) .. "]"

		return fs, "size[15.5,7.1,false]real_coordinates[true]"
	end,
	cbf_button_handler = function(this, fields, name, tabdata)
	end,
}

src/gui/guiHyperText.h Outdated Show resolved Hide resolved
src/gui/guiHyperText.h Outdated Show resolved Hide resolved
@rubenwardy rubenwardy merged commit 137e4ce into minetest:master Aug 13, 2023
13 checks passed
@rubenwardy rubenwardy deleted the mainmenu-fix-hypertext branch August 13, 2023 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants