Skip to content

Commit 24e2e0d

Browse files
committed
Merge branch 'dev'
2 parents b86d410 + ffbee77 commit 24e2e0d

17 files changed

Lines changed: 342 additions & 200 deletions

File tree

CHANGELOG.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,31 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.1.0] - 2025-02-18
9+
10+
### Added
11+
12+
- Separate moveable parking meters.
13+
14+
## [1.0.1] - 2025-02-18
15+
16+
### Fixed
17+
18+
- Not checking if player is near a parking meter for using pinkslips.
19+
20+
## [1.0.0] - 2025-02-12
21+
22+
### Added
23+
24+
- Pinkslip item hover details
25+
- Parking meter tile for creating and using pinkslips
26+
27+
## [0.4.2] - 2024-12-01
28+
29+
### Fixed
30+
31+
- Vehicle spawning above level 0 (engine limitation).
32+
833
## [0.4.1] - 2024-11-21
934

1035
### Fixed

CREDITS.md renamed to LICENSED_CONTENT.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Credits
1+
# Licensed Content
22

3-
### 3rd Party Assets
3+
### 3rd-party sounds
44
- The following sounds are used under the Mixkit Sound Effects Free License
55
mixkit-fast-signing-with-a-pen-2370
66
mixkit-signing-on-a-paper-2368

README.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
11
# AoqiaCarwannaExtended
22

3-
TODO.
4-
This is a COMPLETE rewrite of the mod, meaning pretty much none of your old sandbox options will be compatible. I am unsure as to how compatible the saves will be, as I removed a lot of unnecessary pinkslip items; a Pinkslip item for every vehicle in the game including modded ones are now no longer needed.
3+
This mod is a COMPLETE ground-up rewrite of the original, meaning none of your old pinkslip items and sandbox options are compatible with this version. I removed a lot of unnecessary pinkslip items, so a pinkslip item for every vehicle in the game including modded ones are now no longer needed.
4+
5+
This mod does not and will not support Build 42 until a stable multiplayer revision is released, or Build 42 becomes a stable release itself. I do not have the time to constantly change and micro-manage the mod just because Build 42 decides to change it's script schema or Lua API for the 500th time in a month.
6+
7+
## Features
8+
9+
- All base functionality from the original mod
10+
- More sandbox options to tweak
11+
- Safehouse claiming protection (in or near)
12+
- Custom Parking Stall tile for pinkslip claiming
513

614
# Credits
7-
- The original CarWanna mod by Xyberviri.
15+
16+
- The original CarWanna mod by Xyberviri.
17+
- Alex for the parking meter tile commission.
1.58 KB
Binary file not shown.

src/media/lua/client/AoqiaCarwannaExtendedClient/actions/create_pinkslip.lua

Lines changed: 36 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ function create_pinkslip:is_part_missing(part)
3232
end
3333

3434
function create_pinkslip:isValid()
35-
return self.vehicle and self.vehicle:isRemovedFromWorld() == false
35+
return self.vehicle
36+
and self.vehicle:isRemovedFromWorld() == false
37+
and getPlayer():getZ() == 0
3638
end
3739

3840
function create_pinkslip:waitToStart()
@@ -72,17 +74,11 @@ function create_pinkslip:perform()
7274
pinkslip:setWeight(self.vehicle:getWeight())
7375
end
7476

75-
local mdata = pinkslip:getModData() --[[@as ModDataDummy]]
76-
7777
-- Make sure the table exists in the pinkslip.
78-
local sub_mdata = nil --[[@as ModDataDummy | nil]]
79-
if mdata and mdata[mod_constants.MOD_ID] == nil then
80-
mdata[mod_constants.MOD_ID] = {}
81-
sub_mdata = mdata[mod_constants.MOD_ID]
82-
end
83-
84-
if sub_mdata == nil then
85-
logger:warn("Pinkslip sub_mdata failed to create/retrieve. THIS IS SO BAD!!!")
78+
--- @type ModDataDummy | nil
79+
local mdata = aoqia_table.init_mdata(pinkslip, mod_constants.MOD_ID)
80+
if mdata == nil then
81+
logger:warn("Pinkslip mdata failed to create/retrieve. THIS IS SO BAD!!!")
8682
return
8783
end
8884

