Skip to content

Commit

Permalink
ai mech remote static stuff
Browse files Browse the repository at this point in the history
basically there's some horrible interactions between camera static and eyeobjs not moving which mech remoting does, so I did a little bit of hacky colinking movements and this should make it better :)
  • Loading branch information
DeltaFire15 committed Dec 12, 2024
1 parent 05dcf94 commit 341c3b6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
8 changes: 8 additions & 0 deletions code/game/mecha/mecha.dm
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,13 @@
. = ..()
if(.)
events.fireEvent("onMove",get_turf(src))
//NSV13 - hacky AI fixes
if(silicon_pilot)
var/mob/living/silicon/ai/aipilot = occupant //qed
if(isAI(aipilot)) //safety
aipilot?.eyeobj?.setLoc(get_turf(src), FALSE, null, TRUE) //Ok so basically we NEED our eyeobj to move so our camera chunks update or the mech pilot has a bad time.
aipilot?.update_camera_location() //Ok so basically we NEED to update the AI core camera here because it doesn't get "moved" normally due to contents.
//NSV13 end.
if (internal_tank?.disconnect()) // Something moved us and broke connection
occupant_message("<span class='warning'>Air port connection teared off!</span>")
log_message("Lost connection to gas port.", LOG_MECHA)
Expand Down Expand Up @@ -809,6 +816,7 @@
to_chat(user, "<span class='boldnotice'>Transfer successful</span>: [AI.name] ([rand(1000,9999)].exe) installed and executed successfully. Local copy has been removed.")
card.AI = null
ai_enter_mech(AI, interaction)
card.update_icon() //NSV13 - make card look empty.

//Hack and From Card interactions share some code, so leave that here for both to use.
/obj/mecha/proc/ai_enter_mech(mob/living/silicon/ai/AI, interaction)
Expand Down
4 changes: 2 additions & 2 deletions code/modules/mob/living/silicon/ai/freelook/eye.dm
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@
// Use this when setting the ai_eye's location.
// It will also stream the chunk that the new loc is in.

/mob/camera/ai_eye/proc/setLoc(destination, force_update = FALSE, dir) //NSV13 - AI Custom Holographic Form
/mob/camera/ai_eye/proc/setLoc(destination, force_update = FALSE, dir, ai_mecha_override) //NSV13 - AI Custom Holographic Form || also AI mecha fixes - basically we need the fourth arg to ONLY allow the mecha AI movement and lock normal actions.
if(ai)
if(!isturf(ai.loc))
if(!isturf(ai.loc) && (!ismecha(ai.loc) || !ai_mecha_override)) //NSV13 - hacky ancient bugfixes (eye needs moving even if core is mech'd to update cam chunks).
return
destination = get_turf(destination)
if(!force_update && (destination == get_turf(src)) )
Expand Down
2 changes: 2 additions & 0 deletions nsv13/code/__HELPERS/overmap.dm
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ Helper method to get what ship an observer belongs to for stuff like parallax.
*/

/mob/proc/update_overmap()
if(!loc) //Being deleted or cursed things.
return
var/obj/structure/overmap/OM = loc.get_overmap() //Accounts for things like fighters and for being in nullspace because having no loc is bad.
if(OM == last_overmap)
return
Expand Down

0 comments on commit 341c3b6

Please sign in to comment.