Author |
Message |
Smong Server Help Squatter
Joined: 1043048991 Posts: 0x91E Offline
|
Posted: Sun Aug 07, 2005 7:37 am Post subject: controllable doors |
|
|
|
|
Here's a module that use regions to open doors for 5 seconds.
The module is usable as is, but is quite basic. Adding more functionality such as closing doors when entering a region, or restricting to certain ships/freqs shouldn't be too hard to add.
It does write to arena.conf every time a door is toggled, I did try the temporary setting thing but it didn't seem to work.
v1 src doc dll arena
asss-door.zip - 33.15 KB
File downloaded or viewed 79 time(s)
|
|
Back to top |
|
|
Bak ?ls -s 0 in
Age:25 Gender: Joined: Jun 11 2004 Posts: 1826 Location: USA Offline
|
|
Back to top |
|
|
50% Packetloss Server Help Squatter
Age:39 Gender: Joined: Sep 09 2003 Posts: 561 Location: Santa Clarita, California Offline
|
|
Back to top |
|
|
Smong Server Help Squatter
Joined: 1043048991 Posts: 0x91E Offline
|
Posted: Sun Aug 07, 2005 6:15 pm Post subject: |
|
|
|
|
The door only opens for 5 seconds anyway, plus it would look better if it opened as soon as the player triggered it.
|
|
Back to top |
|
|
Grelminar Creator of Asss
Joined: Feb 26 2003 Posts: 378 Offline
|
Posted: Wed Aug 10, 2005 7:55 pm Post subject: |
|
|
|
|
I didn't actually look at the source, but your comments indicate that you're using cfg->SetInt. Much better would be to use clientset->ArenaOverride, and then clientset->SendClientSettings on each player (and if it's a common pattern, I can add a utility function to do that second part). That will avoid going through the config system entirely, so you won't have to worry about conf files, and you have control over when the packets are sent.
I am curious why the temporary thing wasn't working, though.
|
|
Back to top |
|
|
Smong Server Help Squatter
Joined: 1043048991 Posts: 0x91E Offline
|
Posted: Thu Aug 11, 2005 1:17 pm Post subject: |
|
|
|
|
It seemed the temporary settings only got sent to clients when a permanent setting was written to disk during the dirty status check.
I don't think the temporary settings were marked as dirty, but when settings are written to disk it thens calls a settings change callback which I suspect causes another module to send the necessary packets.
|
|
Back to top |
|
|
Grelminar Creator of Asss
Joined: Feb 26 2003 Posts: 378 Offline
|
Posted: Thu Aug 11, 2005 4:41 pm Post subject: |
|
|
|
|
Oh, I see. There are various ways to fix that, although none of them is really satisfactory. It would be bad, for example, to do the config changed callback after every temporary settings change, because that would lead to bad behavior if you're doing 100 of them in a row. It might be possible to have temporary changes get marked as dirty, so the periodic file updater would see them and do the callback, but not write them to disk. Another solution might be to add a function to clientset to reload all settings and send the packets if necessary, just like the config changed callback does.
But I'm more inclined to do nothing, and instead have people use the clientset override functions, which are the better solution.
|
|
Back to top |
|
|
Elnino Newbie
Joined: Aug 10 2006 Posts: 14 Offline
|
Posted: Thu Aug 17, 2006 3:21 pm Post subject: |
|
|
|
|
What if I crontab a cp command to overwrite the arena.conf ?
like "cp arena.ok arena.conf"
that's a little dirty but anyone else found something ... ?
sry for waking this old thread up
Thx
Elnino
|
|
Back to top |
|
|
D1st0rt Miss Directed Wannabe
Age:36 Gender: Joined: Aug 31 2003 Posts: 2247 Location: Blacksburg, VA Offline
|
Posted: Sun Aug 27, 2006 1:32 pm Post subject: |
|
|
|
|
The best way to do it is clientset overrides, don't use crontab. The Hyperspace racing module uses overrides and they're just dandy. _________________
|
|
Back to top |
|
|
Elnino Newbie
Joined: Aug 10 2006 Posts: 14 Offline
|
Posted: Tue Aug 29, 2006 10:38 am Post subject: |
|
|
|
|
Thx D1st0rt
You have some code snipplet or some doc to help a newbie ?
or you can just post the line Ill figure the stuff all by myself
|
|
Back to top |
|
|
D1st0rt Miss Directed Wannabe
Age:36 Gender: Joined: Aug 31 2003 Posts: 2247 Location: Blacksburg, VA Offline
|
Posted: Tue Aug 29, 2006 9:39 pm Post subject: |
|
|
|
|
Here's how it's set up in the race module:
at the top you have to include a header
Then you need to declare a variable for the clientset module and your setting
local Iclientset *cs;
local override_key_t ok_DoorMode; |
In MM_LOAD, you need to initialize your override key
ok_DoorMode = cs->GetOverrideKey("door", "doormode"); |
In the arena settings I had the door mode defaulted to have them open so I overrided it to close and then removed the override it to open them again.
local void closeDoors(Arena *a)
{
Player *p;
Link *link;
cs->ArenaOverride(a, ok_DoorMode, 255);
pd->Lock();
FOR_EACH_PLAYER(p)
{
if(p->arena == a)
cs->SendClientSettings(p);
}
pd->Unlock();
}
local void openDoors(Arena *a)
{
Player *p;
Link *link;
cs->ArenaUnoverride(a, ok_DoorMode);
pd->Lock();
FOR_EACH_PLAYER(p)
{
if(p->arena == a)
cs->SendClientSettings(p);
}
pd->Unlock();
} |
Alternatively you could do something like have a function that takes door mode as a parameter.
In MM_DETACH I call the openDoors function to remove the override, I don't know if this is necessary but it's probably still a good idea.
|
|
Back to top |
|
|
Elnino Newbie
Joined: Aug 10 2006 Posts: 14 Offline
|
Posted: Wed Aug 30, 2006 10:46 am Post subject: |
|
|
|
|
Godly !
|
|
Back to top |
|
|
|