View Single Post
  #15  
Old 06-25-2012, 05:01 AM
Uleat's Avatar
Uleat
Developer
 
Join Date: Apr 2012
Location: North Carolina
Posts: 2,815
Default

(Server code submission in the following post)

This submission only covers the server code required to see improvements in door function. Some changes to database values will need to
be made, as well as some modifications to quest *.pl files, to fully realize the potential of this fix. It should not break any exisiting files or
functionality in its implementation.


Inverted Doors:
[Source:] Added conditional checks to determine if door is in an inverted state and to send appropriate client commands based on
requested action.

[Database:] Elevator actuators can now be placed in the inverted state based on asthetics and server admin preferences while maintaining
proper elevator function.


Opentype '40' & 'Dead-Click' Doors (handles/levers):
[Source:] Added code to Doors::Process() to handle zone broadcast closures of opentype '40' doors to eliminate the client(s)-server spam
events. Also added triggertype '1' to conditional check for zone broadcast to help maintain client-server door syncronization and reduce
the occurence of first-click->no-action ('dead-click') events.

[Database:] It is recommended that elevators/lifts & their owning activator doors be placed in the triggered-only state ([255/1] versus
[0/0]) to eliminate activation by 'lift-clicking' and to ensure that Doors::Process() handles the syncronization event described above.

(This fix is effectively redundent for opentype '40' doors if triggertypes are changed to [255/1], but should allow single/custom
opentype '40' door implementation as well as the option not to change types.) (If you see a 'dead click' with the very first activation
of a lift, but normal operation resumes afterwards, then database changes need to be made. I will coordinate with cavedude and see if I
can submit updates to him.)


Changes to 'NPCOpen', 'ForceOpen' & 'ForceClose':
[Source:] Modifed the structure of these handlers to accept (sender, alt_mode). The delegates have been coded to pass a 'false'
value in the case of existing programming structure, while allowing a 'true' value to be passed in the event that the alternative
'ForceOpen' or 'ForceClosed' action is desired. Changed timer disable and isopen=false statements to 'close_timer.Trigger();' to
eliminate the need for additional opentype '40' checks and procedures..Doors::Process() will now handle these.

[Note:] The modification to NPCOpen does not affect the expected action in <entity.cpp> EntityList::OpenDoorsNear().


Changes to 'forcedooropen' & 'forcedoorclose':
[Source:] Added the appropriate code to handle the scripted changes associated with the above source code updates. Again, 'altmode' is
not required for default operation.


Added 'toggledoorstate' & 'ToggleState':
[Source:] Included these new functions to change a door state without initiating a 'close timer.' Allows triggering of single-action type
doors (such as the Vergalid Mines lift) while maintaining client-server syncronization. No 'modified action' schema is designed or needed
in this function. Some restriction is incorporated, but useability ultimately depends on programmer's knowledge of client door operation.


Usage:
[Code]
NPCOpen(NPC* sender [, bool alt_mode=false])
ForceOpen(Mob *sender [, bool alt_mode=false])
ForceClose(Mob *sender [, bool alt_mode=false])
ToggleState(Mob *sender)

[Script]
forcedooropen(doorid [, altmode=0])
forcedoorclose(doorid [, altmode=0])
toggledoorstate(doorid)


Actions:
NPCOpen(sender) - client open action, current server toggle action with timer activation if appropriate
NPCOpen(sender, false) - same as NPCOpen(sender)
NPCOpen(sender, true) - client open action, set door state to open, start timer (restart if isopen already true)

ForceOpen(sender) - client open action, current server toggle action with timer activation if appropriate
ForceOpen(sender, false) - same as ForceOpen(sender)
ForceOpen(sender, true) - client open action, set door state to open, start timer (restart if isopen already true)

ForceClose(sender) - client close action (change from open action), current server toggle action with timer activation if appropriate
ForceClose(sender, false) - same as ForceClose(sender)
ForceClose(sender, true) - client close action, set door state to closed, disable timer (close_timer.Trigger())

ToggleState(sender) - toggles server door state, sends client appropriate md->action command, no timer activity

(Script actions should not need explaining...)


U
__________________
Uleat of Bertoxxulous

Compilin' Dirty
Reply With Quote