[MOD]Real-time Basketball [V2.24 Stable]

Discussion about Mods for Prison Architect

Moderator: NBJeff

murgh
level2
level2
Posts: 232
Joined: Sat Jan 30, 2016 11:52 am

[MOD]Real-time Basketball [V2.24 Stable]

Postby murgh » Fri Jun 10, 2016 4:22 pm

Adds the Basketball Court and the Basketball League / Training Reform Programs Welcome to the slam!


Changelog:

Version 2.24:
- Full multi-language support: you can translate the base-language.txt if you wish
- Delete button added: you can delete the whole court with a button
- Tooltips updated: fully compliant with the new PA 2.0 standard
- Button behaviour updated: CourtLights button only available when GAME OFF
- Updated the interface.spritebank for version 2.0 and also added Branch Library
- Tweaked the Quick Build rooms: only the Basic courts are pre-zoned.
- This version has now become INCOMPATIBLE with PA update 1.8 and below, but fully supports PA 2.0.

Version 2.23:
- Quickfix for compatibility with PA 1.8

Version 2.22:
- You can now sack the basketball. This comes in handy when you dismantle a court while a ball was left behind. For the blind inmates there is a staffkey inside the ball, so they can hear it when the ball comes towards their face.
- Scoreboard will now show the last 4 digits of the court it's connected to when clicking GAME ON.
- Minor bug fix on GAME OFF button, it would in some cases not turn the court in sleep mode.

Screenshot 2.22:
Image

Version 2.21:
- Fixed scoreboard not found correctly

Version 2.2:
- Added a dribble effect to the ball
-Tweaked too many little things to mention to let the game run as smooth as possible.
-Added a variety of quickbuild rooms.
-Updated the whistle sounds.
Please dismantle existing basketball courts before updating to this version.

Version 2.01:
-Fixed quickbuild rooms to optimum size, smaller and without benches (those are not needed any more).
-Added more floor types and set all types to fast.
-Fixed error about current player being nil after loading a saved game while a match was played.
-Fixed multiple balls on court.
-Adjusted the scanning range of the court.
-Courts can be rotated in all 4 directions now.
-Basketball Locker will store dead basketballs after a match.
-Placeable optional score boards, and also sellable, to easy to get rid of if placed not to your likings.
-Added a Basketball Trainer.
-Added two new rooms.
-Added button to kill or delete the ball after a match: if you want a bloody match, the killed ball will be brought to a Basketball Locker, leaving some blood behind. No idea if this affects the death rate of the prison, feel free to test it out.

Dismantle existing basketball courts before updating from V1.0 to V2.01, since everything is scripted now and incompatible with the prior version of this mod. Updating from V2.0 to 2.01 is no problem, it will dismantle old courts.


UPDATE V2.0: Now with a working basketball game! Dismantle existing basketball courts before updating, since everything is scripted now and incompatible with the prior version of this mod.

The league offers 17 places for prisoners to exercise. You may use a small or large basketball court for the reform program.

The Basketball Court can be found in the QuickBuild menu and should only be placed horizontally. After placing, you must wire the left and right court half to their goallights manually.

The Reform Progam can be scheduled outside of work and is managed by an external teacher. Of course playing basketball is free. The duration is set to 1 hour, so you can schedule as many playing hours as you wish during the whole day.

To start/stop a realtime game, click the Centre Circle and press the button GAME ON/GAME OFF.

Don't let the realtime game run 24x7 since it might produce lag in your prison while perhaps you aren't watching it anyway. Besides, I'm not sure if the timing would work properly without spitting errors if the game speed is set above normal. So better not mess with that too much and be sure to have a savegame.

To see additional debug info for a match, press the button for DebugInfo and then press F3 to open the debug window. Don't let DebugInfo run forever!

To have the court ligts enabled while not having the realtime game running, simply press the CourtLights button to switch them on or off.

Last but not least, you can quickly change the floor with a button as well.

If you want to have a different worn field, go into the mods folder and delete sprites.png. Then make a copy of one of the 9 field templates, and rename that copy to sprites.png to have the field of your choice.

IMPORTANT NOTE: To get the whistle sound working, you will need to copy the file SOUNDS.TXT into the data folder of Prison Architect, since it won't work when it is in the mods folder. Create a folder called data in

C:\Program Files (x86)\Steam\steamapps\common\Prison Architect\

and move the sounds.txt from

C:\Users\YourUserName\AppData\Local\Introversion\Prison Architect\Mods\693956799\data\sounds.txt

into that newly created map.

Overwrite sounds.txt if you already did the same with the Custom Control Booths mod, since this file is newer.

This is an updated version of the ancient Prison Basketball mod originally made by ObiWorm.

Link to non-Steam version: http://prison-exchange.com/browse/mods/ ... asketball/

Link to the Steam mod: https://steamcommunity.com/sharedfiles/ ... =693956799

Screenshots V2.0:
Image

Image

You can place a Basketball Court conveniently with a Quickbuild room.
It will spawn the court, some benches around, a basketball locker and a centre light, emitting the room a little bit.

The Basketball Court is a 2x2 tile in the centre and holds a button to change the floor type.
That way you don't have to wait for a floor to be made and then to find out you didn't like it after all.
So the button will let you choose from 9 different floors at ease to match with the court you've chosen.

The Court will spawn either 1 or 2 halves to make a large or small court.
It will scan for people on the court and if it found more than 10 players, it will come out of sleep mode.
Court lights around the lines will turn on, emitting the room to the fullest.

