FPtje / DarkRP

DarkRP, a non-serious roleplay gamemode for Garry's Mod.
https://darkrp.miraheze.org
MIT License
460 stars 706 forks source link

DarkRP and PAC3 Possible Confliction #1986

Closed Hazbelll closed 9 years ago

Hazbelll commented 9 years ago

I think there might be a possible confliction occurring between DarkRP and PAC3, although for what reason I don't really know.

PAC3 can be found here: https://github.com/CapsAdmin/pac3

Workshop Version: http://steamcommunity.com/sharedfiles/filedetails/?id=104691717

If you hook into PAC3's PrePACConfigApply or PrePACEditorOpen, they will work fine and as expected.

An example to use with hooking into both of those can be found here: https://github.com/CapsAdmin/pac3/wiki/PAC-in-gamemodes

However, once the Server has been running for a while (between a few hours to even days, it's entirely random), Simplerr will randomly spit out this error into Console:

There are 4 Lua problems!
    Please check your console for more information!
[ERROR] A runtime error has occurred in "gamemodes/darkrp/gamemode/libraries/fn.lua" on line 82.
The best help I can give you is this:

Attempt to call Name/Nick/GetName on a non-existing player!

Hints:
    - No hints, sorry.

The responsibility for this error lies with (the authors of) one (or more) of these files:
    1. gamemodes/darkrp/gamemode/libraries/fn.lua on line 82
    2. gamemodes/darkrp/gamemode/modules/base/sh_entityvars.lua on line 107
    3. lua/pac3/editor/server/wear.lua on line 288
    4. lua/pac3/editor/server/wear.lua on line 138
    5. lua/includes/extensions/entity.lua on line 136
    6. addons/ulib/lua/ulib/shared/hook.lua on line 184
------- End of Simplerr error -------

[ERROR] A runtime error has occurred in "gamemodes/darkrp/gamemode/libraries/fn.lua" on line 82.
The best help I can give you is this:

Attempt to call Name/Nick/GetName on a non-existing player!

Hints:
    - No hints, sorry.

The responsibility for this error lies with (the authors of) one (or more) of these files:
    1. gamemodes/darkrp/gamemode/libraries/fn.lua on line 82
    2. gamemodes/darkrp/gamemode/modules/base/sh_entityvars.lua on line 107
    3. lua/pac3/editor/server/wear.lua on line 288
    4. lua/pac3/editor/server/wear.lua on line 138
    5. lua/includes/extensions/entity.lua on line 136
    6. addons/ulib/lua/ulib/shared/hook.lua on line 184
------- End of Simplerr error -------

[ERROR] A runtime error has occurred in "gamemodes/darkrp/gamemode/libraries/fn.lua" on line 82.
The best help I can give you is this:

Attempt to call Name/Nick/GetName on a non-existing player!

Hints:
    - No hints, sorry.

The responsibility for this error lies with (the authors of) one (or more) of these files:
    1. gamemodes/darkrp/gamemode/libraries/fn.lua on line 82
    2. gamemodes/darkrp/gamemode/modules/base/sh_entityvars.lua on line 107
    3. lua/pac3/editor/server/wear.lua on line 288
    4. lua/pac3/editor/server/wear.lua on line 138
    5. lua/includes/extensions/entity.lua on line 136
    6. addons/ulib/lua/ulib/shared/hook.lua on line 184
------- End of Simplerr error -------

[ERROR] A runtime error has occurred in "gamemodes/darkrp/gamemode/libraries/fn.lua" on line 82.
The best help I can give you is this:

Attempt to call Name/Nick/GetName on a non-existing player!

Hints:
    - No hints, sorry.

The responsibility for this error lies with (the authors of) one (or more) of these files:
    1. gamemodes/darkrp/gamemode/libraries/fn.lua on line 82
    2. gamemodes/darkrp/gamemode/modules/base/sh_entityvars.lua on line 107
    3. lua/pac3/editor/server/wear.lua on line 288
    4. lua/pac3/editor/server/wear.lua on line 138
    5. lua/includes/extensions/entity.lua on line 136
    6. addons/ulib/lua/ulib/shared/hook.lua on line 184
------- End of Simplerr error -------

There are 4 Lua problems!
Please check your console for more information!

Note: I saved the logs of this particular time from my Client Console when it occured a while ago and it spat the same error out 4 times at the exact same time, however, it's not always 4 times at once. Sometimes it's only once. The most I've seen was this time at 4. Once this happens, any new joining players will be informed of this too and have the above printed to their Console.

There is no Stack Trace at all from Garry's Mod itself, likewise everything in DarkRP (and PAC3) continues to work as expected, including the hooks, however sometimes (and probably not related to DarkRP at all?) anyone attempting to "Wear" a PAC of theirs will not work. They get no errors, it just doesn't do anything. The last time this occured in-game, Simplerr stated there was 1 New Lua Problem, check console for details, but the Console had absolutely nothing.

At first, I tried removing my hook into PrePACConfigApply, but the random errors continued, so I removed both entirely and it stopped after that. No more issues, however today, when I shut my Server down to change some things with it whilst it's empty, I received the following:

killserver
ServerLog: Server succesfully shut down.
File exists in two addons - possible conflicts! lua/pac3/editor/server/wear.lua
(PAC3 and DarkRP)

[ERROR] A runtime error has occurred in "gamemodes/darkrp/gamemode/libraries/fn.
lua" on line 82.
The best help I can give you is this:

Attempt to call Name/Nick/GetName on a non-existing player!

Hints:
        - No hints, sorry.

The responsibility for this error lies with (the authors of) one (or more) of th
ese files:
        1. gamemodes/darkrp/gamemode/libraries/fn.lua on line 82
        2. gamemodes/darkrp/gamemode/modules/base/sh_entityvars.lua on line 105
        3. lua/pac3/editor/server/wear.lua on line 288
        4. lua/pac3/editor/server/wear.lua on line 138
        5. lua/includes/extensions/entity.lua on line 136
        6. addons/ulib/lua/ulib/shared/hook.lua on line 110
------- End of Simplerr error -------

  1. error - [C]:-1
   2. unknown - gamemodes/darkrp/gamemode/libraries/simplerr.lua:467
    3. error - gamemodes/darkrp/gamemode/libraries/fn.lua:82
     4. GetName - gamemodes/darkrp/gamemode/modules/base/sh_entityvars.lua:105
      5. RemovePart - lua/pac3/editor/server/wear.lua:288
       6. Function - lua/pac3/editor/server/wear.File exists in two addons - pos
sible conflicts! lua/pac3/editor/server/wear.lua (PAC3 and DarkRP)

[ERROR] A runtime error has occurred in "gamemodes/darkrp/gamemode/libraries/fn.
lua" on line 82.
The best help I can give you is this:

Attempt to call Name/Nick/GetName on a non-existing player!

Hints:
        - No hints, sorry.

The responsibility for this error lies with (the authors of) one (or more) of th
ese files:
        1. gamemodes/darkrp/gamemode/libraries/fn.lua on line 82
        2. gamemodes/darkrp/gamemode/modules/base/sh_entityvars.lua on line 105
        3. lua/pac3/editor/server/wear.lua on line 288
        4. lua/pac3/editor/server/wear.lua on line 138
        5. lua/includes/extensions/entity.lua on line 136
        6. addons/ulib/lua/ulib/shared/hook.lua on line 110
------- End of Simplerr error -------

  1. error - [C]:-1
   2. unknown - gamemodes/darkrp/gamemode/libraries/simplerr.lua:467
    3. error - gamemodes/darkrp/gamemode/libraries/fn.lua:82
     4. GetName - gamemodes/darkrp/gamemode/modules/base/sh_entityvars.lua:105
      5. RemovePart - lua/pac3/editor/server/wear.lua:288
       6. Function - lua/pac3/editor/server/wear.

Of course, since the Server had already been shutdown, this is a non-issue, but I thought it was worth mentioning, as it's the exact same error as before, but with a little extra stating that DarkRP and PAC3 are conflicting. I have shut the server down in the past without that being spat out after. The Server had been up for 1 Day, 23 Hours when this happened.

I am using the Workshop Versions of both DarkRP and PAC3 on the Server. I have not modified either in anyway, but do use DarkRP Modification to modify DarkRP, however I have no modules I know of that could be causing this. When I had tried hooking into PAC previously, they were as a standalone addon in the garrysmod\addons directory, not as a module in garrysmod\addons\darkrpmodification at all.

This issue is not isolated just to my Server either. Two other Servers I do developer work for also suffer from this. They both use the Workshop Versions of DarkRP and PAC3, no modifications to the addons themselves, hooking in via a standalone addon, not darkrpmodification etc.

If you need any more information, please let me know, I'll be happy to help.

FPtje commented 9 years ago

DarkRP overrides ply:Name(), ply:Nick() and ply:GetName(). It does that here: https://github.com/FPtje/DarkRP/blob/master/gamemode/modules/base/sh_entityvars.lua#L102

The problem with overriding ply:Nick(), is that calling it with NULL would cause an error in DarkRP code. People would always blame it on me. That's why I made it so simplerr throws an error when you do that.

The error can be reproduced as follows:

The problem lies with PAC3. It simply requests the name of a player that doesn't exist (anymore).

The offending line is

lua/pac3/editor/server/wear.lua on line 288
FPtje commented 9 years ago

https://github.com/CapsAdmin/pac3/issues/177

Hazbelll commented 9 years ago

Alright, thanks for the clarification. I was unsure on whether I should've reported the issue here or at PAC3's Repo first, but I thought I'd start here as it was mostly Simplerr throwing the errors whilst everything else continued fine, other than the odd PAC "Wear" breakage.

Nevertheless, thank you again.

Cynosphere commented 9 years ago

PAC is a SANDBOX ADDON FOR A REASON PEOPLE

Hazbelll commented 9 years ago

I can understand that, but people like having PAC on DarkRP servers so they can customise their Playermodels out to be their Roleplay Characters, which is why my and many other Servers offer it, not to mention, PAC's just great fun in itself.

I don't believe this use to be an issue either. I think it's since the re-introduction of Facial Flexes it's come around, not saying Facial Flexes themselves are the cause, just that's when we've noticed it's become a problem, regarding hooking into it.

FPtje commented 9 years ago

I don't understand it, especially since DarkRP is a sandbox gamemode.

Hazbelll commented 9 years ago

Exactly, good point. DarkRP itself is a derivative of Sandbox.

CapsAdmin commented 9 years ago

And I support PAC3 (or at least try to) outside of sandbox as well.