-
-
Notifications
You must be signed in to change notification settings - Fork 169
superman: more initial improvements #577
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
Dutchman101
merged 17 commits into
multitheftauto:master
from
sacr1ficez:superman-improve
Nov 24, 2024
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
cdcdce0
Remove old files
sacr1ficez 980ea04
Push some initial improvements
sacr1ficez a13c24b
Fix order in clean event
sacr1ficez 1fc2d7c
No need for these events anymore
sacr1ficez b3ff904
Remove headers per request
sacr1ficez 151b776
Change min version
sacr1ficez 7cdc767
Replace getPedRotation with getElementRotation
sacr1ficez 7e28f4b
Move superman allowed data key table
sacr1ficez 7688fbe
Remove setPedRotation
sacr1ficez f5b734d
Remove unused event and variable
sacr1ficez e9a98fa
Localize some functions
sacr1ficez a7cbc7c
Cache files
sacr1ficez b67e43c
Merge branch 'master' into superman-improve
sacr1ficez 7ec514e
Add element data compatibility layer
sacr1ficez a420e33
Set SUPERMAN_USE_ELEMENT_DATA to false by default
sacr1ficez 7b6a258
Merge branch 'master' into superman-improve
sacr1ficez ee37f46
Remove data if didn't existed before, and beautify canElementDataBeCh…
sacr1ficez File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
local function supermanCancelAirKill() | ||
local supermanFlying = getSupermanData(source, SUPERMAN_FLY_DATA_KEY) | ||
local supermanTakingOff = getSupermanData(source, SUPERMAN_TAKE_OFF_DATA_KEY) | ||
|
||
if (not supermanFlying and not supermanTakingOff) then | ||
return false | ||
end | ||
|
||
cancelEvent() | ||
end | ||
addEventHandler("onPlayerStealthKill", root, supermanCancelAirKill) | ||
|
||
-- Fix for players glitching other players' vehicles by warping into them while superman is active, causing them to flinch into air and get stuck. | ||
|
||
local function supermanEnterVehicle() | ||
local supermanFlying = getSupermanData(source, SUPERMAN_FLY_DATA_KEY) | ||
local supermanTakingOff = getSupermanData(source, SUPERMAN_TAKE_OFF_DATA_KEY) | ||
|
||
if (not supermanFlying and not supermanTakingOff) then | ||
return false | ||
end | ||
|
||
removePedFromVehicle(source) | ||
|
||
local playerX, playerY, playerZ = getElementPosition(source) | ||
|
||
setElementPosition(source, playerX, playerY, playerZ) | ||
end | ||
addEventHandler("onPlayerVehicleEnter", root, supermanEnterVehicle) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
SUPERMAN_FLY_DATA_KEY = "superman:flying" | ||
SUPERMAN_TAKE_OFF_DATA_KEY = "superman:takingOff" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
local function onClientSupermanSync(supermanServerData) | ||
syncSupermansData(supermanServerData) | ||
end | ||
if (not SUPERMAN_USE_ELEMENT_DATA) then | ||
addEvent("onClientSupermanSync", true) | ||
addEventHandler("onClientSupermanSync", localPlayer, onClientSupermanSync) | ||
end | ||
|
||
local function onClientSupermanSetData(dataKey, dataValue) | ||
setSupermanData(source, dataKey, dataValue) | ||
end | ||
if (not SUPERMAN_USE_ELEMENT_DATA) then | ||
addEvent("onClientSupermanSetData", true) | ||
addEventHandler("onClientSupermanSetData", root, onClientSupermanSetData) | ||
end |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.