Skip to content

editor: Make interior world models removable #345

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

Merged

Conversation

Zangomangu
Copy link
Contributor

@Zangomangu Zangomangu commented Aug 23, 2021

Currently you can't remove interior world models in the editor.

In the below snippet from editor_main interior is always 0.

function onWorldObjectCreateOrDestroy ( )
	if ( getElementType ( source ) == "removeWorldObject" ) then
		local model = getElementData ( source, "model" )
		local lodModel = getElementData ( source, "lodModel" )
		local posX = getElementData ( source, "posX" )
		local posY = getElementData ( source, "posY" )
		local posZ = getElementData ( source, "posZ" )
		local interior = getElementData ( source, "interior" )
		local radius = getElementData ( source, "radius" )
		if ( eventName == "onElementCreate" ) then
			removeWorldModel ( model, radius, posX, posY, posZ, interior )
			removeWorldModel ( lodModel, radius, posX, posY, posZ, interior )
		else
			restoreWorldModel ( model, radius, posX, posY, posZ, interior )
			restoreWorldModel ( lodModel, radius, posX, posY, posZ, interior )
		end
	end
end

This PR saves the interior in element data like model, position, radius.

Secondly, certain duplicated models in interior 13 also appear in the outside world, like the train station in SF, so these couldnt be removed. Now -1 is used instead of 0 to apply the removal across all interiors.

@Zangomangu Zangomangu changed the title editor: Make interior objects removable editor: Make interior world models removable Aug 23, 2021
@Zangomangu
Copy link
Contributor Author

Updated the PR to use -1 instead of 0 when removing world models outside interiors, edited description

@Zangomangu
Copy link
Contributor Author

Anyone able to test & merge?

@Dutchman101 Dutchman101 merged commit ae1b394 into multitheftauto:master Sep 25, 2021
@patrikjuvonen patrikjuvonen added this to the 1.5.9 milestone Apr 22, 2022
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.

5 participants