Skip to content

Commit 23f6bd9

Browse files
Add mapfixes resource (#504)
* add mapfixes * update comment in PLACE_BUILDINGS * make mapfix components toggleable via server setting * update map fix components table * remove header comments from lua scripts * Adding new interiors Added two interiors 'Doherty's garage and 'just business' mission' * WIP doherty garage and downtown atrium * fix whitespace in comment * add doherty garage open logic * One new interior and a small correction in the code - Added interior from the 'Yay Ka-Boom-Boom' mission - code typo correction * fix triggerClientEvent spam * rename garageIDsForInteriors * remove useless statue objects in atrium * better naming * better comments * add comments * rename server_main * rename client_main * add special pushable doors @ atrium * move scripts * add laeIdleProj02.col fix * correction in setting name * make settings display better on admin panel * rename some variables * Repair details * prettier format lua * fix newline * Two new collision repairs - Repair of the ceiling of a shopping center building in the San Fierro Doherty area - Repair of a bollard in the underground parking lot at the San Fierro Airport * Space correction * comments * fix space comments * Repair of ground collisions under the bridge * formatting * change setting to [true] instead of string true * Remove model replacement 😿 * remove old settings * Update meta.xml * make table shared * add mapfixes to `play` include resource * add big smoke crack palace wall and rename some settings + new setting friendly names and descriptions --------- Co-authored-by: THEGizmoOfficial <79152243+THEGizmoOfficial@users.noreply.github.com> Co-authored-by: THEGizmoOfficial <the_gizmo1998@o2.pl>
1 parent 56c3cc3 commit 23f6bd9

File tree

5 files changed

+273
-0
lines changed

5 files changed

+273
-0
lines changed

[gamemodes]/[play]/play/meta.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<info author="MTA contributors (github.com/multitheftauto/mtasa-resources)" description="Launches a basic freeroam mode, together with basic map and extra handling" version="2.0" type="gamemode"/>
33
<include resource="freeroam"/>
44
<include resource="internetradio"/>
5+
<include resource="mapfixes"/>
56
<script src="play_config.lua" type="server"/>
67
<script src="play_players.lua" type="server"/>
78
<script src="play_vehicles.lua" type="server"/>

[gameplay]/mapfixes/meta.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<meta>
2+
<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" />
3+
<min_mta_version client="1.6.0-9.22505.0" server="1.6.0-9.22505.0"></min_mta_version>
4+
5+
<script src="scripts/shared/data.lua" type="shared"/>
6+
<script src="scripts/client/main.lua" type="client"/>
7+
<script src="scripts/server/main.lua" type="server"/>
8+
9+
<settings>
10+
<setting name="*bs_crack_palace_wall" value="[true]" friendlyname="Crack Palace Wall" desc="Enable Big Smoke Crack Palace wall covering hole" accept="true,false"/>
11+
<setting name="*bs_crack_palace_interior" value="[false]" friendlyname="Crack Palace Interior" desc="Enable Big Smoke Crack Palace open-world interior (DISABLED by default)" accept="true,false"/>
12+
<setting name="*atrium_lobby_interior" value="[true]" friendlyname="Atrium Lobby Interior" desc="Enable Commerce Atrium lobby open-world interior" accept="true,false"/>
13+
<setting name="*doherty_garage_interior" value="[true]" friendlyname="Doherty Garage Interior" desc="Enable Doherty Safehouse Garage open-world interior" accept="true,false"/>
14+
<setting name="*undamaged_crackfactory_with_interior" friendlyname="Undamaged SF Crack Factory" value="[true]" desc="Enable restored Undamaged SF Crack Factory with open-world interior" accept="true,false"/>
15+
</settings>
16+
</meta>
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
addEvent("mapfixes:client:loadAllComponents", true)
2+
addEvent("mapfixes:client:togOneComponent", true)
3+
4+
local function loadOneMapFixComponent(name, data)
5+
-- Clear the previous elements if any
6+
local createdElements = data.createdElements
7+
if createdElements then
8+
for _, element in pairs(createdElements) do
9+
if isElement(element) then
10+
destroyElement(element)
11+
end
12+
end
13+
data.createdElements = {}
14+
end
15+
-- Clear the previous requested model IDs if any
16+
local allocatedIDs = data.allocatedIDs
17+
if allocatedIDs then
18+
for _, modelID in pairs(allocatedIDs) do
19+
engineFreeModel(modelID)
20+
end
21+
data.allocatedIDs = {}
22+
end
23+
-- Restore the previous removed models if any
24+
local worldModelsToRemove = data.worldModelsToRemove
25+
if worldModelsToRemove then
26+
for _, v in pairs(worldModelsToRemove) do
27+
restoreWorldModel(unpack(v))
28+
end
29+
end
30+
-- Close previously opened garages if any
31+
local garageIDsForInteriorsToOpen = data.garageIDsForInteriorsToOpen
32+
if garageIDsForInteriorsToOpen then
33+
for _, garageID in pairs(garageIDsForInteriorsToOpen) do
34+
setGarageOpen(garageID, false)
35+
end
36+
end
37+
38+
-- Don't proceed if the component is disabled
39+
if not data.enabled then
40+
return
41+
end
42+
43+
-- Create the new elements if any
44+
local buildingsToSpawn = data.buildingsToSpawn
45+
if buildingsToSpawn then
46+
for _, v in pairs(buildingsToSpawn) do
47+
local building = createBuilding(unpack(v))
48+
if building then
49+
if not data.createdElements then data.createdElements = {} end
50+
data.createdElements[#data.createdElements + 1] = building
51+
end
52+
end
53+
end
54+
local objectsToSpawn = data.objectsToSpawn
55+
if objectsToSpawn then
56+
for _, v in pairs(objectsToSpawn) do
57+
local object
58+
if v.physicalPropertiesGroup then
59+
local allocatedID = engineRequestModel("object", v.modelID)
60+
if allocatedID then
61+
if not data.allocatedIDs then data.allocatedIDs = {} end
62+
data.allocatedIDs[#data.allocatedIDs + 1] = allocatedID
63+
64+
object = createObject(allocatedID, v.x, v.y, v.z, v.rx, v.ry, v.rz)
65+
if object then
66+
engineSetModelPhysicalPropertiesGroup(allocatedID, v.physicalPropertiesGroup)
67+
end
68+
end
69+
else
70+
object = createObject(v.modelID, v.x, v.y, v.z, v.rx, v.ry, v.rz)
71+
end
72+
if object then
73+
if v.unbreakable then
74+
setObjectBreakable(object, false)
75+
end
76+
if v.frozen then
77+
setElementFrozen(object, true)
78+
end
79+
80+
if not data.createdElements then data.createdElements = {} end
81+
data.createdElements[#data.createdElements + 1] = object
82+
end
83+
end
84+
end
85+
-- Remove world models if any
86+
if worldModelsToRemove then
87+
for _, v in pairs(worldModelsToRemove) do
88+
removeWorldModel(unpack(v))
89+
end
90+
end
91+
-- Open garages if any
92+
if garageIDsForInteriorsToOpen then
93+
for _, garageID in pairs(garageIDsForInteriorsToOpen) do
94+
setGarageOpen(garageID, true)
95+
end
96+
end
97+
end
98+
99+
local function loadMapFixComponents(mapFixComponentStatuses)
100+
assert(type(mapFixComponentStatuses) == "table")
101+
for name, enabled in pairs(mapFixComponentStatuses) do
102+
local data = mapFixComponents[name]
103+
if data then
104+
data.enabled = enabled
105+
loadOneMapFixComponent(name, data)
106+
end
107+
end
108+
end
109+
addEventHandler("mapfixes:client:loadAllComponents", localPlayer, loadMapFixComponents, false)
110+
111+
local function toggleOneMapFixComponent(name, enable)
112+
assert(type(name) == "string")
113+
assert(type(enable) == "boolean")
114+
local data = mapFixComponents[name]
115+
if not data then
116+
return
117+
end
118+
data.enabled = (enable == true)
119+
loadOneMapFixComponent(name, data)
120+
if eventName ~= "onClientResourceStop" then
121+
outputDebugString("Map fix component '" .. name .. "' is now " .. (data.enabled and "enabled" or "disabled"))
122+
end
123+
end
124+
addEventHandler("mapfixes:client:togOneComponent", resourceRoot, toggleOneMapFixComponent, false)
125+
126+
local function unloadAllMapFixComponents()
127+
for name, _ in pairs(mapFixComponents) do
128+
toggleOneMapFixComponent(name, false)
129+
end
130+
end
131+
addEventHandler("onClientResourceStop", resourceRoot, unloadAllMapFixComponents, false)
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
local mapFixComponentStatuses = {}
2+
3+
-- Fetch the settings on script load
4+
for settingName, _ in pairs(mapFixComponents) do
5+
local value = get(settingName)
6+
mapFixComponentStatuses[settingName] = (value == true)
7+
end
8+
9+
local function handlePlayerResourceStart(res)
10+
if res ~= resource then return end
11+
12+
triggerClientEvent(source, "mapfixes:client:loadAllComponents", source, mapFixComponentStatuses)
13+
end
14+
addEventHandler("onPlayerResourceStart", root, handlePlayerResourceStart)
15+
16+
local function handleSettingChange(settingName)
17+
settingName = settingName:gsub(getResourceName(resource) .. ("."), "")
18+
local modifier = settingName:sub(1, 1)
19+
if modifier == "*" or modifier == "#" or modifier == "@" then
20+
settingName = settingName:sub(2)
21+
end
22+
if not mapFixComponents[settingName] then return end
23+
24+
-- Fetch the new setting value
25+
local newValue = get(settingName)
26+
local isEnabled = (newValue == true)
27+
mapFixComponentStatuses[settingName] = isEnabled
28+
29+
-- Trigger for all players
30+
triggerClientEvent("mapfixes:client:togOneComponent", resourceRoot, settingName, isEnabled)
31+
end
32+
addEventHandler("onSettingChange", root, handleSettingChange, false)
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
mapFixComponents = {
2+
["bs_crack_palace_interior"] = {
3+
-- Adds the original interior of Big Smoke's Crack Palace
4+
buildingsToSpawn = {
5+
-- Object positions taken from carter.ipl
6+
{ 17933, 2532.992188, -1289.789062, 39.281250, 0, 0, 0 }, -- carter-light15b
7+
{ 17946, 2533.820312, -1290.554688, 36.945312, 0, 0, 0 }, -- carter_ground
8+
},
9+
},
10+
["bs_crack_palace_wall"] = {
11+
-- Adds the original wall covering the hole at Big Smoke's Crack Palace
12+
objectsToSpawn = {
13+
{ modelID = 3059, unbreakable = true, frozen = true, x = 2522, y = -1272.9301, z = 35.61, rx = 0, ry = 0, rz = 0 }, -- imy_shash_wall
14+
},
15+
},
16+
["atrium_lobby_interior"] = {
17+
-- Removes the doors of the atrium and places the original interior inside
18+
buildingsToSpawn = {
19+
-- Object positions taken from gen_int1.ipl
20+
{ 14675, 1719.75, -1655.765625, 30.1953125, 0, 0, 0 }, -- Hotelatrium_LAn
21+
{ 14674, 1721.632813, -1655.1875, 24.3125, 0, 0, 0 }, -- hotelferns1_LAn
22+
},
23+
worldModelsToRemove = {
24+
-- Interior -1 needs to be used because these objects are spawned in Interior 13 (in lan_stream3.ipl)
25+
-- which causes them to appear in all interiors (GTA:SA behavior)
26+
{ 1537, 5, 1725.4, -1637.4, 19.2, -1 }, -- Gen_doorEXT16
27+
{ 1533, 5, 1728.4, -1637.4, 19.2, -1 }, -- Gen_doorEXT12
28+
{ 1537, 5, 1700.1, -1669.4, 19.2, -1 }, -- Gen_doorEXT16
29+
{ 1533, 5, 1700.1, -1669.4, 19.2, -1 }, -- Gen_doorEXT12
30+
},
31+
objectsToSpawn = {
32+
{ modelID = 1533, physicalPropertiesGroup = 147, x = 1700.132812, y = -1666.40625, z = 19.210938, rx = 0, ry = -0, rz = -90 },
33+
{ modelID = 1537, physicalPropertiesGroup = 147, x = 1700.132812, y = -1669.421875, z = 19.210938, rx = 0, ry = 0, rz = -90 },
34+
{ modelID = 1537, physicalPropertiesGroup = 147, x = 1725.429688, y = -1637.4375, z = 19.210938, rx = 0, ry = 0, rz = -180 },
35+
{ modelID = 1533, physicalPropertiesGroup = 147, x = 1728.445312, y = -1637.4375, z = 19.210938, rx = 0, ry = 0, rz = -180 },
36+
},
37+
},
38+
["doherty_garage_interior"] = {
39+
-- Adds the original Doherty Safehouse Garage interior
40+
buildingsToSpawn = {
41+
-- Object positions taken from sfse_stream5.ipl
42+
{ 11389, -2048.11719, 166.71875, 30.97656, 0.00000, 0.00000, 0.00000 }, -- hubinterior_SFS
43+
{ 11388, -2048.17969, 166.71875, 34.51563, 0.00000, 0.00000, 0.00000 }, -- hubintroof_SFSe
44+
{ 11390, -2048.17969, 166.71875, 32.22656, 0.00000, 0.00000, 0.00000 }, -- hubgirders_SFSE
45+
{ 11394, -2048.16406, 168.31250, 31.73438, 0.00000, 0.00000, 0.00000 }, -- hubgrgbeams_SFSe
46+
{ 11391, -2056.20313, 158.54688, 29.09375, 0.00000, 0.00000, 0.00000 }, -- hubprops6_SFSe
47+
{ 11393, -2043.51563, 161.34375, 29.33594, 0.00000, 0.00000, 0.00000 }, -- hubprops1_SFS
48+
{ 11392, -2047.75781, 168.14063, 27.88281, 0.00000, 0.00000, 0.00000 }, -- hubfloorstains_SFSe
49+
},
50+
garageIDsForInteriorsToOpen = {
51+
22, -- Mission Garage (Doherty)
52+
},
53+
},
54+
["undamaged_crackfactory_with_interior"] = {
55+
-- Removes the destroyed SF factory building, and adds the original interior
56+
buildingsToSpawn = {
57+
-- Object positions taken from crack.ipl
58+
{ 11007, -2164.45313, -248.00000, 40.78125, 0.00000, 0.00000, 0.00000 }, -- crack_wins_SFS
59+
{ 11085, -2164.45313, -237.61719, 41.40625, 0.00000, 0.00000, 0.00000 }, -- crack_int1
60+
{ 11086, -2164.45313, -237.39063, 43.42188, 0.00000, 0.00000, 0.00000 }, -- crack_int2
61+
{ 11087, -2143.22656, -261.24219, 38.09375, 0.00000, 0.00000, 0.00000 }, -- crackfactwalk
62+
{ 11089, -2185.52344, -263.92969, 38.76563, 0.00000, 0.00000, 90 }, -- crackfacttanks2_SFS
63+
{ 11090, -2158.82031, -266.23438, 36.22656, 0.00000, 0.00000, 90 }, -- crackfactvats_SFS
64+
{ 11233, -2164.45313, -255.39063, 38.12500, 0.00000, 0.00000, 0.00000 }, -- crackfactwalkb
65+
{ 11234, -2180.45313, -251.46875, 37.99219, 0.00000, 0.00000, 0.00000 }, -- crackfactwalkc
66+
{ 11235, -2180.45313, -261.28906, 37.99219, 0.00000, 0.00000, 0.00000 }, -- crackfactwalkd
67+
{ 11236, -2164.45313, -255.39063, 38.12500, 0.00000, 0.00000, 0.00000 }, -- crackfactwalke
68+
{ 939, -2179.33594, -239.08594, 37.96094, 0.00000, 0.00000, 0.00000 }, -- CJ_DF_UNIT
69+
{ 939, -2140.22656, -237.50781, 37.96094, 0.00000, 0.00000, 90 }, -- CJ_DF_UNIT
70+
{ 942, -2159.06250, -239.06250, 37.96094, 0.00000, 0.00000, 0.00000 }, -- CJ_DF_UNIT_2
71+
{ 942, -2174.82813, -235.56250, 37.96094, 0.00000, 0.00000, 80 }, -- CJ_DF_UNIT_2
72+
{ 942, -2140.33594, -229.14844, 37.96094, 0.00000, 0.00000, 90 }, -- CJ_DF_UNIT_2
73+
{ 942, -2164.20313, -236.02344, 37.96094, 0.00000, 0.00000, 90 }, -- CJ_DF_UNIT_2
74+
{ 944, -2188.52344, -236.80469, 36.39844, 0.00000, 0.00000, 0.00000 }, -- Packing_carates04
75+
{ 944, -2153.79688, -229.03906, 36.39844, 0.00000, 0.00000, 0.00000 }, -- Packing_carates04
76+
{ 944, -2146.26563, -238.40625, 36.39844, 0.00000, 0.00000, -95 }, -- Packing_carates04
77+
{ 944, -2171.10156, -235.70313, 36.39844, 0.00000, 0.00000, -175 }, -- Packing_carates04
78+
{ 944, -2145.16406, -234.17188, 36.39844, 0.00000, 0.00000, -80 }, -- Packing_carates04
79+
{ 944, -2146.02344, -228.50000, 36.39844, 0.00000, 0.00000, -80 }, -- Packing_carates04
80+
{ 944, -2149.87500, -229.71875, 36.39844, 0.00000, 0.00000, 0.00000 }, -- Packing_carates04
81+
{ 944, -2177.53906, -259.82813, 36.39844, 0.00000, 0.00000, -95 }, -- Packing_carates04
82+
{ 944, -2175.75000, -266.33594, 36.39844, 0.00000, 0.00000, -55 }, -- Packing_carates04
83+
{ 944, -2146.06250, -251.00781, 36.39844, 0.00000, 0.00000, -90 }, -- Packing_carates04
84+
{ 944, -2180.39063, -247.46094, 36.39844, 0.00000, 0.00000, -90 }, -- Packing_carates04
85+
},
86+
worldModelsToRemove = {
87+
{ 11088, 60, -2166.875, -236.51562, 40.85938, 0 }, -- CF_ext_dem_SFS
88+
{ 11282, 60, -2166.875, -236.51562, 40.85938, 0 }, -- (LOD) CF_ext_dem_SFS
89+
{ 11235, 15, -2180.4531, -261.28906, 37.99219, 0 }, -- crackfactwalkd
90+
{ 11236, 25, -2164.4531, -255.39062, 38.125, 0 }, -- crackfactwalke
91+
},
92+
},
93+
}

0 commit comments

Comments
 (0)