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

Add mapfixes resource #504

Merged
merged 42 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
d56d570
add mapfixes
Fernando-A-Rocha Jun 21, 2024
9e3cbb6
update comment in PLACE_BUILDINGS
Fernando-A-Rocha Jun 21, 2024
274a456
make mapfix components toggleable via server setting
Fernando-A-Rocha Jun 21, 2024
afae4c5
update map fix components table
Fernando-A-Rocha Jun 21, 2024
d960795
remove header comments from lua scripts
Fernando-A-Rocha Jun 21, 2024
672b6b7
Adding new interiors
THEGizmoOfficial Jun 23, 2024
b515bbb
WIP doherty garage and downtown atrium
Fernando-A-Rocha Jun 23, 2024
f54811d
fix whitespace in comment
Fernando-A-Rocha Jun 23, 2024
d89ed26
add doherty garage open logic
Fernando-A-Rocha Jun 23, 2024
7a27a02
One new interior and a small correction in the code
THEGizmoOfficial Jun 23, 2024
53c6838
fix triggerClientEvent spam
Fernando-A-Rocha Jun 23, 2024
6f79e03
rename garageIDsForInteriors
Fernando-A-Rocha Jun 23, 2024
bea9907
remove useless statue objects in atrium
Fernando-A-Rocha Jun 23, 2024
995cba3
better naming
Fernando-A-Rocha Jun 23, 2024
e54ea41
better comments
Fernando-A-Rocha Jun 23, 2024
c98a0b2
add comments
Fernando-A-Rocha Jun 24, 2024
523ec90
rename server_main
Fernando-A-Rocha Jun 24, 2024
3af56c2
rename client_main
Fernando-A-Rocha Jun 24, 2024
474f44a
add special pushable doors @ atrium
Fernando-A-Rocha Jun 24, 2024
91fb08d
move scripts
Fernando-A-Rocha Jun 25, 2024
ca48536
add laeIdleProj02.col fix
Fernando-A-Rocha Jun 25, 2024
28f3a67
correction in setting name
Fernando-A-Rocha Jun 25, 2024
8f7ce4b
make settings display better on admin panel
Fernando-A-Rocha Jun 25, 2024
e707787
rename some variables
Fernando-A-Rocha Jun 25, 2024
a55eb89
Repair details
THEGizmoOfficial Jun 25, 2024
e32da61
prettier format lua
Fernando-A-Rocha Jun 25, 2024
c3804ab
fix newline
Fernando-A-Rocha Jun 25, 2024
f4aa9a2
Two new collision repairs
THEGizmoOfficial Jun 25, 2024
a13eb66
Space correction
THEGizmoOfficial Jun 25, 2024
fb86ff6
comments
Fernando-A-Rocha Jun 25, 2024
322602b
fix space comments
Fernando-A-Rocha Jun 25, 2024
f4073b8
Repair of ground collisions under the bridge
THEGizmoOfficial Jun 26, 2024
9f11ace
formatting
Fernando-A-Rocha Jun 26, 2024
f0c0448
change setting to [true] instead of string true
Fernando-A-Rocha Jun 26, 2024
eaf4403
Remove model replacement :crying_cat_face:
Fernando-A-Rocha Jun 26, 2024
a64fc36
Merge remote-tracking branch 'upstream/master' into add-map-fixes
Fernando-A-Rocha Jun 26, 2024
d369c51
remove old settings
Fernando-A-Rocha Jun 27, 2024
97325f8
Update meta.xml
Fernando-A-Rocha Jun 27, 2024
87989b6
Merge remote-tracking branch 'upstream/master' into add-map-fixes
Fernando-A-Rocha Jul 2, 2024
8cef18e
make table shared
Fernando-A-Rocha Jul 2, 2024
22009cd
add mapfixes to `play` include resource
Fernando-A-Rocha Jul 2, 2024
d1a7de1
add big smoke crack palace wall
Fernando-A-Rocha Jul 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions [gameplay]/mapfixes/client.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
-- MTA:SA Map Fixes
Fernando-A-Rocha marked this conversation as resolved.
Show resolved Hide resolved

addEvent("mapfixes:client:loadAllComponents", true)
addEvent("mapfixes:client:togOneComponent", true)

local mapFixComponents = {}

local function loadOneMapFixComponent(name, data)
-- Clear the previous elements if any
local createdElements = data.createdElements
Fernando-A-Rocha marked this conversation as resolved.
Show resolved Hide resolved
if createdElements then
for _, element in pairs(createdElements) do
if isElement(element) then
destroyElement(element)
end
end
data.createdElements = {}
end
-- Don't proceed if the component is disabled
if not data.enabled then
return
end
-- Create the new elements
local spawnBuildings = data.spawnBuildings
Fernando-A-Rocha marked this conversation as resolved.
Show resolved Hide resolved
if spawnBuildings then
data.createdElements = {}
for _, v in ipairs(spawnBuildings) do
local building = createBuilding(unpack(v))
if building then
data.createdElements[#data.createdElements + 1] = building
end
end
end
end

local function loadMapFixComponents(mapFixComponentsFromServer)
assert(type(mapFixComponentsFromServer) == "table")
mapFixComponents = mapFixComponentsFromServer
for name, data in pairs(mapFixComponents) do
loadOneMapFixComponent(name, data)
end
end
addEventHandler("mapfixes:client:loadAllComponents", localPlayer, loadMapFixComponents, false)

local function toggleOneMapFixComponent(name, enable)
assert(type(name) == "string")
assert(type(enable) == "boolean")
local data = mapFixComponents[name]
if not data then
return
end
data.enabled = (enable == true)
loadOneMapFixComponent(name, data)
if eventName ~= "onClientResourceStop" then
outputDebugString("Map fix component '"..name.."' is now "..(data.enabled and "enabled" or "disabled")..".")
end
end
addEventHandler("mapfixes:client:togOneComponent", localPlayer, toggleOneMapFixComponent, false)

local function unloadAllMapFixComponents()
for name, _ in pairs(mapFixComponents) do
toggleOneMapFixComponent(name, false)
end
end
addEventHandler("onClientResourceStop", resourceRoot, unloadAllMapFixComponents, false)
12 changes: 12 additions & 0 deletions [gameplay]/mapfixes/meta.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<meta>
<info author="MTA contributors (github.com/multitheftauto/mtasa-resources)" version="1.0" name="SA Map Fixes" description="This resource patches a few flaws in the default MTA world" type="script" />
<min_mta_version client="1.6.0-9.22505.0" server="1.6.0-9.22505.0"></min_mta_version>

<script src="client.lua" type="client"/>
<script src="server_data.lua" type="server"/>
<script src="server.lua" type="server"/>

<settings>
Fernando-A-Rocha marked this conversation as resolved.
Show resolved Hide resolved
<setting name="*crack_palace_interior" value="true" friendlyname="Enable Big Smoke Crack Palace open-world interior map" accept="true,false"/>
</settings>
</meta>
30 changes: 30 additions & 0 deletions [gameplay]/mapfixes/server.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
-- MTA:SA Map Fixes
Fernando-A-Rocha marked this conversation as resolved.
Show resolved Hide resolved

for name, data in pairs(mapFixComponents) do
data.enabled = get(name) == "true"
end

local function handlePlayerResourceStart(res)
if res ~= resource then return end

triggerClientEvent(source, "mapfixes:client:loadAllComponents", source, mapFixComponents)
end
addEventHandler("onPlayerResourceStart", root, handlePlayerResourceStart)

local function handleSettingChange(settingName)
settingName = settingName:gsub(getResourceName(resource)..("."), "")
local modifier = settingName:sub(1, 1)
if modifier == "*" or modifier == "#" or modifier == "@" then
settingName = settingName:sub(2)
end
local data = mapFixComponents[settingName]
if not data then return end

local newValue = get(settingName)
data.enabled = newValue == "true"

for _, player in pairs(getElementsByType("player")) do
triggerClientEvent(player, "mapfixes:client:togOneComponent", player, settingName, data.enabled)
Fernando-A-Rocha marked this conversation as resolved.
Show resolved Hide resolved
end
end
addEventHandler("onSettingChange", root, handleSettingChange, false)
11 changes: 11 additions & 0 deletions [gameplay]/mapfixes/server_data.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-- MTA:SA Map Fixes
Fernando-A-Rocha marked this conversation as resolved.
Show resolved Hide resolved

mapFixComponents = {
["crack_palace_interior"] = {
-- Fill the hole of Big Smoke's Crack Palace with objects from carter.ipl
spawnBuildings = {
Fernando-A-Rocha marked this conversation as resolved.
Show resolved Hide resolved
{17933, 2532.992188, -1289.789062, 39.281250, 0, 0, 0}, -- carter-light15b
{17946, 2533.820312, -1290.554688, 36.945312, 0, 0, 0}, -- carter_ground
},
},
}