@@ -96,44 +92,44 @@ function create_pinkslip:perform()
9692
end
9793

9894
if veh_mdata and has_mdata then
99-
sub_mdata.ModData = aoqia_table.shallow_copy(veh_mdata)
95+
mdata.ModData = aoqia_table.shallow_copy(veh_mdata)
10096
end
10197

102-
if sub_mdata.Parts and sub_mdata.Parts.index and sub_mdata.Parts.values then
103-
sub_mdata.Parts = sub_mdata.Parts
98+
if mdata.Parts and mdata.Parts.index and mdata.Parts.values then
99+
mdata.Parts = mdata.Parts
104100
else
105101
--- @diagnostic disable-next-line: assign-type-mismatch
106-
sub_mdata.Parts = { index = {}, values = {} }
102+
mdata.Parts = { index = {}, values = {} }
107103
end
108104

109-
sub_mdata.Blood = sub_mdata.Blood or {}
110-
sub_mdata.Color = sub_mdata.Color or {}
111-
112-
sub_mdata.Blood.F = self.vehicle:getBloodIntensity("Front")
113-
sub_mdata.Blood.B = self.vehicle:getBloodIntensity("Rear")
114-
sub_mdata.Blood.L = self.vehicle:getBloodIntensity("Left")
115-
sub_mdata.Blood.R = self.vehicle:getBloodIntensity("Right")
116-
sub_mdata.Color.H = self.vehicle:getColorHue()
117-
sub_mdata.Color.S = self.vehicle:getColorSaturation()
118-
sub_mdata.Color.V = self.vehicle:getColorValue()
119-
sub_mdata.EngineLoudness = self.vehicle:getEngineLoudness()
120-
sub_mdata.EnginePower = self.vehicle:getEnginePower()
121-
sub_mdata.EngineQuality = self.vehicle:getEngineQuality()
122-
sub_mdata.HasKey = self.vehicle:isKeysInIgnition()
123-
sub_mdata.HeadlightsActive = self.vehicle:getHeadlightsOn()
124-
sub_mdata.Hotwired = self.vehicle:isHotwired()
125-
sub_mdata.Skin = self.vehicle:getSkinIndex()
126-
sub_mdata.Rust = self.vehicle:getRust()
127-
sub_mdata.FullType = vehicle_script:getFullName()
128-
sub_mdata.Name = vehicle_name
105+
mdata.Blood = mdata.Blood or {}
106+
mdata.Color = mdata.Color or {}
107+
108+
mdata.Blood.F = self.vehicle:getBloodIntensity("Front")
109+
mdata.Blood.B = self.vehicle:getBloodIntensity("Rear")
110+
mdata.Blood.L = self.vehicle:getBloodIntensity("Left")
111+
mdata.Blood.R = self.vehicle:getBloodIntensity("Right")
112+
mdata.Color.H = self.vehicle:getColorHue()
113+
mdata.Color.S = self.vehicle:getColorSaturation()
114+
mdata.Color.V = self.vehicle:getColorValue()
115+
mdata.EngineLoudness = self.vehicle:getEngineLoudness()
116+
mdata.EnginePower = self.vehicle:getEnginePower()
117+
mdata.EngineQuality = self.vehicle:getEngineQuality()
118+
mdata.HasKey = self.vehicle:isKeysInIgnition()
119+
mdata.HeadlightsActive = self.vehicle:getHeadlightsOn()
120+
mdata.Hotwired = self.vehicle:isHotwired()
121+
mdata.Skin = self.vehicle:getSkinIndex()
122+
mdata.Rust = self.vehicle:getRust()
123+
mdata.FullType = vehicle_script:getFullName()
124+
mdata.Name = vehicle_name
129125

