MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / FromTemplate

Method FromTemplate

engine/Poseidon/World/Detection/Detector.cpp:626–665  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

624}
625
626void Detector::FromTemplate(const ArcadeSensorInfo& info)
627{
628 SetArea(info.a, info.b, info.angle, info.rectangular);
629
630 _activationBy = info.activationBy;
631 _activationType = info.activationType;
632 _repeating = info.repeating;
633 _timeoutMin = info.timeoutMin;
634 _timeoutMid = info.timeoutMid;
635 _timeoutMax = info.timeoutMax;
636 _interruptable = info.interruptable;
637 _action = info.type;
638
639 if (info.idStatic >= 0)
640 {
641 AssignStatic(info.idStatic);
642 }
643 if (info.idVehicle >= 0)
644 {
645 if (_activationBy == ASAVehicle)
646 {
647 AssignVehicle(info.idVehicle);
648 }
649 else
650 {
651 EntityAI* veh = dyn_cast<EntityAI>(vehiclesMap[info.idVehicle].GetLink());
652 AIUnit* unit = veh ? veh->CommanderUnit() : nullptr;
653 AIGroup* grp = unit ? unit->GetGroup() : nullptr;
654 AssignGroup(grp);
655 }
656 }
657
658 _text = info.text;
659 _expCond = info.expCond;
660 _expActiv = info.expActiv;
661 _expDesactiv = info.expDesactiv;
662
663 _synchronizations = info.synchronizations;
664 _effects = info.effects;
665}
666
667void Detector::AssignGroup(AIGroup* group)
668{

Callers 1

CreateSensorFunction · 0.80

Calls 3

GetLinkMethod · 0.80
CommanderUnitMethod · 0.45
GetGroupMethod · 0.45

Tested by

no test coverage detected