Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add engineSet/GetModelVisibleTime #752

Merged
merged 18 commits into from
Apr 1, 2020
Merged

Add engineSet/GetModelVisibleTime #752

merged 18 commits into from
Apr 1, 2020

Conversation

CrosRoad95
Copy link
Contributor

@CrosRoad95 CrosRoad95 commented Jan 1, 2019

This functions are responsible for nights object, you can adjust when object disappear/appear

List of nights objects https://github.com/multitheftauto/mtasa-resources/blob/master/%5Beditor%5D/editor_gui/client/browser/objects.xml#L310

Functions:
timeOn, timeOff = engineGetModelVisibleTime( modelID ) - returns when object disappear/appear, 0,0 if model is incompatible.
bool engineSetModelVisibleTime( modelID, timeOn, timeOff ) - sets when object disappear/appear
time is between 0 and 23.

Example usage:

  • disable disappearing and use this models for your own custom models
  • you have club on server, make flashing lights shown when club is open, not randomly, all time like now

Example result: nights lights are visible at day ( between 10 and 12 )
pr

Script that i used

createObject(9934, -2420.85303, -605.81470, 133.16147)

t = {
    engineSetModelVisibleTime(1337, 10, 12),
    engineSetModelVisibleTime(9934, 10, 12),
    {engineGetModelVisibleTime(1337)},
    {engineGetModelVisibleTime(1338)},
    {engineGetModelVisibleTime(7220)}, -- casino
    {engineGetModelVisibleTime(9934)}, -- night model
    {engineGetModelVisibleTime(9933)}, -- night model
}
outputChatBox(inspect(t))

@CrosRoad95 CrosRoad95 added the enhancement New feature or request label Jan 1, 2019
@Wolfee-J
Copy link

Wolfee-J commented Jan 1, 2019

Would add nearly 10 thousand new usable IDs.

@4O4
Copy link
Contributor

4O4 commented Jan 2, 2019

Great piece of work!

Is it possible to make the model visible for the whole day and night without any break? I assume that if you use the time range from 0 to 23, the object would still invisible for one hour - please correct me if I'm wrong here.

What about the time range from 0 to 0? Does the game support it on compatible models?

Also may I suggest a different name for this property? In my personal opinion "model time" is a bit ambiguous... I think some more verbose name like engineSetModelVisibilityTimeRange, engineSetModelVisibilityHours or something similar would be a bit better at describing what the property is actually responsible for.

@Woovie
Copy link
Contributor

Woovie commented Jan 2, 2019

I agree with the naming here, I was really confused as to what engineGetModelTime might be when first seeing this pop up.

@CrosRoad95
Copy link
Contributor Author

so what is the best name for this function? i also check once again did limit 0-23 is correct

@qaisjp
Copy link
Contributor

qaisjp commented Jan 2, 2019

engineSetModelVisibleTime might work.

What is the difference between this function and simply setting alpha to 0/255 during certain hours of the day?

@CrosRoad95
Copy link
Contributor Author

CrosRoad95 commented Jan 9, 2019

Changed name to engineSetModelVisibleTime and engineGetModelVisibleTime, when you set hours to 0, 24 object is visible all time. Now if model is incompatible, Get will return 0,24

What is the difference between this function and simply setting alpha to 0/255 during certain hours of the day?

This property overwrites alpha, even onClientRender with setElementAlpha will not be able to show object if is outside "visible time"

@qaisjp
Copy link
Contributor

qaisjp commented Jan 12, 2019

I think we could maybe remove the ability to change the model's visible time, and just add a feature to make models always visible (irrespective of ingame time).

Visible time can then be implemented in Lua, per each individual object as well!

@CrosRoad95
Copy link
Contributor Author

you can write function that loop all id's and set time 0,24
per model is more customizable

@Wolfee-J
Copy link

Having a function like this would greatly reduce the amount of code needed. To handle object time properties the script I use consists of around 70 lines of code.

@forkerer
Copy link
Contributor

Gotta agree with @CrosRoad95 here, can't see anything wrong with giving people access to that, and it will reduce lua script length by a lot in systems like those.

@qaisjp qaisjp self-requested a review January 13, 2019 05:15
@botder botder added this to the Backlog milestone Mar 4, 2019
@qaisjp
Copy link
Contributor

qaisjp commented Jan 14, 2020

alright the API you've proposed will do.

basically my concerns were to do with conflicting resources. if it becomes an issue, we can always implement a modelmanager or something like that as a resource.

@CrosRoad95
Copy link
Contributor Author

you can't see some object at day, this feature let you do this, look at example models: https://dev.prineside.com/en/gtasa_samp_model_id/customsearch/?c%5B%5D=5&s=id-asc&bc=-1&bb=-1&bt=-1&ba=-1

@qaisjp qaisjp modified the milestones: Backlog, 1.6 Apr 1, 2020
@qaisjp qaisjp changed the title Model time property Add engineSet/GetModelTime Apr 1, 2020
@qaisjp qaisjp merged commit 429c0b7 into multitheftauto:master Apr 1, 2020
@qaisjp
Copy link
Contributor

qaisjp commented Apr 1, 2020

thank you

@Wolfee-J
Copy link

Doesn't function as expected. Models that already have time cycle data still disappear.

@StrixG StrixG changed the title Add engineSet/GetModelTime Add engineSet/GetModelVisibleTime Jun 19, 2020
@qaisjp
Copy link
Contributor

qaisjp commented Jul 29, 2020

Doesn't function as expected. Models that already have time cycle data still disappear.

Can't reproduce this.

run object = createObject(9934,0,0,5) 
crun engineSetModelVisibleTime(9934,0,24) 
run setMinuteDuration(1)

Edit: @StrixG says that it only works in Debug, and I can reproduce this (it does not work in Release)

qaisjp added a commit to qaisjp/mtasa-blue that referenced this pull request Aug 2, 2020
qaisjp added a commit that referenced this pull request Aug 2, 2020
TheNormalnij added a commit to TheNormalnij/mtasa-blue that referenced this pull request Oct 27, 2020
ghost pushed a commit that referenced this pull request Oct 28, 2020
* Revert "Revert "Add engineSet/GetModelTime (#752)" (#1588)"

This reverts commit 0e03a42.

* Fix engineSet/GetModelTime don't work in release

* Update Client/mods/deathmatch/logic/luadefs/CLuaEngineDefs.cpp

* Use new parser

* Moved and renamed TimeInfoSA

* Revert "Moved and renamed TimeInfoSA"

This reverts commit f147e4e.

* code improvements

* Tweak formatting in CModelInfoSA.cpp

Co-authored-by: Nikita Obrekht <obrekht@gmail.com>
Co-authored-by: saml1er <danishroar@gmail.com>
@CrosRoad95 CrosRoad95 deleted the Object-Time-Property branch January 18, 2021 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants