Jump to content
Sign in to follow this  
baldwin

Correct engine menu. (Host only)

Recommended Posts

baldwin

--Correct engine menu by baldwin, originally posted on http://pirateperfection.com/

--You can share on other forums only with proper credits and site link above.

--Same rule applies to modified, decompiled/early leaked versions of this script.



if managers.job:current_level_id() ~= "welcome_to_the_jungle_2" then return end --This will work only in Big Oil day 2



local function interactbytweak_ex( key, tweak, alt )

  if not key or not tweak then

    return

  end

  local player = managers.player:local_player()

  if not player then

    return

  end

  for _,unit in pairs(managers.interaction._interactive_objects) do

    if unit.interaction then

      if key == 0 and unit:interaction().tweak_data == tweak and unit.carry_data and unit:carry_data():carry_id() == alt then

        unit:interaction():interact( player )

        return true

      end

      if unit:interaction().tweak_data == tweak and unit:name():key() == key then

        unit:interaction():interact( player )

        return true

      end

    end

  end

end



local function find_engine()

  local script = managers.mission:script("default")

  local fusion_engine = script._elements[103718]._values.on_executed[1].id

  local table_t = { 

    ["103717"] = "engine_12", ["103716"] = "engine_11", ["103715"] = "engine_10", ["103714"] = "engine_09", ["103711"] = "engine_08", ["103709"] = "engine_07", ["103708"] = "engine_06", ["103707"] = "engine_05", ["103706"] = "engine_04", ["103705"] = "engine_03", ["103704"] = "engine_02", ["103703"] = "engine_01" 

  }

  local table_k = {

    engine_01 = 'f0e7a7f29fc87c44', engine_02 = 'db218f98a571c0b1', engine_03 = 'c717770fadc88e04', engine_04 = '5fb0a3191c4b8202', engine_05 = '0b2ecebcf49765b9', engine_06 = 'b531a6b7026ad84f', engine_07 = 'e191b6d86e655e23', engine_08 = '5aabe6e626f00bd4', engine_09 = '5afbe85d94046cbe', engine_10 = '9f316997306803b9', engine_11 = 'b2560b63edcda138', engine_12 = 'ee644ab092313077', --v=xE23YXNGkKE,

  }

  local ret = table_t[tostring(fusion_engine)]

  if ret then

    return ret, table_k[ret]

  end

  return ""

end



local function SpawnBag(id)

  local player = managers.player:local_player()

  if not alive(player) then

    return

  end

  local pos = player:position() + Vector3(0,0,100)

  local rot = player:rotation()

  if Network:is_client() then --Are you sure you want to spawn that as client ?

    managers.network:session():send_to_host( "server_drop_carry", id, 1, true, true, 1, pos, rot, Vector3(0,0,0), 100, nil)

  else

    managers.player:server_drop_carry(id, 1, true, true, 1, pos, rot, Vector3(0,0,0), 100, nil)

  end

end



local menu_c = {

  { text = "Quit", is_cancel_button = true },

  { },

  { text = "Print correct engine into console", callback = function()

      local e = find_engine()

      if Network:is_server() and e ~= "" then 

        io.stderr:write("Correct engine is "..e.."

")

      end

    end },

  { text = "Show correct engine on hud", callback = function()

    local e = find_engine()

    if Network:is_server() and e ~= "" then 

      show_mid_text(e, "Correct engine", 3) 

    end

  end },

  { text = "Spawn correct engine(Host only)", callback = function()

      local e = find_engine()

      if Network:is_server() and e ~= "" then 

        SpawnBag(find_engine())

        return

      end

    end },

  { text = "Pickup correct engine", callback = function() 

    local e,k = find_engine()

    if e == "" then

      return

    end

    local found = interactbytweak_ex(k, "gen_pku_fusion_reactor")

    if not found then

      interactbytweak_ex(0, "carry_drop", e)

    end

  end },

}



local menu = SimpleMenu:new('Correct engine menu', 'Choose what you want to do', menu_c)



menu:show()

Enjoy noobing big oil day 2 :)

  • Upvote 1

Share this post


Link to post
Share on other sites
PirateCaptain

excellent work :arrr::arrr: :arrr:

Share this post


Link to post
Share on other sites
ITStheNELSON

Isnt this a donor perk ?

Share this post


Link to post
Share on other sites
PirateCaptain

Isnt this a donor perk ?

nothing lasts forever, and donors will get something else to call their own dont worry :)

Share this post


Link to post
Share on other sites
ITStheNELSON

No i was just asking now i can add to my custom one haha

Share this post


Link to post
Share on other sites
PirateCaptain

No i was just asking now i can add to my custom one haha

or just use the one in your donor menu already :)

this one is extra noob friendly though hats off to baldwin fun twist :popcorn:

Share this post


Link to post
Share on other sites
ITStheNELSON

No i mean the custom one i am making

Share this post


Link to post
Share on other sites
MitchellFarted

No i mean the custom one i am making

If this is posted in the public code section, and planned to be put in the public release, I'm pretty sure you're safe to put it in your custom version.

Share this post


Link to post
Share on other sites
Guest

If this is posted in the public code section, and planned to be put in the public release, I'm pretty sure you're safe to put it in your custom version.

Just don't forget to give Baldwin, credits if you end up releasing it to an audience of any kind.

Share this post


Link to post
Share on other sites
claytonomore

Where would a suitable place be to place this code? Would I just copy and paste this into one of the test scripts in the trainer folder?

Share this post


Link to post
Share on other sites
Ducky

Where would a suitable place be to place this code? Would I just copy and paste this into one of the test scripts in the trainer folder?

A safe place, whenever you want to just throw in a random script to try out, is always Num7. That's my goto whenever I want to put in something new to see if I like it.

Share this post


Link to post
Share on other sites
claytonomore

A safe place, whenever you want to just throw in a random script to try out, is always Num7. That's my goto whenever I want to put in something new to see if I like it.

Many thanks mate

Share this post


Link to post
Share on other sites
iTriforce

Bumping, Please someone help me! :crew:

Share this post


Link to post
Share on other sites
MitchellFarted

Where do i paste this code?

I don't know the structure of PPR, but the basic idea would be to put it into it's own LUA file and bind it to a key. You could also add it to another script and edit an option in the menu for that script for it.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Stop being a peeping tom and join the community.... we got cookies

Join the crew now

Sign in

Already part of the crew? Board right here

Sign In Now
Sign in to follow this  

×