Star Citizen: Bugsmashers! - Insurance Inferance
Transcript — every row opens the video at that moment
- 00:00:06
[Music] everyone welcome to the show I'm mark - he had to bring in it are setting up to the bug smashers nope this one's a splashers episode you know what kind of time for this I'm going to my trailer Wow well since mark gaben so rudely didn't ask this episode is about another exciting insurance bug let's get slashing alright so as I probably said in the intro we've got another insurance bug today this one involving ships inside ships so as you can see I've got my cyclone here very
- 00:00:56
tightly parked in the back of my Cutlass this would happen with any ships but this is specifically the Reaper case I need to test so what happens if we make a claim on this Cutlass when we have a cyclone or an ox or any other thing stored in the back we make a claim on the cut list the ship inside or the vehicle inside just gone forever so to show you in the current state how it looks when it's busted we fly over here to this ESOP terminal and you'll see I've got two cyclones one of them is out on the pan the other one is stored so there's two in there we've got this parked out here now what I need to do is go to Alice R and now we're gonna make a claim on that Cutlass
- 00:01:51
and I'm just flying in here to save time make it real quick there we go one on Shubin make a claim filed claim alright cool so that has been filed we're gonna go back to ship it and we're not gonna quantum travel because we don't want this video to be 30 minutes and voila there is only one cyclone here so the one inside is gone forever now really unfortunate so how about I break down why this is happening
- 00:02:39
so you guys won't have to worry about losing your ships so we're gonna hop into the code here this is in the insurance system and in fact this is so four scroll up the function is process claim to next step and we're particularly concerned with this callback that we have in here called our entitlement exchange callback so there's actually a different bug in the past where ships that let me see if I could recall this correctly basically ships that you bought or added to your account after a database have been set up we're not insurable ships just so to fix this problem we needed to have this entitlement exchange where basically we're like alright this old ship is now
- 00:03:26
the new one and switch all the web information so everything is properly routed so this is the final step of insurance once we made this exchange and to make sure that everything has happened properly we will we now are tracking two ships we have your old ship the one that got destroyed or abandoned or whatever and the new ship that insurance is just given you so the old ship we need to take this and say legally no longer belongs to you when you clean it up get rid of it because you've got your new ship from insurance so what we do is we do a change legal owner for entity right here and we're doing that on the old entity we're gonna remove it from your legal ownership and then for a good measure if the ship isn't spawn this old one we're gonna remove it right away from persistance this is what we were
- 00:04:17
currently doing and this is why the bug is happening is what we need to fix so the crux of the issue here is if we inspect a change legal owner for entity we've got in our persistent data manager we've got a couple things going on here but basically if we change the legal ownership of the ship we're also changing the legal ownership of everything so all of the doors on the ship all of the windows turrets everything that is a child of the ship the legal ownership of those things need to change as well so like I legally own the ship which means I also legally own all the stuff inside so this is where the problem comes in because the old ship still has your cyclone in it we have now changed the legal ownership of that cyclone to be
- 00:05:05
the universe it's not owned by you anymore which is why it will not show up in your ESOP terminals now technically in the persistent database it is still there but it is actually not not legally owned by you there's several types of ownership but that is the one of the ESOP ternal cares about so we need to fix this so if we hop back here we are going to delete these two lines of code here and there is one fun tonight I have not filled out yet but what we're going to fill out in this video so we're gonna call this function called clean up old ensured entity and we're going to do that with the old entity ID and we're going to do that with contained oh I think I called it yes okay
- 00:05:59
all right so if we inspect this function here it should be totally empty because we're going to implement it here on camera all right there we go so what we need to do in this new function is similar to before we need to change the legal ownership of the old ship the one that we're getting rid of that I no longer own however what we need to do within afterwards for every ship inside this vehicle we need to loop or if every vehicle inside the ship we're claiming on we need to look at each of those and then change its legal ownership back to being the player because remember because everything is like a tree structure vehicles inside the other one
- 00:06:48
would get legally changed too so we're gonna let them get changed and then we're just gonna change them back to beat the player that made the claim so if I just bring up my reference code over here the first thing we need to do is grab a reference to our persistent data manager all right now once we have that there's gonna be a couple things that we need to do the first thing is we need to determine if our ship has been spawned
- 00:07:37
yet the reason this is important is because there's actually two cases we need to do different things for based on if the ship is still around when we claim insurance or if it's been despondent if it's still sticking around in our entity system all righty now the next step something that we were already doing before and I'm just going to copy and paste this for the sake of
- 00:08:24
time is we need to change the legal ownership of the route of the old ship we're already doing this before so it still needs to be our first step here but now that we've changed the ownership we need to go back and change the legal ownership for the ships that were inside it so they still show up in our Aesop terminal way we do that is we need to loop over every ship that we have stored by the way I didn't mention this earlier but this this list here it's a vector of contained vehicles this is actually Cota added just before we started this video but basically when we do a query earlier up in the call stack we needed to grab the vehicle anyway from persistence so we just slightly changed that argument so not only grab the vehicle but it would grab all the items inside it that are also of a vehicle type small change
- 00:09:13
I made before this just not showing it in the video right now okay so what we need to do is we need to iterate over all these contained vehicles so we'll do that here for the programmers in the audience this will look a little weird to you because I am setting this I to start at one and the reason we're doing that is because in this list of vehicles the first one is the vehicle itself the Cutlass so we want to ignore that the Cutlass is not inside itself we've already changed this legal ownership so don't worry about that so we're gonna start at one or start at I and so what we're doing here is we're
- 00:10:15
changing its legal ownership of all of the contained ships to be what their previous owner was this will look a little funny because it looks like we're setting it's legal owner to what its legal owner is that it's just because this data is cached from before we did this change up here so setting it back to what it was before that's the important thing all right so this is really just the core of what we needed to fix this bug is just this little for loop here however there is one other thing that we need to do while we're in here in this for loop we want to check if the ship is D spawned and I'm going to copy and paste this code just for sake of time so we have one check if our ship is D spawned now I mentioned before we have different types of ownership in the game
- 00:11:04
legal ownership and physical ownership for a variety of reasons we also want to change the items physical ownership if it's not spawned this is so what you'll see in a moment so we're moving persistent items parent we're gonna change that and the reason for that is after the for loop you'll remember the code that we deleted you had before we need to remove the old chip from persistence only if it's D spawned so we just tack that on the end here and what this will do is it will not remove the ship's inside the ships from persistence it's let's see if I've worded that properly your cyclone or your NOx or whatever is in your Cutlass we've
- 00:11:51
changed the legal ownership however if the ship was despond we were also gonna remove it anyway with this code we had this code before so we need to prevent that too so there's really two things we need to prevent here legal ownership and physical ownership just happens to be physical ownership in this case only matters if the ship is not spawned great okay so this is all of the code we're actually gonna need to make this work we just filled up this clean up old ensured entity function and remember we called that from the broader entitlement exchange function back here so this is really last step of getting you a brand new ship when you claim insurance so we're gonna do now is we're gonna build what should take about five years and I'll get back to you then and we'll show you this bug hopefully should be gone okay so we're back in game now we've got the
- 00:12:40
cyclone in our Cutlass I'm gonna go through the same repro steps that I did in the beginning and we're gonna see if hopefully we don't lose this forever all right so we're just gonna fly over here back to the terminal just so we could show that we've got a yep we've got two Cyclones there ones on the pad cool all right so we're gonna go to all sorry let's make a claim I'm stuck oh okay we're unstuck we're on stuck damn hang on
- 00:13:31
keep this in keep this in all right Justin oh god they say I pushed me around okay all right all right now we're doing it um so here's our Cutlass right where we left it let's make a claim all right now now we now we see Shubin yeah Shubin all right and there's both of our
- 00:14:19
cyclones we didn't lose it forever so to recap we needed to after changing the legal ownership of our Cutlass we needed to go in and look at all the vehicles inside our Cutlass and change the legal ownership of those back to our player who owns the who owned the Cutlass that way they're not lost forever our insurance terminal and that about wraps it up time to check back in with mark so as you guys saw we had a fun little insurance claim bug we're to ship in a ship but unlike dealing with those pesky insurance companies we just said hey developer let's go fix it what aren't you bad right yeah insurance no problem 1/6 the US economy solved the Atlantic a few lines of code easy fix done and done well hope you guys enjoyed until next time bug Smasher bug flashers Smasher Smasher
- 00:15:11
go to my trailer you thanks for watching for the latest and greatest in star citizen squadron 42 you can subscribe to our Channel or you can check out some of the other shows and you can also head to our website at www.uvu.edu/library
Transcript from YouTube’s automatic captions — punctuation and Star Citizen jargon are approximate. The video itself is hosted by CIG on the official channel.