130126
local key = player_inventory:haveThisKeyId(self.vehicle:getKeyId())
131-
if key and sub_mdata.HasKey == false then
132-
sub_mdata.MakeKey = true
127+
if key and mdata.HasKey == false then
128+
mdata.MakeKey = true
133129
player_inventory:Remove(key --[[@as string]])
134130
end
135131

136-
local parts = sub_mdata.Parts
132+
local parts = mdata.Parts
137133
-- Should never happen~
138134
if parts == nil then return end
139135

@@ -251,8 +247,8 @@ function create_pinkslip:perform()
251247
logger:debug("Vehicle part item weights combined: (%d)", weight)
252248
logger:debug("Total vehicle weight calculated: (%d)", weight + vehicle_script:getMass())
253249

254-
sub_mdata.PartsDamaged = damaged_parts
255-
sub_mdata.PartsMissing = missing_parts
250+
mdata.PartsDamaged = damaged_parts
251+
mdata.PartsMissing = missing_parts
256252

257253
-- Remove form item if required.
258254
if sbvars.DoRequiresAutoForm then

src/media/lua/client/AoqiaCarwannaExtendedClient/ui/pinkslip.lua

Lines changed: 71 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
-- -------------------------------------------------------------------------- --
2-
-- wawa --
3-
-- -------------------------------------------------------------------------- --
1+
-- -------------------------------------------- --
2+
-- PINKSLIP CLAIM UI --
3+
-- -------------------------------------------- --
44

55
-- My requires.
6+
local aoqia_table = require("AoqiaZomboidUtilsShared/table")
67
local constants = require("AoqiaZomboidUtilsShared/constants")
78
local create_pinkslip = require("AoqiaCarwannaExtendedClient/actions/create_pinkslip")
89
local mod_constants = require("AoqiaCarwannaExtendedShared/mod_constants")
@@ -12,9 +13,7 @@ require("luautils")
1213

1314
-- std globals.
1415
local math = math
15-
local table = table
1616
-- TIS globals.
17-
local getSquare = getSquare
1817
local getText = getText
1918
local ISModalRichText = ISModalRichText
2019
local ISTimedActionQueue = ISTimedActionQueue
@@ -68,19 +67,13 @@ function pinkslip.confirm_dialog(player, vehicle)
6867

6968
local player_num = player:getPlayerNum()
7069

71-
local interior_warning = nil
72-
if sbvars.DoCompatRvInteriors and sbvars.DoUnassignInterior
73-
and RVInterior and RVInterior.vehicleHasInteriorParameters(vehicle) then
74-
interior_warning = getText(("IGUI_%s_ConfirmInteriorWarning"):format(mod_constants.MOD_ID))
75-
end
70+
local interior_warning = ((sbvars.DoCompatRvInteriors and sbvars.DoUnassignInterior
71+
and RVInterior and RVInterior.vehicleHasInteriorParameters(vehicle)) and
72+
getText(("IGUI_%s_ConfirmInteriorWarning"):format(mod_constants.MOD_ID)) or "")
7673

7774
local confirm_text = getText(("IGUI_%s_ConfirmText"):format(mod_constants.MOD_ID),
7875
getText("IGUI_VehicleName" .. vehicle:getScript():getName()))
79-
.. " <LINE> <RGB:1,0,0> "
80-
81-
if interior_warning then
82-
confirm_text = confirm_text .. interior_warning
83-
end
76+
.. ((interior_warning ~= "") and (" <LINE> <RGB:1,0,0> " .. interior_warning) or "")
8477

8578
local modal = ISModalRichText:new(
8679
0,
@@ -104,8 +97,7 @@ function pinkslip.add_option_to_menu(player, context, vehicle)
10497
local sbvars = SandboxVars[mod_constants.MOD_ID] --[[@as SandboxVarsDummy]]
10598
if sbvars.DoRegistration == false then return end
10699

107-
local mdata = vehicle:getModData() --[[@as ModDataDummy]]
108-
100+
local mdata = aoqia_table.init_mdata(vehicle, mod_constants.MOD_ID) --[[@as ModDataDummy]]
109101
local player_inv = player:getInventory()
110102

111103
local vehicle_script = vehicle:getScript()
@@ -363,10 +355,54 @@ function pinkslip.add_option_to_menu(player, context, vehicle)
363355
"adding option failed: Vehicle blacklisted from pinkslip use.")
364356
end
365357

