Repository navigation
Conversation
Setting the dead property on peds previously invoked killPed directly regardless of the boolean value passed, causing ped.dead = false to kill the ped instead of keeping them alive. This introduces OOP_KillPed to ensure that setting ped.dead only kills the ped when passed true, and logs a warning when attempting to set it to false (as peds cannot be revived via this property). Resolves TODO left in CLuaPedDefs.cpp.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary of Changes
Previously, the
deadproperty in the Server OOPPedclass mapped directly tokillPedas its setter without verifying the assigned boolean value (lua_classvariable(luaVM, "dead", "killPed", "isPedDead")).Because
killPedexpects(element ped, [element killer, int weapon, int bodypart, bool stealth]), assigningfalse(e.g.ped.dead = false) passedfalseinto the killer argument, causing the ped to be killed regardless.This PR:
CLuaPedDefs::OOP_KillPed(declared viaLUA_DECLARE_OOP(KillPed)).ped.dead = truesafely callsKillPed(pElement).ped.dead = falsedoes not kill the ped, and outputs a descriptive warning (Cannot set 'dead' property to false).TODO(qaisjp)comment inCLuaPedDefs.cpp.Testing
Deathmatch.vcxproj(Release Win32) with 0 errors and 0 warnings.CScriptArgReader.