def Torque(car):
rpm = car["rpm"]
maxrpm = car["specs"]["maxrpm"]
torque = car["specs"]["torque"]
health = car.get("health", 1)
if car.get("nitroing"):
return torque * 10
return math.sin((rpm/maxrpm*(math.pi/4*3))+math.pi/4) * torque * health
def GenerateDoorObject(i):
doorObject = {"ClosedRotX":i.get("ClosedRotX", i.orientation.to_euler()[0]),
"ClosedRotY":i.get("ClosedRotY", i.orientation.to_euler()[1]),
"ClosedRotZ":i.get("ClosedRotZ", i.orientation.to_euler()[2]),
"OpenRotX":i.get("OpenRotX", i.orientation.to_euler()[0]),
"OpenRotY":i.get("OpenRotY", i.orientation.to_euler()[1]),
"OpenRotZ":i.get("OpenRotZ", i.orientation.to_euler()[2]),
"ClosedLocX":i.get("ClosedLocX", i.position[0]),
"ClosedLocY":i.get("ClosedLocY", i.position[1]),
"ClosedLocZ":i.get("ClosedLocZ", i.position[2]),
"door": i
}
move = [0,0,0]
moveback = [0,0,0]
for naxis, axis in enumerate(["X", "Y", "Z"]):
code = "OpenLoc"+axis
move[naxis] = i.get(code, 0)
moveback[naxis] = -i.get(code, 0)
i.applyMovement(move, True)
for naxis, axis in enumerate(["X", "Y", "Z"]):
code = "OpenLoc"+axis
doorObject[code] = i.position[naxis]
i.applyMovement(moveback, True)
return doorObject
def RegisterObject(object, precision, delete=True):
addr = Address(object.position, precision)
if addr not in chunks:
chunks[addr] = {"loaded":False,
"objects":[]}
virtualObject = {}
virtualObject["name"] = object.name
virtualObject["position"] = object.position.copy()
virtualObject["orientation"] = object.orientation.to_euler()
virtualObject["scaling"] = object.scaling.copy()
for i in object.blenderObject.game.properties:
virtualObject[i.name] = i.value
chunks[addr]["objects"].append(virtualObject)
if delete:
object.endObject()
return virtualObject
after = race.get("after")
during = race.get("during")
duringcheck = dani.get("race") == after and Script.Story.get(during)
aftercheck = duringcheck or after in Script.Story["passed"] or not after
if ( not dani.get("race") and aftercheck and Money.Have(bid)) or duringcheck:
Map.Show(race["starters"][0]["location"], icon="Map_Circle", color=[0.01,0.01,1], ID=racename)
if not race["started"] and ( ( not dani.get("race") and Money.Have(bid) ) or duringcheck ) and race["racers"] and aftercheck:
{"TheRacetrack":{
"object":scene.objects["TheRacetrack"],
"high":"TheRacetrackHigh",
"radius":1000,
"now":"high",
"name":"Papses Racetrack"
},
"TheCity":{
"object":scene.objects["TheCity"],
"high":"TheCityHigh",
"radius":1500,
"now":"high",
"name":"Dune Town"
},
"TheHouse":{
"object":scene.objects["TheHouse"],
"high":"TheHouseGood",
"low":"TheHouseBorked",
"parent":"TheCity",
"radius":200,
"now":"high",
"name":"Looparound 8\nDani's Home"
},
"HallwayPictures":{
"object":scene.objects["HallwayPictures"],
"high":"HallwayPictures",
"parent":"TheHouse",
"radius":180,
"now":"high"
},
"Computer":{
"object":scene.objects["Computer"],
"high":"Computer",
"parent":"TheHouse",
"radius":180,
"now":"high"
},
"Just3000Wreck":{
"object":scene.objects["Just3000Wreck"],
"high":"Just3000Wreck",
"parent":"TheHouse",
"radius":180,
"now":"high"
},
"KartingTrack":{
"object":scene.objects["KartingTrack"],
"high":"KartingTrack_High",
"low":"KartingTrack_Low",
"parent":"TheCity",
"radius":200,
"now":"high",
"name":"Karting Track"
},
"Karting_Decorations":{
"object":scene.objects["Karting_Decorations"],
"high":"Karting_Decorations",
"parent":"KartingTrack",
"radius":180,
"now":"high"
},
"KartingGamesCollider":{
"object":scene.objects["KartingGamesCollider"],
"high":"KartingGamesCollider",
"parent":"KartingTrack",
"radius":180,
"now":"high"
},
"KartingGamesObject":{
"object":scene.objects["KartingGamesObject"],
"high":"KartingGamesObject",
"parent":"KartingTrack",
"radius":180,
"now":"high"
},
"PoliceStation":{
"object":scene.objects["PoliceStation"],
"high":"PoliceStationHigh",
"low":"PoliceStationLow",
"parent":"TheCity",
"radius":180,
"now":"high",
"name":"Police Station"
},
"PoliceStation_Ghost":{
"object":scene.objects["PoliceStation_Ghost"],
"high":"PoliceStation_Ghost",
"parent":"PoliceStation",
"radius":180,
"now":"high"
},
}