ACF-Team / ACF-3

ACF
MIT License
68 stars 56 forks source link

[BUG] Engines are completely broken #400

Closed dobriyprop closed 7 months ago

dobriyprop commented 7 months ago

Short Description

Whenever you try to start an engine - ACF crashes with an error

Branch and Version

Git-dev-f8ee62a

Console Error Logs (Optional)

Starfall acfSetActive() crash

starfall] Warning! A net message (ACF_Sounds_AdjustableCreate) is already started! Discarding in favor of the new message! (starfall_error)
  1. SendError - addons/starfall/lua/starfall/transfer.lua:113
   2. Error - addons/starfall/lua/entities/starfall_processor/shared.lua:141
    3. runOnError - addons/starfall/lua/entities/starfall_processor/shared.lua:49
     4. Error - addons/starfall/lua/starfall/instance.lua:774
      5. runScriptHook - addons/starfall/lua/starfall/instance.lua:634
       6. v - addons/starfall/lua/starfall/sflib.lua:744
        7. unknown - lua/includes/modules/hook.lua:96

Hook 'tick' errored with: addons/acf-3-dev/lua/acf/core/utilities/sounds/sounds_sv.lua:38: bad argument #1 to 'WriteString' (string expected, got function)
stack traceback:
    [C]: in function 'WriteString'
    addons/acf-3-dev/lua/acf/core/utilities/sounds/sounds_sv.lua:38: in function 'CreateAdjustableSound'
    addons/acf-3-dev/lua/entities/acf_engine/init.lua:634: in function 'UpdateSound'
    addons/acf-3-dev/lua/entities/acf_engine/init.lua:200: in function 'SetActive'
    addons/acf-3-dev/lua/entities/acf_engine/init.lua:577: in function 'Action'
    addons/acf-3-dev/lua/entities/acf_base_simple/init.lua:133: in function 'TriggerInput'
    starfall/libs_sh/acffunctions.lua:930: in function 'acfSetActive'
    SF:libs/xinput_car_controller_lib.txt:249: in function <SF:libs/xinput_car_controller_lib.txt:247>

Wiremod inputs crash

[ACF - Info] Successfully linked Petrol Tank[ID: 1157] to 1.4L Flat 4 Petrol[ID: 1171].
Wire error (Entity [1171][acf_engine] by Player [1][dobriy]):
addons/acf-3-dev/lua/acf/core/utilities/sounds/sounds_sv.lua:38: bad argument #1 to 'WriteString' (string expected, got function)
stack traceback:
    [C]: in function 'WriteString'
    addons/acf-3-dev/lua/acf/core/utilities/sounds/sounds_sv.lua:38: in function 'CreateAdjustableSound'
    addons/acf-3-dev/lua/entities/acf_engine/init.lua:634: in function 'UpdateSound'
    addons/acf-3-dev/lua/entities/acf_engine/init.lua:200: in function 'SetActive'
    addons/acf-3-dev/lua/entities/acf_engine/init.lua:577: in function 'Action'
    addons/acf-3-dev/lua/entities/acf_base_simple/init.lua:133: in function <addons/acf-3-dev/lua/entities/acf_base_simple/init.lua:124>
    [C]: in function 'xpcall'
    addons/wire/lua/wire/server/wirelib.lua:82: in function 'TriggerInput'
    addons/wire/lua/wire/server/wirelib.lua:662: in function 'Wire_TriggerOutput'
    addons/wire/lua/entities/gmod_wire_button.lua:172: in function 'Switch'
    addons/wire/lua/entities/gmod_wire_button.lua:98: in function <addons/wire/lua/entities/gmod_wire_button.lua:83>

[wire] Warning! A net message (ACF_Sounds_AdjustableCreate) is already started! Discarding in favor of the new message! (wire_clienterror)
  1. ClientError - addons/wire/lua/wire/wireshared.lua:303
   2. TriggerInput - addons/wire/lua/wire/server/wirelib.lua:88
    3. Wire_TriggerOutput - addons/wire/lua/wire/server/wirelib.lua:662
     4. Switch - addons/wire/lua/entities/gmod_wire_button.lua:172
      5. unknown - addons/wire/lua/entities/gmod_wire_button.lua:98

sv: Wire error (Entity [1171][acf_engine] by Player [1][dobriy]):
addons/acf-3-dev/lua/acf/core/utilities/sounds/sounds_sv.lua:38: bad argument #1 to 'WriteString' (string expected, got function)
stack traceback:
    [C]: in function 'WriteString'
    addons/acf-3-dev/lua/acf/core/utilities/sounds/sounds_sv.lua:38: in function 'CreateAdjustableSound'
    addons/acf-3-dev/lua/entities/acf_engine/init.lua:634: in function 'UpdateSound'
    addons/acf-3-dev/lua/entities/acf_engine/init.lua:200: in function 'SetActive'
    addons/acf-3-dev/lua/entities/acf_engine/init.lua:577: in function 'Action'
    addons/acf-3-dev/lua/entities/acf_base_simple/init.lua:133: in function <addons/acf-3-dev/lua/entities/acf_base_simple/init.lua:124>
    [C]: in function 'xpcall'
    addons/wire/lua/wire/server/wirelib.lua:82: in function 'TriggerInput'
    addons/wire/lua/wire/server/wirelib.lua:662: in function 'Wire_TriggerOutput'
    addons/wire/lua/entities/gmod_wire_button.lua:172: in function 'Switch'
    addons/wire/lua/entities/gmod_wire_button.lua:98: in function <addons/wire/lua/entities/gmod_wire_button.lua:83>

How to Reproduce (Optional)

1) Spawn an engine 1.1) [Optionaly] Link and activate fueltank 2) Spawn a button. Attach engine's Active wire input to buttons wire output 3) Press the button 4) Engine crashes

Screenshots (Optional)

Starfall acfSetActive() crash

acf-starfall-crash.webm

Wiremod inputs crash

acf-wiremod-crash.webm

Additional Information (Optional)

Might be related to the latest attempt to fix engine sounds not playing after you do startup-shutdown sequence once and start engine again.

TwistedTail commented 7 months ago

Should be fixed now, could you give it a look if everything works fine on your end aswell?

dobriyprop commented 7 months ago

Seems like the fix is working. And the issue with engine sounds stop working after 1 startup-shutdown cycle is no longer present. I've tested both in single player and on dedicated server.

2024-04-13_11-54.webm

Minor thing - for some reason on dedicated server ACF misreports Client version изображение

thecraftianman commented 7 months ago

Oops sorry lol, this was because of this typo I made while fixing the other issue

Minor thing - for some reason on dedicated server ACF misreports Client version

Afaik this has been a thing forever. Imo @TwistedTail we should just remove the Client Status section entirely since only the server version actually matters. Might be more productive to replace it with the ability to add tabs for any repositories so that the Missiles, etc. versions can be viewed from the menu as well.