A guard will go to the basketball locker to get a basketball (since the teacher won't do it).
The ball will be fetched by the Teacher and brought to the centre. A whistle blows when the game begins.

Then some cool basketball action will happen on the field!
Players will play the ball to each other and make goals as well.
In case of a goal, the goal light will turn on for a moment and the scoreboard updates.

When the game is over a whistle blows again, the court lights around the field go off, and the thing goes to sleep again, waiting for the next match

The basketball game can be turned on/off with a button.
Debug info on the game being played can also be turned on/off.
When the game is turned off and sleeping the court lights will be off as well, but you can override that by switching them on manually with.. a button!
That way you can always have an emitted court without the game actually being actively using cpu power.

A video demo preview of a working basketball game can be watched here: https://sendvid.com/quz74b4w
Last edited by murgh on Sun Aug 28, 2016 10:13 am, edited 10 times in total.
murgh
level2
level2
Posts: 232
Joined: Sat Jan 30, 2016 11:52 am

Re: [MOD] Prison Basketball [V2.0 Stable]

Postby murgh » Sat Jun 11, 2016 10:42 pm

Though many hours being spent in it, the script still isn't totally foolproof yet.. Since it depends on random things to happen, bugs are hard to reproduce.

I've just noticed a case where the field woke up out of sleep due to some prisoners rushing over the field to get to the canteen.. It triggered the 'found 10+ players' routine and started a job to have a guard fetch a ball, since a teacher was also around. But those 'players' were just moving along, so the game went into sleep mode again before the 'fetch basketball job' was completed by the guard. Next time the field woke up, it spawned about 5 basketballs... Oops.

But as far as I know we can't cancel jobs, pfff. So I guess I'll add a new routine, giving the field and its stuff a fresh HomeUID each time a game starts. And then let the basketball check its id with the current one, to see if it was spawned by accident (and then delete itself). I was hoping not to be needing any more code in the basketball.lua script, since that one is running real time without an update de-spammer. Perhaps there is another solution? edit: oh wait, i'll just change the FindMyBall function into FindMyBalls to delete obsolete ones :twisted:

Also myCurrentPlayer doesn't get saved, so an active game fucks up upon loading a saved game since it can't remember which player was the current one, lol. A basketball court with Altzheimer, imagine that.

So yea, the thing isn't completely as bug free as I hoped it would be, don't let it run 24x7 in your prison without watching over it. Or be prepared to once in a while see a debug window spitting some weird error for a rare case scenario which I haven't met before during testing.
murgh
level2
level2
Posts: 232
Joined: Sat Jan 30, 2016 11:52 am

Re: [MOD] Prison Basketball [V2.01 Stable]

Postby murgh » Wed Jun 15, 2016 7:58 pm

Version 2.01 is out in the wild! Many bug fixes and enhancements, so get it now! :D
murgh
level2
level2
Posts: 232
Joined: Sat Jan 30, 2016 11:52 am

Re: [MOD] Prison Basketball [V2.2 Stable]

Postby murgh » Tue Jun 21, 2016 3:25 pm

Version 2.2 is out, with even more little tweaks and bug fixes. Enjoy!
murgh
level2
level2
Posts: 232
Joined: Sat Jan 30, 2016 11:52 am

Re: [MOD] Prison Basketball [V2.2 Stable]

Postby murgh » Tue Jun 21, 2016 10:53 pm

Aaand hello Murphy...
Noticed a little bug where a new league scoreboard would not be found correctly if you would place it manually around a full court.
So better not dismantle the scoreboard at the basketball league if you want visible score!

Selling the scoreboard and placing another seems to work fine on the training court though, I just forgot to check if it would work on the big court as well, oops.
That piece of code needs to be revised anyway, it also keeps spamming a message about placing an optional scoreboard if none is present.
murgh
level2
level2
Posts: 232
Joined: Sat Jan 30, 2016 11:52 am

Re: [MOD]Real-time Basketball [V2.22 Stable]

Postby murgh » Fri Jul 08, 2016 11:29 am

Updated with some minor bug fixes and enhancements. The scoreboard will now show the last four digits of the court it's connected to. You were already able to check if a scoreboard was linked properly to the correct court when placing several courts next to each other by hovering the mouse above the individual LEDs, but this way it's more easy to spot. Just turn the GAME ON and the boards will flash their ID's for a few moments. When a scoreboard refuses to be learned properly due to courts placements, it's best to place scoreboards one by one: sell all boards in near vicinity, place one scoreboard, turn on that one court so it will find it, then place the next scoreboard, turn that field on, etc.
murgh
level2
level2
Posts: 232
Joined: Sat Jan 30, 2016 11:52 am

Re: [MOD]Real-time Basketball [V2.24 Stable]

Postby murgh » Sun Aug 28, 2016 10:15 am

Updated to version 2.24 for full support of new features in PA 2.0. Note that this version has now become incompatible with PA update 1.8 and below, but you can always download a prior version of the mod at prison-exchange.

- Full multi-language support: you can translate the base-language.txt if you wish
- Delete button added: you can delete the whole court with a button
- Tooltips updated: fully compliant with the new PA 2.0 standard
- Button behaviour updated: CourtLights button only available when GAME OFF
- Updated the interface.spritebank for version 2.0 and also added Branch Library
- Tweaked the Quick Build rooms: only the Basic courts are pre-zoned.

Return to “Modding”

Who is online

Users browsing this forum: No registered users and 1 guest