Page 1 of 1

Spidertron control help

Posted: Mon Sep 02, 2024 7:06 pm
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

Re: Spidertron control help

Posted: Mon Sep 02, 2024 10:40 pm
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()

Re: Spidertron control help

Posted: Tue Sep 03, 2024 3:42 pm
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!