Open tdauth opened 3 years ago
Some example code on the change events:
interface ChangeEvent
public method isDifferent takes ChangeEvent changeEvent returns boolean
public method onChange takes nothing returns nothing
public method restore takes nothing returns nothing
endinterface
struct ChangeEventUnit extends ChangeEvent
private unit whichUnit
public method getUnit takes nothing returns unit
return whichUnit
endmethod
public stub method onChange takes nothing returns nothing
endmethod
public stub method restore takes nothing returns nothing
endmethod
endstruct
struct ChangeEventUnitPosition extends ChangeEventUnit
private real x
private real y
public stub method onChange takes nothing returns nothing
set this.x = GetUnitX(this.getUnit())
set this.y = GetUnitX(this.getUnit())
endmethod
public stub method restore takes nothing returns nothing
call SetUnitX(getUnit(), this.x)
call SetUnitY(getUnit(), this.y)
endmethod
endstruct
struct ChangeEventUnitFacing extends ChangeEventUnit
private real facing
public stub method onChange takes nothing returns nothing
set this.facing = GetUnitFacing(this.getUnit())
endmethod
public stub method restore takes nothing returns nothing
call SetUnitFacing(this.getUnit(), this.facing)
endmethod
endstruct
struct ChangeEventUnitHp extends ChangeEventUnit
private real hp
public stub method onChange takes nothing returns nothing
set this.hp = GetUnitLife(this.getUnit())
endmethod
public stub method restore takes nothing returns nothing
call SetUnitLife(this.getUnit())
endmethod
endstruct
struct ChangeEventUnitMana extends ChangeEventUnit
private real mana
public stub method onChange takes nothing returns nothing
set this.mana = GetUnitMana(this.getUnit())
endmethod
public stub method restore takes nothing returns nothing
call SetUnitMana(this.getUnit())
endmethod
endstruct
struct ChangeEventUnitDeath extends ChangeEventUnit
public stub method onChange takes nothing returns nothing
call KillUnit(this.getUnit())
endmethod
public stub method restore takes nothing returns nothing
// TODO ressurrect with dummy spell
endmethod
endstruct
struct TimeFrame
ChangeEvent array changeEvents[100]
integer latestChangeEventIndex
public method onChange takes nothing returns nothing
local integer i = 0
loop
exitwhen (i == latestChangeEventIndex)
call this.changeEvents[i].onChange()
set i = i + 1
endloop
endmethod
public method restore takes nothing returns nothing
local integer i = 0
loop
exitwhen (i == latestChangeEventIndex)
call this.changeEvents[i].restore()
set i = i + 1
endloop
endmethod
public method addChangeEvent takes ChangeEvent changeEvent returns integer
call this.changeEvents[this.latestChangeEventIndex] = changeEvent
set this.latestChangeEventIndex = this.latestChangeEventIndex + 1
endmethod
public method update takes nothing returns nothing
local integer i = 0
loop
exitwhen (i == 100)
call this.changeEvents[i]
set i = i + 1
endloop
endmethod
endstruct
// TODO get unit orders and store events until they stop or die
function TriggerFunctionOrderStop takes nothing returns nothing
call GroupRemove(movingUnits, GetTriggerUnit()
endfunction
function TriggerFunctionOrderMove takes nothing returns nothing
call GroupAdd(movingUnits, GetTriggerUnit()
endfunction
Most of the changes are done:
Missing invert stuff:
Concept of changing events of an inverted object:
isPossible
check before restoring an event.store
instead of onChange
and introduce the parameter inverted
for the method restore
, so we can restore events in both directions.to
isForward` because it doesnt mean the object is inverted but in which time direction it goes.isFatal
or allowsNoFurtherChanges
.Further thoughts on interactions with inverted objects: When an inverted unit walks over a landmine it would mean in the movie that the landmine has exploded before and now should see the explosion in reverse. This is because events in the movie have already happened from the perspective of inverted objects but will still happen from the perspective on non-inverted objects.
In our map one can change events, so it is possible to kill/destroy inverted objects and to change their timeline. This allows more interesting scenarios. You can kill inverted units and prevent their actions by placing mines on their predefined path.
Concept:
Missing features of time inversion:
Optimizing the time line updates:
Custom models: