Mass commit
This commit is contained in:
@@ -28,7 +28,7 @@ addEventHandler("OnFocus", function(event) {
|
||||
if(gta.game != GAME_GTA_SA) {
|
||||
gta.setCiviliansEnabled(true);
|
||||
}
|
||||
gta.setTrafficEnabled(true);
|
||||
gta.setTrafficEnabled(true);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -45,11 +45,11 @@ function renderPropertyEntranceLabel(name, position, locked, isBusiness, price)
|
||||
if(propertyLabelNameFont == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if(propertyLabelLockedFont == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if(localPlayer.position.distance(position) > 7.5) {
|
||||
return false;
|
||||
}
|
||||
@@ -62,9 +62,9 @@ function renderPropertyEntranceLabel(name, position, locked, isBusiness, price)
|
||||
if(price > 0) {
|
||||
text = `For sale: $${price}`;
|
||||
let size = propertyLabelLockedFont.measure(text, game.width, 0.0, 0.0, propertyLabelLockedFont.size, true, true);
|
||||
propertyLabelLockedFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelLockedFont.size, toColour(0, 150, 0, 255), false, true, false, true);
|
||||
|
||||
screenPosition.y -= 18;
|
||||
propertyLabelLockedFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelLockedFont.size, toColour(0, 150, 0, 255), false, true, false, true);
|
||||
|
||||
screenPosition.y -= 18;
|
||||
}
|
||||
|
||||
text = (locked) ? "LOCKED" : "UNLOCKED";
|
||||
@@ -73,13 +73,13 @@ function renderPropertyEntranceLabel(name, position, locked, isBusiness, price)
|
||||
}
|
||||
|
||||
let size = propertyLabelLockedFont.measure(text, game.width, 0.0, 0.0, propertyLabelLockedFont.size, true, true);
|
||||
propertyLabelLockedFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelLockedFont.size, (locked) ? lockedColour : unlockedColour, false, true, false, true);
|
||||
propertyLabelLockedFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelLockedFont.size, (locked) ? lockedColour : unlockedColour, false, true, false, true);
|
||||
|
||||
screenPosition.y -= 22;
|
||||
|
||||
text = name || " ";
|
||||
size = propertyLabelNameFont.measure(text, game.width, 0.0, 0.0, propertyLabelNameFont.size, true, true);
|
||||
propertyLabelNameFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelNameFont.size, (isBusiness) ? toColour(0, 153, 255, 255) : toColour(17, 204, 17, 255), false, true, false, true);
|
||||
propertyLabelNameFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelNameFont.size, (isBusiness) ? toColour(0, 153, 255, 255) : toColour(17, 204, 17, 255), false, true, false, true);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -92,11 +92,11 @@ function renderPropertyExitLabel(position) {
|
||||
if(propertyLabelNameFont == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if(propertyLabelLockedFont == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if(localPlayer.position.distance(position) > 7.5) {
|
||||
return false;
|
||||
}
|
||||
@@ -107,7 +107,7 @@ function renderPropertyExitLabel(position) {
|
||||
|
||||
let text = "EXIT";
|
||||
size = propertyLabelNameFont.measure(text, game.width, 0.0, 0.0, propertyLabelNameFont.size, true, true);
|
||||
propertyLabelNameFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelNameFont.size, COLOUR_WHITE, false, true, false, true);
|
||||
propertyLabelNameFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelNameFont.size, COLOUR_WHITE, false, true, false, true);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -120,11 +120,11 @@ function renderJobLabel(name, position, jobType) {
|
||||
if(jobNameLabelFont == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if(jobHelpLabelFont == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if(localPlayer.position.distance(position) > 7.5) {
|
||||
return false;
|
||||
}
|
||||
@@ -149,13 +149,13 @@ function renderJobLabel(name, position, jobType) {
|
||||
}
|
||||
|
||||
let size = jobHelpLabelFont.measure(text, game.width, 0.0, 0.0, jobHelpLabelFont.size, true, true);
|
||||
jobHelpLabelFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, jobHelpLabelFont.size, COLOUR_YELLOW, false, true, false, true);
|
||||
jobHelpLabelFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, jobHelpLabelFont.size, COLOUR_YELLOW, false, true, false, true);
|
||||
|
||||
screenPosition.y -= 18;
|
||||
|
||||
text = name + " Job";
|
||||
size = jobNameLabelFont.measure(text, game.width, 0.0, 0.0, jobNameLabelFont.size, true, true);
|
||||
jobNameLabelFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, jobNameLabelFont.size, COLOUR_WHITE, false, true, false, true);
|
||||
jobNameLabelFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, jobNameLabelFont.size, COLOUR_WHITE, false, true, false, true);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -182,14 +182,14 @@ addEventHandler("OnDrawnHUD", function (event) {
|
||||
case AG_LABEL_HOUSE:
|
||||
renderPropertyEntranceLabel(pickups[i].getData("ag.label.name"), pickups[i].position, pickups[i].getData("ag.label.locked"), false, price);
|
||||
break;
|
||||
|
||||
|
||||
case AG_LABEL_JOB:
|
||||
renderJobLabel(pickups[i].getData("ag.label.name"), pickups[i].position, pickups[i].getData("ag.label.jobType"));
|
||||
break;
|
||||
|
||||
case AG_LABEL_EXIT:
|
||||
renderPropertyExitLabel(pickups[i].position);
|
||||
break;
|
||||
break;
|
||||
}
|
||||
//}
|
||||
//}
|
||||
|
||||
@@ -72,6 +72,9 @@ bindEventHandler("onResourceStart", thisResource, function(event, resource) {
|
||||
gta.setCiviliansEnabled(false);
|
||||
}
|
||||
|
||||
// Run garbage collector every minute
|
||||
garbageCollectorInterval = setInterval(collectAllGarbage, 1000*60);
|
||||
|
||||
addNetworkHandler("ag.passenger", enterVehicleAsPassenger);
|
||||
});
|
||||
|
||||
@@ -338,6 +341,12 @@ function processEvent(event, deltaTime) {
|
||||
}
|
||||
});
|
||||
|
||||
getElementsByType(ELEMENT_PICKUP).forEach(function(pickup) {
|
||||
if(pickup.owner != -1) {
|
||||
destroyElement(pickup);
|
||||
}
|
||||
});
|
||||
|
||||
if(gta.game == GAME_GTA_SA) {
|
||||
if(jobRouteStopSphere != null) {
|
||||
if(position.distance(jobRouteStopSphere.position) <= 2.0) {
|
||||
@@ -381,10 +390,12 @@ addEventHandler("OnDrawnHUD", function (event) {
|
||||
}
|
||||
|
||||
// Draw logo in corner of screen
|
||||
if(mainLogo != null && showLogo) {
|
||||
let logoPos = toVector2(gta.width-132, gta.height-132);
|
||||
let logoSize = toVector2(128, 128);
|
||||
drawing.drawRectangle(mainLogo, logoPos, logoSize);
|
||||
if(mainLogo != null) {
|
||||
if(showLogo) {
|
||||
let logoPos = toVector2(gta.width-132, gta.height-132);
|
||||
let logoSize = toVector2(128, 128);
|
||||
drawing.drawRectangle(mainLogo, logoPos, logoSize);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -482,9 +493,7 @@ addNetworkHandler("ag.showBusStop", function(position, colour) {
|
||||
jobRouteStopSphere.colour = colour;
|
||||
}
|
||||
|
||||
|
||||
jobRouteStopBlip = gta.createBlip(position, 0, 2, colour);
|
||||
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
@@ -429,14 +429,14 @@ addEventHandler("OnProcess", (event, deltaTime) =>
|
||||
if(!localPlayer) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if(gta.game >= GAME_GTA_SA) {
|
||||
// We don't need this for GTA SA+
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
if(localPlayer.vehicle == null) {
|
||||
if(localPlayer.vehicle == null) {
|
||||
let newAngle = 0.0;
|
||||
let moveKeyHeld = false;
|
||||
if(isKeyDown(SDLK_w)) {
|
||||
@@ -462,15 +462,15 @@ addEventHandler("OnProcess", (event, deltaTime) =>
|
||||
newAngle = Math.PI/2;
|
||||
moveKeyHeld = true;
|
||||
}
|
||||
|
||||
|
||||
if(moveKeyHeld && !gui.cursorEnabled) {
|
||||
localPlayer.heading = cameraAngle + newAngle;
|
||||
localPlayer.heading = cameraAngle + newAngle;
|
||||
}
|
||||
|
||||
|
||||
if(sdl.getModState()&KMOD_ALT && !gui.cursorEnabled) {
|
||||
if(moveKeyHeld) {
|
||||
let position = getPosInFrontOfPos(localPlayer.position, localPlayer.heading, 1.0);
|
||||
localPlayer.walkTo(vec3ToVec2(position));
|
||||
localPlayer.walkTo(vec3ToVec2(position));
|
||||
isWalking = true;
|
||||
triggerNetworkEvent("ag.walk", true);
|
||||
} else {
|
||||
@@ -479,7 +479,7 @@ addEventHandler("OnProcess", (event, deltaTime) =>
|
||||
}
|
||||
} else {
|
||||
isWalking = false;
|
||||
triggerNetworkEvent("ag.walk", false);
|
||||
triggerNetworkEvent("ag.walk", false);
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -490,7 +490,7 @@ let IdleTime = 0;//2019 Lucas was here!
|
||||
function processReturnToRestRotation()
|
||||
{
|
||||
//resetCameraRotation();//2019 Lucas was here!
|
||||
|
||||
|
||||
//2019 Lucas was here!
|
||||
let Target = getCameraTarget();
|
||||
if (!ShouldReturnToRestRotation(Target))
|
||||
@@ -652,7 +652,7 @@ function update()
|
||||
positionX += normalX*Distance;
|
||||
positionY += normalY*Distance;
|
||||
positionZ += normalZ*Distance;
|
||||
|
||||
|
||||
cameraMatrix.m41 = positionX;
|
||||
cameraMatrix.m42 = positionY;
|
||||
cameraMatrix.m43 = positionZ;
|
||||
@@ -680,7 +680,7 @@ function getPosInFrontOfPos(pos, angle, distance) {
|
||||
let x = (pos.x+((Math.cos(angle+(Math.PI/2)))*distance));
|
||||
let y = (pos.y+((Math.sin(angle+(Math.PI/2)))*distance));
|
||||
let z = pos.z;
|
||||
|
||||
|
||||
return new Vec3(x,y,z);
|
||||
}
|
||||
|
||||
|
||||
@@ -50,16 +50,16 @@ function drawNametag(x, y, health, armour, text, ping, alpha, distance, colour,
|
||||
if(nametagFont == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
alpha *= 0.75;
|
||||
let width = nametagWidth;
|
||||
health = Math.max(0.0, Math.min(1.0, health));
|
||||
armour = Math.max(0.0, Math.min(1.0, armour));
|
||||
|
||||
|
||||
// Starts at bottom and works it's way up
|
||||
// -------------------------------------------
|
||||
// Health Bar
|
||||
|
||||
|
||||
if(gta.game == GAME_GTA_III) {
|
||||
// Mickey Hamfists is ridiculously tall. Raise the nametag for him a bit
|
||||
if(skin == 109) {
|
||||
@@ -70,7 +70,7 @@ function drawNametag(x, y, health, armour, text, ping, alpha, distance, colour,
|
||||
} else {
|
||||
y -= 5;
|
||||
}
|
||||
|
||||
|
||||
if(health > 0.0) {
|
||||
let hx = x-width/2;
|
||||
let hy = y-10/2;
|
||||
@@ -79,12 +79,12 @@ function drawNametag(x, y, health, armour, text, ping, alpha, distance, colour,
|
||||
let colour = createColour(Math.floor(255.0*alpha), Math.floor(255.0-(health*255.0)), Math.floor(health*255.0), 0); // Health bar colour (varies, depending on health)
|
||||
drawing.drawRectangle(null, [hx+2, hy+2], [(width-4)*health, 10-6], colour, colour, colour, colour);
|
||||
}
|
||||
|
||||
|
||||
// Armour Bar
|
||||
if (armour > 0.0)
|
||||
{
|
||||
// Go up 10 pixels to draw the next part
|
||||
y -= 10;
|
||||
y -= 10;
|
||||
let hx = x-width/2;
|
||||
let hy = y-10/2;
|
||||
let colourB = toColour(255, 0, 0, 0); // Background colour (black)
|
||||
@@ -92,18 +92,18 @@ function drawNametag(x, y, health, armour, text, ping, alpha, distance, colour,
|
||||
let colour = toColour(255, 255, 255, 255); // Armour bar colour (white)
|
||||
drawing.drawRectangle(null, [hx+2, hy+2], [(width-4)*armour, 10-6], colour, colour, colour, colour);
|
||||
}
|
||||
|
||||
|
||||
y -= 20;
|
||||
|
||||
|
||||
// Nametag
|
||||
if(nametagFont != null) {
|
||||
let size = nametagFont.measure(text, game.width, 0.0, 0.0, nametagFont.size, false, false);
|
||||
nametagFont.render(text, [x-size[0]/2, y-size[1]/2], game.width, 0.0, 0.0, nametagFont.size, colour, false, false, false, true);
|
||||
}
|
||||
|
||||
|
||||
// Go up another 10 pixels for the next part
|
||||
y -= 20;
|
||||
|
||||
y -= 20;
|
||||
|
||||
// AFK Status
|
||||
if(afkStatusFont != null) {
|
||||
if(afk) {
|
||||
@@ -119,34 +119,34 @@ function updateNametags(element) {
|
||||
if(localPlayer != null) {
|
||||
let playerPos = localPlayer.position;
|
||||
let elementPos = element.position;
|
||||
let client = getClientFromPlayerElement(element);
|
||||
|
||||
let client = getClientFromPlayerElement(element);
|
||||
|
||||
elementPos[2] += 0.9;
|
||||
|
||||
|
||||
let screenPos = getScreenFromWorldPosition(elementPos);
|
||||
if (screenPos[2] >= 0.0) {
|
||||
let health = element.health/100.0;
|
||||
if(health > 1.0) {
|
||||
health = 1.0;
|
||||
}
|
||||
|
||||
|
||||
let armour = element.armour/100.0;
|
||||
if(armour > 1.0) {
|
||||
armour = 1.0;
|
||||
armour = 1.0;
|
||||
}
|
||||
|
||||
|
||||
let distance = playerPos.distance(elementPos);
|
||||
if(distance <= nametagDistance) {
|
||||
if(element.type == ELEMENT_PLAYER) {
|
||||
let name = element.name;
|
||||
let colour = COLOUR_WHITE;
|
||||
let paused = false;
|
||||
let ping = -1;
|
||||
|
||||
let paused = false;
|
||||
let ping = -1;
|
||||
|
||||
if(typeof playerNames[element.name] != "undefined") {
|
||||
name = playerNames[element.name];
|
||||
}
|
||||
|
||||
|
||||
if(typeof playerPaused[element.name] != "undefined") {
|
||||
paused = playerPaused[element.name];
|
||||
}
|
||||
@@ -154,10 +154,10 @@ function updateNametags(element) {
|
||||
if(typeof playerColours[element.name] != "undefined") {
|
||||
colour = playerColours[element.name];
|
||||
}
|
||||
|
||||
|
||||
if(typeof playerPing[element.name] != "undefined") {
|
||||
ping = playerPing[element.name];
|
||||
}
|
||||
}
|
||||
|
||||
drawNametag(screenPos[0], screenPos[1], health, armour, name, ping, 1.0-distance/nametagDistance, distance, colour, paused, element.skin);
|
||||
}
|
||||
@@ -182,7 +182,7 @@ addEventHandler("OnDrawnHUD", function(event) {
|
||||
if(gta.game >= GAME_GTA_IV) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
getElementsByType(ELEMENT_PLAYER).forEach(function(player) {
|
||||
if(player != localPlayer) {
|
||||
updateNametags(player);
|
||||
|
||||
@@ -28,23 +28,23 @@ addEventHandler("OnDrawnHUD", function (event) {
|
||||
if(listFont != null && titleFont != null) {
|
||||
let scoreboardStart = (game.height/2)-(Math.floor(getClients().length/2)*20);
|
||||
let titleSize = titleFont.measure("PLAYERS", game.width, 0.0, 1.0, 10, false, false);
|
||||
titleFont.render("PLAYERS", [game.width/2, scoreboardStart-50], 0, 0.5, 0.0, titleFont.size, COLOUR_WHITE, false, false, false, true);
|
||||
titleFont.render("PLAYERS", [game.width/2, scoreboardStart-50], 0, 0.5, 0.0, titleFont.size, COLOUR_WHITE, false, false, false, true);
|
||||
|
||||
titleSize = titleFont.measure("____________________________", game.width, 0.0, 1.0, 10, false, false);
|
||||
titleFont.render("____________________________", [game.width/2, scoreboardStart-35], 0, 0.5, 0.0, titleFont.size, COLOUR_WHITE, false, false, false, true);
|
||||
|
||||
titleFont.render("____________________________", [game.width/2, scoreboardStart-35], 0, 0.5, 0.0, titleFont.size, COLOUR_WHITE, false, false, false, true);
|
||||
|
||||
let clients = getClients();
|
||||
for(let i in clients) {
|
||||
if(!clients[i].console) {
|
||||
let name = clients[i].name;
|
||||
let colour = COLOUR_WHITE;
|
||||
let paused = false;
|
||||
let ping = "-1";
|
||||
|
||||
let paused = false;
|
||||
let ping = "-1";
|
||||
|
||||
if(typeof playerNames[clients[i].name] != "undefined") {
|
||||
name = playerNames[clients[i].name];
|
||||
}
|
||||
|
||||
|
||||
if(typeof playerPaused[clients[i].name] != "undefined") {
|
||||
paused = playerPaused[clients[i].name];
|
||||
}
|
||||
@@ -55,27 +55,27 @@ addEventHandler("OnDrawnHUD", function (event) {
|
||||
|
||||
if(typeof playerPing[clients[i].name] != "undefined") {
|
||||
ping = toString(playerPing[clients[i].name]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Player ID
|
||||
let text = String(clients[i].index);
|
||||
let size = listFont.measure(text, 75, 0.0, 1.0, 10, false, false);
|
||||
listFont.render(text, [game.width/2-100, scoreboardStart + (i*20)], 0, 0.5, 0.0, listFont.size, COLOUR_WHITE, false, false, false, true);
|
||||
|
||||
listFont.render(text, [game.width/2-100, scoreboardStart + (i*20)], 0, 0.5, 0.0, listFont.size, COLOUR_WHITE, false, false, false, true);
|
||||
|
||||
// Player Name
|
||||
text = name;
|
||||
size = listFont.measure(text, 100, 0.0, 1.0, 10, false, false);
|
||||
listFont.render(text, [game.width/2, scoreboardStart + (i*20)], 0, 0.5, 0.0, listFont.size, colour, false, false, false, true);
|
||||
|
||||
|
||||
// Ping
|
||||
text = ping;
|
||||
size = listFont.measure(ping, 75, 0.0, 1.0, 10, false, false);
|
||||
listFont.render(ping, [game.width/2+100, scoreboardStart + (i*20)], 0, 0.5, 0.0, listFont.size, COLOUR_WHITE, false, false, false, true);
|
||||
|
||||
listFont.render(ping, [game.width/2+100, scoreboardStart + (i*20)], 0, 0.5, 0.0, listFont.size, COLOUR_WHITE, false, false, false, true);
|
||||
|
||||
// PAUSED Status (depends on resource "afk")
|
||||
if(paused == true) {
|
||||
size = listFont.measure("PAUSED", 100, 0.0, 1.0, 10, false, false);
|
||||
listFont.render("PAUSED", [game.width/2+200, scoreboardStart + (i*20)], 0, 0.5, 0.0, listFont.size, pausedColour, false, false, false, true);
|
||||
listFont.render("PAUSED", [game.width/2+200, scoreboardStart + (i*20)], 0, 0.5, 0.0, listFont.size, pausedColour, false, false, false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ addEventHandler("onProcess", function(event, deltaTime) {
|
||||
if(localPlayer != null && localPlayer.getData("ag.spawned") != null) {
|
||||
if(localPlayer.health <= 0) {
|
||||
localPlayer.clearWeapons();
|
||||
triggerNetworkEvent("ag.player.death", localPlayer.position, localPlayer.heading.toFixed(2));
|
||||
triggerNetworkEvent("ag.player.death", localPlayer.position);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user