Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
Chalwk77 committed Jul 7, 2023
1 parent 8e4dc41 commit f005b66
Show file tree
Hide file tree
Showing 7 changed files with 108 additions and 62 deletions.
3 changes: 3 additions & 0 deletions INDEV/Battle Royale.lua
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ local BattleRoyale = {
['./Battle Royale/weapon degradation/'] = {
'degradation'
},
['./Battle Royale/weapons/'] = {
'weapons'
},
['./Battle Royale/weight/'] = {
'weapons'
}
Expand Down
77 changes: 36 additions & 41 deletions INDEV/Battle Royale/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,51 +2,46 @@

Planned features:
- [ ] Shrinking "safe zone" boundary (**WIP**)
- The safe zone will shrink over time, forcing players to move closer together. (**done**)
- Players outside the safe zone will take damage over time. (**done**)
- The safe zone will be marked on the map with flag poles (**WIP**)
- [x] Spectator mode: (**done**)
- Players will be able to spectate other players after they die.
- They will be invisible, invulnerable, and unable to interact with the world.
- [x] Limited lives: (**done**)
- Players will have a limited number of lives.
- Players will be able to spectate other players after they die.
- [x] The safe zone will shrink over time, forcing players to move closer together.
- [x] Players outside the safe zone will take damage over time.
- [ ] The safe zone will be marked on the map with flag poles
- [x] Spectator mode:
- [x] Players will be able to spectate other players after they die.
- [x] They will be invisible, invulnerable, and unable to interact with the world.
- [x] Limited lives:
- [x] Players will have a limited number of lives.
- [x] Players will be able to spectate other players after they die.
- [ ] Randomized loot (**WIP**)
- Loot will be randomized and spawn in random locations (**done**)
- Loot includes ammo, weapons, powerups and special abilities (**WIP**)
- Nuke
- Stun grenades
- Air Strike ability
- Weapon parts (for weapon repair system)
- Ammo (different types)
- Weapons (different types)
- Grenade launcher
- Health boost (50%, 100%, 150%, 200%)
- Speed boost (1.2, 1.3, 1.4, 1.5) (**done**)
- [x] Sky spawn system: (**done**)
- Players will spawn in the sky and fall to the ground.
- Players will be invulnerable until they land.
- [x] Randomized player spawn locations: (**done**)
- No two players will spawn in the same location.
- [x] Weapon weights: (**done**)
- Weapons will have weights, and players will have a weight limit.
- Players will be able to drop weapons to reduce their weight.
- [x] Weapon degradation: (**done**)
- Weapons will degrade over time.
- Weapons will have a limited number of shots before they break.
- [ ] Weapons (**WIP**)
- Players will start with no weapons. (**done**)
- Weapons will have different stats, such as damage and degradation. (**WIP**)
- You will have to find weapon 'parts' to repair weapons. (**WIP**)
- [ ] Player attributes (**WIP**)
- Players will have attributes such as extra strength, speed, and health. (**WIP**)
- Attributes will be affected by the player's weight.
- [x] Loot will be randomized and spawn in random locations
- Loot includes ammo:
- [ ] Nuke
- [ ] Stun grenades
- [ ] Air Strike ability
- [x] Weapon parts (for weapon repair system)
- [ ] Ammo (different types)
- [ ] Weapons (different types)
- [ ] Grenade launcher
- [x] Health boost (50%, 100%, 150%, 200%)
- [x] Speed boost (1.2, 1.3, 1.4, 1.5)
- [x] Sky spawn system:
- [x] Players will spawn in the sky and fall to the ground.
- [x] Players will be invulnerable until they land.
- [x] No two players will spawn in the same location.
- [x] Weapon weights:
- [x] Weapons will have weights, and players will have a weight limit.
- [x] Players will be able to drop weapons to reduce their weight.
- [x] Weapon degradation:
- [x] Weapons will degrade over time.
- [x] Durability decreases when: *shooting*, *reloading* or *melee*.
- [x] Weapons (general):
- [x] Players will start with no weapons.
- [x] You will have to find weapon *parts* to repair damaged weapons.
- [ ] Different types of ammo (**WIP**)
- Armoured-piercing, explosive, nukes
- Golden bullets (one shot kill)
- [ ] Support for all stock maps:
- Golden bullets (one-shot kill)
- [ ] Support for all stock maps: (**WIP**)
- It currently supports:
- `timberland`, `bloodgulch`,
- `timberland`, `bloodgulch`,
- `dangercanyon`, `icefields`
- `infinity`, `sidewinder`
- `deathisland`, `gephyrophobia`
Expand Down
4 changes: 2 additions & 2 deletions INDEV/Battle Royale/commands/repair_weapons.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function Command:repairsWeapons(player)

if (this_weapon ~= 0xFFFFFFFF and object ~= 0) then

local weapon = self.decay[object]
local weapon = self.weapons[object]
local max = self.weapon_degradation.max_durability

if (weapon and weapon.durability < max) then
Expand All @@ -54,7 +54,7 @@ function Command:repairsWeapons(player)

player.weapon_parts = nil
if (repaired) then
player:newMessage('Weapon repaired!', 5)
player:newMessage('Weapons repaired!', 5)
else
player:newMessage('Nothing was repaired!', 5)
end
Expand Down
2 changes: 0 additions & 2 deletions INDEV/Battle Royale/events/on_start.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ function event:onStart()
self.death_message_address = sig_scan("8B42348A8C28D500000084C9") + 3
self.original_death_message_address = read_dword(self.death_message_address)

self.decay = {}

-- Disable Full Spectrum Vision:
execute_command('disable_object "' .. 'powerups\\full-spectrum vision"')

Expand Down
1 change: 1 addition & 0 deletions INDEV/Battle Royale/events/on_tick.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ function event:onTick()
v:crateIntersect()
v:setSpeed() --todo: move this to a function called every 1 second.
v:spectate()
v:newWeapon()
v:degrade()
v:displaySecondaryHUD()
end
Expand Down
18 changes: 1 addition & 17 deletions INDEV/Battle Royale/weapon degradation/degradation.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,6 @@ local function overheating(object)
return (read_bit(object + 0x22C, 0) == 1)
end

function weapons:getWeapon(object)
return self.decay[object]
end

function weapons:addWeapon(object, weapon)
self.decay[object] = self.decay[object] or {
object = object,
weapon = weapon,
timer = self:new(),
durability = self.weapon_degradation.max_durability, -- 0% = broken, 100% = new
notify = true,
}
end

local function getAmmunition(object)

-- non-energy weapons:
Expand Down Expand Up @@ -110,12 +96,10 @@ function weapons:degrade()
if (weapon == 0xFFFFFFFF) then
return
elseif (object == 0) then
self.decay[object] = nil
self.weapons[object] = nil
return
end

self:addWeapon(object, weapon)

weapon = self:getWeapon(object)

local in_vehicle = self:inVehicle(dyn)
Expand Down
65 changes: 65 additions & 0 deletions INDEV/Battle Royale/weapons/weapons.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
local weapons = {}

function weapons:newWeapon()

self.weapons = self.weapons or {}

local id = self.id
local dyn = get_dynamic_player(id)
if (not player_alive(id) or dyn == 0) then
return
end

local weapon = read_dword(dyn + 0x118)
local object = get_object_memory(weapon)

if (weapon == 0xFFFFFFFF) then
return
elseif (object == 0) then
self.weapons[object] = nil
return
end

-- Constructor for new weapon object:
if (not self.weapons[object]) then

self.weapons[object] = {
damage_multiplier = 0, -- default damage multiplier
ammo_type = 0, -- default ammo type
object = object,
timer = self:new(),
durability = self.weapon_degradation.max_durability, -- 0% = broken, 100% = new
notify = true
}

setmetatable(self.weapons[object], self)
self.__index = self
end
end

-- Gets the weapon object:
function weapons:getWeapon(object)
return self.weapons[object]
end

-- Sets the weapon ammo type:
function weapons:setAmmoType(type)
self.ammo_type = type
end

-- Gets the weapon ammo type:
function weapons:getAmmoType()
return self.ammo_type
end

-- Sets the weapon ammo damage multiplier:
function weapons:setAmmoDamage(mult)
self.damage_multiplier = mult
end

-- Gets the weapon ammo damage multiplier:
function weapons:getAmmoDamage()
return self.damage_multiplier
end

return weapons

0 comments on commit f005b66

Please sign in to comment.