Spidertron control help

Place to get help with not working mods / modding interface.
cal12345
Manual Inserter
Manual Inserter
Posts: 3
Joined: Mon Sep 02, 2024 4:39 pm
Contact:

Spidertron control help

Post by cal12345 »

Helloo

Im making a mod that allows you to link into a Spidertron remotely - controlling it with WASD, being able to craft, and interact with the world like an engineer - but the engineer stays in one place

1. The mod successfully puts the player into Spidertron drivers seat but doesn't give control over the weapons.

Ive tried many options to force set driver_is_gunner = true but never seem to get this to work.

Entering the Spidertron normally works fine.

2. Also have an issue when switching to the Spidertron it creates an inventory as if the player was opening the gui - when switching back to the player - the items in the inventory are lost.

At this point I can imagine this hasn't been done yet because it can't be done

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3713
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Spidertron control help

Post by DaveMcW »

First you need to create a dummy gunner.

Code: Select all

/c
spidertron = game.player.selected
global.gunner = spidertron.surface.create_entity{
  name = "character",
  force = spidertron.force,
  position = spidertron.position
}
spidertron.set_passenger(global.gunner)
spidertron.driver_is_gunner = false
Then you give the gunner a target.

Code: Select all

/c 
enemy = game.player.selected
global.gunner.shooting_state = {state=defines.shooting.shooting_enemies, position=enemy.position}
When you are done, you should clean up the dummy gunner.

Code: Select all

/c
global.gunner.destroy()

cal12345
Manual Inserter
Manual Inserter
Posts: 3
Joined: Mon Sep 02, 2024 4:39 pm
Contact:

Re: Spidertron control help

Post by cal12345 »

This still didn't allow the player to use the weapons but did set me on the right track

I created a dummy engineer to transfer the player into and teleported them into the driving seat. Allowing the player to control the weapons as well

Thank you!

Post Reply

Return to “Modding help”