366-
-- If safehouse only.
367-
if constants.IS_SINGLEPLAYER == false and sbvars.DoSafehouseOnly then
368-
local username = player:getUsername()
358+
if not_available == false and sbvars.DoParkingMeterOnly then
359+
local found_meter = false
360+
361+
local sq = vehicle:getSquare()
362+
local sq_x = sq:getX()
363+
local sq_y = sq:getY()
364+
365+
local dist = math.ceil(sbvars.ParkingMeterDistance / 2)
366+
for x = sq_x - dist, sq_x + dist do
367+
for y = sq_y - dist, sq_y + dist do
368+
repeat
369+
local s = getSquare(x, y, 0)
370+
if s == nil then break end
371+
372+
local s_objs = s:getObjects()
373+
for i = 1, s_objs:size() do
374+
local obj = s_objs:get(i - 1) --[[@as IsoObject]]
375+
local obj_name = obj:getSprite():getName()
376+
if obj_name == "f_parkingmeters_01_0"
377+
or obj_name == "f_parkingmeters_01_1"
378+
or obj_name == "f_parkingmeters_01_2"
379+
or obj_name == "f_parkingmeters_01_3"
380+
or obj_name == "f_parkingmeters_01_4"
381+
or obj_name == "f_parkingmeters_01_5"
382+
or obj_name == "f_parkingmeters_01_6"
383+
or obj_name == "f_parkingmeters_01_7" then
384+
found_meter = true
385+
break
386+
end
387+
end
388+
until true
389+
end
390+
391+
if found_meter then break end
392+
end
393+
394+
if found_meter == false then
395+
text = text
396+
.. " <LINE> <LINE> <RGB:1,0,0> "
397+
.. getText(("Tooltip_%s_NoParkingMeterFound"):format(mod_constants.MOD_ID))
398+
not_available = true
399+
end
400+
end
369401

402+
if not_available == false and constants.IS_SINGLEPLAYER == false and sbvars.DoSafehouseOnly then
403+
local found_safehouse = false
404+
405+
local username = player:getUsername()
370406
local veh_sq = vehicle:getSquare()
371407
local veh_sq_x = veh_sq:getX()
372408
local veh_sq_y = veh_sq:getY()
@@ -439,9 +475,15 @@ function pinkslip.add_option_to_menu(player, context, vehicle)
439475
if sq_dist == nil
440476
or (sbvars.SafehouseDistance == 0 and in_safehouse_area == false)
441477
or (sbvars.SafehouseDistance > 0 and sq_dist > sbvars.SafehouseDistance) then
478+
found_safehouse = false
479+
else
480+
found_safehouse = true
481+
end
482+
483+
if found_safehouse == false then
442484
text = text
443485
.. " <LINE> <LINE> <RGB:1,0,0> "
444-
.. getText(("Tooltip_%s_DoSafehouseOnly"):format(mod_constants.MOD_ID))
486+
.. getText(("Tooltip_%s_NoSafehouseFound"):format(mod_constants.MOD_ID))
445487
not_available = true
446488
end
447489
end
@@ -476,6 +518,14 @@ function pinkslip.add_option_to_menu(player, context, vehicle)
476518
not_available = true
477519
end
478520

521+
-- If the player is above Z level 0.
522+
if player:getZ() > 0 then
523+
text = text
524+
.. "<LINE> <LINE> <RGB:1,0,0> "
525+
.. getText(("Tooltip_%s_AboveZLevel"):format(mod_constants.MOD_ID))
526+
not_available = true
527+
end
528+
479529
-- Do admin override if enabled.
480530
if not_available
481531
and player:getAccessLevel() == "Admin"

0 commit comments

Comments
 (0)